-
Notifications
You must be signed in to change notification settings - Fork 10
157 lines (139 loc) · 5.3 KB
/
main.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: m2-actions-sequra-core-test
on: [push]
jobs:
magento2-test:
runs-on: ubuntu-latest
container: ubuntu
name: 'm2 unit and integration tests'
services:
mysql:
image: docker://mysql:8.0
env:
MYSQL_ROOT_PASSWORD: magento
MYSQL_DATABASE: magento
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
opensearch:
image: ghcr.io/mad-i-t/magento-opensearch:2.5.0
ports:
- 9200:9200
options: -e="discovery.type=single-node" -e "plugins.security.disabled=true" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
rabbitmq:
image: docker://rabbitmq:3.8-alpine
env:
RABBITMQ_DEFAULT_USER: "magento"
RABBITMQ_DEFAULT_PASS: "magento"
RABBITMQ_DEFAULT_VHOST: "/"
ports:
- 5672:5672
strategy:
matrix:
magento_version: [2.4.6]
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Build composer auth
shell: bash
run: |
echo "auth={\"http-basic\": {\"repo.magento.com\": {\"username\": \"5310458a34d580de1700dfe826ff19a1\",\"password\":\"${{ secrets.REPO_MAGENTO_PASS }}\"} },\"github-oauth\":{\"github.com\":\"${{ github.token }}\"} }" >> $GITHUB_OUTPUT
id: composer_auth
- name: 'install fresh magento repo'
uses: MAD-I-T/magento-actions@v3.25
env:
COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
with:
process: 'install-magento'
magento_version: ${{ matrix.magento_version }}
no_push: 1 ## add this arg to not push to the repo ideal for quick test on specific version
### Download our code in custom dir###
- uses: actions/checkout@v3
with:
path: magento/app/code/Sequra/Core
- uses: "shivammathur/setup-php@v2"
with:
php-version: "8.2"
- name: 'Alternative unit test'
working-directory: magento
env:
COMPOSER_AUTH: ${{ steps.composer_auth.outputs.auth }}
run: |
rm -rf app/code/Sequra/Core
vendor/bin/composer config minimum-stability dev
vendor/bin/composer config repositories.sequra/magento2-core vcs git@github.com:sequra/magento2-core.git
vendor/bin/composer require sequra/magento2-core:"dev-${{ steps.extract_branch.outputs.branch }}" --ignore-platform-reqs
vendor/bin/phpunit --bootstrap app/bootstrap.php vendor/sequra/magento2-core/Test/Unit
- name: 'launch magento2 unit test'
if: always()
uses: MAD-I-T/magento-actions@v3.25
env:
COMPOSER_AUTH: ${{ steps.composer_auth.outputs.auth }}
with:
process: 'unit-test'
unit_test_subset_path: 'vendor/sequra/magento2-core/Test/Unit'
override_settings: 1
magento_version: ${{ matrix.magento_version }}
- name: 'debug'
run: ls -l magento/vendor/sequra
# Integrations tests
- name: "copy integration test's phpunit.xml"
run: cp magento/app/code/Sequra/Core/Test/Integration/phpunit.xml.dist magento/dev/tests/integration/phpunit.xml
- name: 'To run all test in copied phpunit.xml'
uses: MAD-I-T/magento-actions@master
env:
COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
with:
process: 'integration-test'
unit_test_subset_path: "Sequra_Core Integration Tests"
magento2-checks:
runs-on: ubuntu-latest
container: ubuntu
name: 'm2 Standards, MD and PHPStan'
strategy:
matrix:
magento_version: [2.4.6]
steps:
### Download our code in custom dir###
- uses: actions/checkout@v3
with:
path: Sequra_Core
- name: 'install fresh magento repo'
uses: MAD-I-T/magento-actions@v3.25
env:
COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
with:
process: 'install-magento'
magento_version: ${{ matrix.magento_version }}
no_push: 1 ## add this arg to not push to the repo ideal for quick test on specific version
- uses: "shivammathur/setup-php@v2"
with:
php-version: "8.2"
- name: 'unit test'
run: |
cd Sequra_Core
../magento/vendor/bin/composer install
PAT="s/\/REAL-PATH-TO-MAGENTO-ROOT/..\/magento/g"
sed -e $PAT Test/autoload_sample.php > Test/autoload.php
../magento/vendor/bin/phpunit -c Test/phpunit.xml Test/Unit
- name: 'phpstan'
if: always()
uses: MAD-I-T/magento-actions@v3.25
with:
process: 'phpstan'
exec_path: '../Sequra_Core'
- name: 'mess detector'
if: always()
uses: MAD-I-T/magento-actions@v3.25
with:
process: 'mess-detector'
md_src_path: '../Sequra_Core'
- name: 'Magento coding standard checking'
if: always()
uses: MAD-I-T/magento-actions@v3.25
with:
process: 'phpcs-test'
extension: 'Sequra_Core'
severity: 10
standard: 'Magento2'