-
Notifications
You must be signed in to change notification settings - Fork 26
114 lines (94 loc) · 3.32 KB
/
v2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Tests
on: [push]
jobs:
php-unit-tests:
name: PHP Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [7.4, 8.0, 8.1]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: json, mbstring, xml, zip
coverage: pcov
tools: composer:v2, phpunit:9.5
- name: Update project dependencies
env:
REPO_USR: ${{ secrets.REPO_USR }}
REPO_PSW: ${{ secrets.REPO_PSW }}
run: |
composer config repositories.0 composer https://repo.magento.com
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
composer install --prefer-dist --no-progress --no-suggest
- name: Run unit tests
run: vendor/bin/phpunit -c phpunit.xml.dist
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
flags: unittests
fail_ci_if_error: false
javascript-tests:
name: JavaScript Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install dependencies
run: npm install
- name: Run JavaScript tests
run: npm test
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage/lcov.info
flags: javascripttests
fail_ci_if_error: false
php-integration-tests:
name: PHP Integration Tests
runs-on: ubuntu-latest
needs: php-unit-tests
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'integration-tests') }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: magento_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout Magento
uses: actions/checkout@v2
with:
repository: magento/magento2
path: magento
- name: Checkout module
uses: actions/checkout@v2
with:
path: magento/app/code/Nosto/Tagging
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: json, mbstring, xml, intl, gd, zip, soap, pdo_mysql
coverage: pcov
tools: composer:v2, phpunit:9.5
- name: Install Magento
working-directory: magento
run: |
composer install --prefer-dist --no-progress
bin/magento setup:install --base-url=http://localhost/ --db-host=127.0.0.1 --db-name=magento_test --db-user=root --db-password=root --admin-firstname=Admin --admin-lastname=User [email protected] --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/New_York --use-rewrites=1 --backend-frontname=admin
- name: Run integration tests
working-directory: magento/app/code/Nosto/Tagging
run: vendor/bin/phpunit -c phpunit.integration.xml.dist