-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (177 loc) · 5.9 KB
/
Copy pathci.yml
File metadata and controls
183 lines (177 loc) · 5.9 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: CI
on:
push:
branches: ['main', '6']
pull_request:
branches: ['main', '6']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
env:
COMPOSE: docker compose -f .docker/compose.yml -f .docker/compose.ci.yml
COMPOSE_BAKE: 'true'
CACHE_SCOPE: app-php8.3
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
steps:
- uses: actions/checkout@v7
- name: Log in to Docker Hub
if: env.DOCKERHUB_USERNAME != ''
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: arduino/setup-task@v3
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-docker-mirror
- run: task docker-env
- name: Build image (GHA layer cache)
run: $COMPOSE build app
- name: Start services
run: |
$COMPOSE up -d --wait app || {
echo "::group::app container logs"; $COMPOSE logs app; echo "::endgroup::"
$COMPOSE ps -a
exit 1
}
- run: task analyse
- run: task analyse-php85
- run: task rector-dry
php-qa:
name: PHP QA (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
php: ['8.3', '8.4', '8.5']
env:
PHP_VERSION: ${{ matrix.php }}
COMPOSE: docker compose -f .docker/compose.yml -f .docker/compose.ci.yml
COMPOSE_BAKE: 'true'
CACHE_SCOPE: app-php${{ matrix.php }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
steps:
- uses: actions/checkout@v7
- name: Log in to Docker Hub
if: env.DOCKERHUB_USERNAME != ''
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: arduino/setup-task@v3
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-docker-mirror
- run: task docker-env
- name: Build image (GHA layer cache)
run: $COMPOSE build app
- name: Start services
run: |
$COMPOSE up -d --wait app || {
echo "::group::app container logs"; $COMPOSE logs app; echo "::endgroup::"
$COMPOSE ps -a
exit 1
}
# PHP 8.3 owns the coverage gate; 8.4/8.5 run the suites without pcov overhead.
- if: matrix.php == '8.3'
name: Run tests with coverage + 90% gate
run: |
$COMPOSE exec -T app vendor/bin/phpunit \
--log-junit coverage/junit.xml \
--coverage-clover coverage/clover.xml
$COMPOSE exec -T app vendor/bin/coverage-check coverage/clover.xml 90
- if: matrix.php != '8.3'
name: Run tests
run: >-
$COMPOSE exec -T app vendor/bin/phpunit
--log-junit coverage/junit.xml
- uses: dorny/test-reporter@v3
if: always()
with:
name: PHPUnit Results (PHP ${{ matrix.php }})
path: coverage/junit.xml
reporter: java-junit
e2e:
name: E2E (${{ matrix.browser }})
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox]
env:
COMPOSE: docker compose -f .docker/compose.yml -f .docker/compose.ci.yml
COMPOSE_BAKE: 'true'
CACHE_SCOPE: app-php8.3
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
steps:
- uses: actions/checkout@v7
- name: Log in to Docker Hub
if: env.DOCKERHUB_USERNAME != ''
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: arduino/setup-task@v3
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- uses: actions/cache/restore@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ matrix.browser }}-${{ hashFiles('package-lock.json') }}
- if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install ${{ matrix.browser }}
- if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps ${{ matrix.browser }}
- if: steps.playwright-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ matrix.browser }}-${{ hashFiles('package-lock.json') }}
- uses: ./.github/actions/setup-docker-mirror
- run: task docker-env
- name: Build image (GHA layer cache)
run: $COMPOSE build app
- name: Start services
run: |
$COMPOSE up -d --wait app || {
echo "::group::app container logs"; $COMPOSE logs app; echo "::endgroup::"
$COMPOSE ps -a
exit 1
}
- name: Run Playwright
run: npx playwright test --project=${{ matrix.browser }} --reporter=html,junit
env:
PLAYWRIGHT_JUNIT_OUTPUT_NAME: reports/playwright-junit.xml
- uses: dorny/test-reporter@v3
if: always()
with:
name: Playwright Results (${{ matrix.browser }})
path: reports/playwright-junit.xml
reporter: java-junit
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report-${{ matrix.browser }}
path: playwright-report/
retention-days: 7