-
Notifications
You must be signed in to change notification settings - Fork 2
221 lines (198 loc) · 7.3 KB
/
CI.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
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
name: 'CI'
on: # Build any PRs and main branch changes
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
pull_request:
types:
- opened
- synchronize
push:
branches: [ master ]
schedule:
- cron: '0 0 1 * *' # Every month
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
env:
TEST_OUTPUT_STYLE: pretty
COMPOSER_OPTIONS: --optimize-autoloader
jobs:
tests:
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
runs-on: ubuntu-latest
env:
COVERAGE_TYPE: none
strategy:
fail-fast: true
max-parallel: 4
matrix:
include:
# Bare minimum => Lowest versions allowed by composer config
- symfony-version: '4.4'
php-version: '8.0'
composer-flag: --prefer-lowest
# Up to date versions => Latest versions allowed by composer config
- symfony-version: '5.4'
php-version: '8.2'
# Late symfony migration => Lowest symfony version with latest minor php version allowed by composer config
- symfony-version: '4.4'
php-version: '8.2'
composer-flag: --prefer-lowest
# Late php migration => Latest symfony version with lowest minor php version allowed by composer config
- symfony-version: '5.4'
php-version: '8.0'
# Symfony 6.0 latest
- symfony-version: '6.0'
php-version: '8.2'
# Symfony 6.0 lowest
- symfony-version: '6.0'
php-version: '8.0'
composer-flag: --prefer-lowest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Enable coverage
if: ${{ matrix.php-version == '8.2' }}
run: |
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
env:
update: true # Always use latest available patch for the version
fail-fast: true # step will fail if an extension or tool fails to set up
with:
php-version: '${{ matrix.php-version }}'
tools: composer
coverage: ${{ env.COVERAGE_TYPE }}
- name: Setup cache
id: cache
uses: actions/cache@v3
with:
path: |
~/.composer
./vendor
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
- name: Build
run: |
SF_VERSION=${{ matrix.symfony-version }}
# Issue with ParamterBag below 4.4.30 => https://github.com/symfony/symfony/commit/3eca446b21607ea1c7a865ece2dd8254c33679cc
test '${{ matrix.symfony-version }}' = '4.4' && test '${{ matrix.php-version }}' = '8.2' && SF_VERSION=4.4.30
composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
symfony/validator:^$SF_VERSION \
&& composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
&& make build
- name: Tests
run: make test-unit && make test-functional
- name: Create "unit tests" reports group
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
id: unit-tests-coverage-group
uses: yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
with:
name: unit-tests
format: clover
files: build/coverage-phpunit/unit.clover
flags: |
unit-tests
php-${{ matrix.php-version }}
path: build/coverage-groups
- name: Create "functional tests" coverage group
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
id: functional-tests-coverage-group
uses: yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
with:
name: functional-tests
format: clover
files: |
build/coverage-phpunit/functional.clover
build/coverage-behat/clover.xml
flags: |
functional-tests
php-${{ matrix.php-version }}
path: build/coverage-groups
- name: Upload coverage reports
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
uses: actions/upload-artifact@v4
with:
name: coverage-groups-php${{ matrix.php-version }}-sf${{ matrix.symfony-version }}
path: build/coverage-groups
if-no-files-found: error
static-checks:
name: Static checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2 # Latest supported
tools: composer
coverage: none
env:
# Always use latest available patch for the version
update: true
- name: Setup cache
id: cache
uses: actions/cache@v3
with:
path: |
~/.composer
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}
- name: Build
run: make build
- name: ComposerRequireChecker
uses: docker://webfactory/composer-require-checker:4.5.0
- name: Dependencies check
if: ${{ github.event_name == 'pull_request' }}
uses: actions/dependency-review-action@v1
nightly-tests:
name: Nightly - Symfony ${{ matrix.symfony-version }}
runs-on: ubuntu-latest
env:
COMPOSER_OPTIONS: '--optimize-autoloader --ignore-platform-req=php+'
continue-on-error: true
needs: [ static-checks, tests ]
strategy:
fail-fast: false
max-parallel: 4
matrix:
php-version:
- '8.3' # Current php dev version
symfony-version:
- '4.4' # Lowest LTS
- '5.4' # Latest LTS
- '6.0' # Current major version
include:
- symfony-version: '6.3' # Next symfony minor version to manage with latest supported PHP version
php-version: '8.2'
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php-version }}'
tools: composer
coverage: none
env:
# Always use latest available patch for the version
update: true
- name: Setup cache
id: cache
uses: actions/cache@v3
with:
path: |
~/.composer
./vendor
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
- name: Build
run: |
composer config minimum-stability dev \
&& composer require -W ${{ env.COMPOSER_OPTIONS }} \
symfony/validator:^${{ matrix.symfony-version }} \
&& composer update ${{ env.COMPOSER_OPTIONS }} \
&& make build
- name: Test
run: make test-unit && make test-functional