-
Notifications
You must be signed in to change notification settings - Fork 0
221 lines (192 loc) · 8.79 KB
/
ci.yml
File metadata and controls
221 lines (192 loc) · 8.79 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
on:
push:
branches:
- "main"
pull_request:
# schedule:
# - cron: '24 10 * * 4'
name: "CI"
permissions:
contents: read
env:
PHP_VERSION: "8.3"
jobs:
qa:
name: "QA (lint + static analysis)"
if: "!startsWith(github.event.head_commit.message, 'chore(release)')"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
- name: "Install PHP"
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # 2.36.0
with:
coverage: "none"
php-version: "${{ env.PHP_VERSION }}"
- name: "Validate composer.json and composer.lock"
if: "github.actor != 'renovate[bot]' || contains(github.head_ref, 'lock-file-maintenance')"
run: "composer validate --ansi --strict"
- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
- name: "Cache dependencies installed with composer"
uses: "actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306" # v5.0.3
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ env.PHP_VERSION }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: |
php-${{ env.PHP_VERSION }}-composer-locked-${{ github.ref_name }}
php-${{ env.PHP_VERSION }}-composer-locked-
php-${{ env.PHP_VERSION }}-composer-main
- name: "Install locked dependencies with composer"
uses: "ergebnis/.github/actions/composer/install@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
with:
dependencies: "${{ (github.actor == 'renovate[bot]' && !contains(github.head_ref, 'lock-file-maintenance')) && 'highest' || 'locked' }}"
- name: "Check coding style"
run: "vendor/bin/codecept build"
- name: "Check coding style"
run: "composer cs:check"
- name: "Run static analysis"
run: "composer stan"
# codacy:
# name: "Codacy Security Scan"
# if: "!startsWith(github.event.head_commit.message, 'chore(release)')"
# runs-on: "ubuntu-latest"
# permissions:
# contents: read
# security-events: write
# actions: read
# steps:
# - name: Checkout code
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
#
# - name: Run Codacy Analysis CLI
# uses: codacy/codacy-analysis-cli-action@30783d03e758713bb5ed7b79292cfb14b9dd9a4a
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# verbose: false
# output: results.sarif
# format: sarif
# upload: true
# skip-uncommitted-files-check: true
# gh-code-scanning-compat: true
# max-allowed-issues: 2147483647
tests:
name: "Run codeception tests"
needs: [ qa ]
runs-on: "ubuntu-latest"
strategy:
matrix:
include:
- { php-version: 8.3, dependencies: locked, coverage: pcov, with_coverage: false, allow-fail: false }
- { php-version: 8.4, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: true }
- { php-version: 8.5, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: true }
steps:
- name: "Checkout"
uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
- name: "Install PHP"
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # 2.36.0
with:
coverage: "${{ matrix.coverage }}"
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
php-version: "${{ matrix.php-version }}"
- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
- name: "Set up problem matchers for phpunit/phpunit"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""
- name: "Validate composer.json and composer.lock"
if: "github.actor != 'renovate[bot]' || contains(github.head_ref, 'lock-file-maintenance')"
run: "composer validate --ansi --strict"
- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
- name: "Cache dependencies installed with composer"
uses: "actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306" # v5.0.3
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: |
php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ github.ref_name }}
php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
php-${{ matrix.php-version }}-composer-main
- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/install@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
with:
dependencies: "${{ (github.actor == 'renovate[bot]' && !contains(github.head_ref, 'lock-file-maintenance') && matrix.dependencies == 'locked') && 'highest' || matrix.dependencies }}"
- name: "Run Tests (coverage)"
if: matrix.with_coverage == true
run: |
vendor/bin/codecept build
vendor/bin/codecept run --coverage --coverage-xml=coverage.xml --xml --report
- name: "Run Tests"
if: matrix.with_coverage != true
run: |
vendor/bin/codecept build
vendor/bin/codecept run --xml --report
- name: "Upload coverage artifact"
if: matrix.with_coverage == true
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: code-coverage-results
path: tests/_output/
retention-days: 5
# - name: "Upload Coverage coverage"
# if: matrix.with_coverage == true
# run: |
# export CODACY_PROJECT_TOKEN=${{ secrets.CODACY_PROJECT_TOKEN }}
# bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r ./build/logs/coverage.xml
#
# - name: Upload test results to Codecov
# if: ${{ !cancelled() && matrix.with_coverage == true }}
# uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# files: ./build/logs/report.xml
# flags: unittests # optional
# report_type: test_results
# fail_ci_if_error: "${{ matrix.with_coverage }}" # optional (default = false)
# verbose: false # optional (default = false)
# - name: Upload coverage to Codecov
# if: ${{ !cancelled() && matrix.with_coverage == true }}
# uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# files: ./build/logs/coverage.xml
# flags: unittests # optional
# fail_ci_if_error: "${{ matrix.with_coverage }}" # optional (default = false)
# verbose: false # optional (default = false)
release:
name: "Release"
needs:
- tests
# - codacy
if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'chore(release)')"
runs-on: "ubuntu-latest"
permissions:
actions: read
contents: read
steps:
- name: Generate Token
id: generate_token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: Semantic Release
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
with:
tag_format: ${version}
branches: |
['main']
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/github
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}