Skip to content

Commit 49cee8b

Browse files
authored
PHP 8+ / Move CI to GHA (#24)
1 parent 738e4cc commit 49cee8b

24 files changed

+655
-369
lines changed

Diff for: .editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 4
9+
10+
[Makefile]
11+
indent_style = tab
12+
indent_size = 8
13+
14+
[{*.yml,*.yaml}]
15+
indent_style = space
16+
indent_size = 2

Diff for: .gitattributes

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Ignore all test and documentation for archive
2+
/.github export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/.scrutinizer.yml export-ignore
6+
/.travis.yml export-ignore
7+
/.editorconfig export-ignore
8+
/codecov.yml export-ignore
9+
/.remarkrc export-ignore
10+
/.remarkignore export-ignore
11+
/behat.yml export-ignore
12+
/phpunit.xml.dist export-ignore
13+
/phpcs.xml.dist export-ignore
14+
/CODE_OF_CONDUCT.md export-ignore
15+
/CONTRIBUTING.md export-ignore
16+
/Makefile export-ignore
17+
/tests export-ignore
18+
/features export-ignore
19+
/docs export-ignore

Diff for: .github/.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.yml]
2+
indent_style = space
3+
indent_size = 2

Diff for: .github/dependabot.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: 2
22
updates:
3-
#
4-
#
5-
# [GHAction]
6-
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/github-action.yml file
7-
#
3+
#
4+
#
5+
# [GHAction]
6+
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/github-action.yml file
7+
#
88
- package-ecosystem: github-actions
99
directory: /
1010
schedule:
@@ -14,22 +14,22 @@ updates:
1414
prefix: '[dependabot][ghaction] - ' # No need to specify prod/dev for GHAction as there is only "production" updates !
1515
include: scope
1616
groups:
17-
# Group all basic updates inside the a single PR
18-
# No need to split prod/dev as there is only prod updates
17+
# Group all basic updates inside the a single PR
18+
# No need to split prod/dev as there is only prod updates
1919
all-actions:
2020
applies-to: version-updates
2121
patterns: ['*']
22-
# Group all security updates inside the a single PR
23-
# No need to split prod/dev as there is only prod updates
24-
# +Most likely no need to split major and other updates either
22+
# Group all security updates inside the a single PR
23+
# No need to split prod/dev as there is only prod updates
24+
# +Most likely no need to split major and other updates either
2525
SECURITY-all:
2626
applies-to: security-updates
2727
patterns: ['*']
28-
#
29-
#
30-
# [Composer]
31-
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/composer.yml file
32-
#
28+
#
29+
#
30+
# [Composer]
31+
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/composer.yml file
32+
#
3333
- package-ecosystem: composer
3434
directory: /
3535
schedule: # Create PRs during week-ends, they will be ready on monday morning
@@ -41,9 +41,9 @@ updates:
4141
prefix-development: '[dependabot][dev][composer] - '
4242
include: scope
4343
groups:
44-
# Split basic updates by:
45-
# - prod vs dev
46-
# - major vs others (assuming packages properly follow semver !)
44+
# Split basic updates by:
45+
# - prod vs dev
46+
# - major vs others (assuming packages properly follow semver !)
4747
prod-majors:
4848
applies-to: version-updates
4949
dependency-type: production
@@ -62,9 +62,9 @@ updates:
6262
applies-to: version-updates
6363
dependency-type: development
6464
patterns: ['*']
65-
# Split security updates by:
66-
# - prod vs dev
67-
# - Major prod updates vs other prod updates
65+
# Split security updates by:
66+
# - prod vs dev
67+
# - Major prod updates vs other prod updates
6868
SECURITY-prod-major:
6969
applies-to: security-updates
7070
dependency-type: production

Diff for: .github/workflows/CI.yml

+234
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
name: 'CI'
2+
3+
on: # Build any PRs and main branch changes
4+
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
push:
10+
branches: [ master ]
11+
schedule:
12+
- cron: '0 0 1 * *' # Every month
13+
14+
concurrency:
15+
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
16+
cancel-in-progress: true
17+
18+
env:
19+
TEST_OUTPUT_STYLE: pretty
20+
COMPOSER_OPTIONS: --optimize-autoloader
21+
22+
jobs:
23+
tests:
24+
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
25+
runs-on: ubuntu-latest
26+
env:
27+
COVERAGE_TYPE: none
28+
strategy:
29+
fail-fast: true
30+
max-parallel: 4
31+
matrix:
32+
include:
33+
# Bare minimum => Lowest versions allowed by composer config
34+
- symfony-version: '4.4'
35+
php-version: '8.0'
36+
composer-flag: --prefer-lowest
37+
# Up to date versions => Latest versions allowed by composer config
38+
- symfony-version: '5.4'
39+
php-version: '8.2'
40+
# Late symfony migration => Lowest symfony version with latest minor php version allowed by composer config
41+
- symfony-version: '4.4'
42+
php-version: '8.2'
43+
composer-flag: --prefer-lowest
44+
# Late php migration => Latest symfony version with lowest minor php version allowed by composer config
45+
- symfony-version: '5.4'
46+
php-version: '8.0'
47+
# Symfony 6.0 latest
48+
- symfony-version: '6.0'
49+
php-version: '8.2'
50+
# Symfony 6.0 lowest
51+
- symfony-version: '6.0'
52+
php-version: '8.0'
53+
composer-flag: --prefer-lowest
54+
steps:
55+
- name: Check out code
56+
uses: actions/checkout@v3
57+
58+
- name: Enable coverage
59+
if: ${{ matrix.php-version == '8.2' }}
60+
run: |
61+
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
62+
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
63+
64+
- name: Setup PHP ${{ matrix.php-version }}
65+
uses: shivammathur/setup-php@v2
66+
env:
67+
update: true # Always use latest available patch for the version
68+
fail-fast: true # step will fail if an extension or tool fails to set up
69+
with:
70+
php-version: '${{ matrix.php-version }}'
71+
tools: composer
72+
coverage: ${{ env.COVERAGE_TYPE }}
73+
74+
- name: Setup cache
75+
id: cache
76+
uses: actions/cache@v4
77+
with:
78+
path: |
79+
~/.composer
80+
./vendor
81+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
82+
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
83+
84+
- name: Build
85+
run: |
86+
SF_VERSION=${{ matrix.symfony-version }}
87+
# Issue with ParamterBag below 4.4.30 => https://github.com/symfony/symfony/commit/3eca446b21607ea1c7a865ece2dd8254c33679cc
88+
test '${{ matrix.symfony-version }}' = '4.4' && test '${{ matrix.php-version }}' = '8.2' && SF_VERSION=4.4.30
89+
composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
90+
symfony/config:^$SF_VERSION \
91+
symfony/dependency-injection:^$SF_VERSION \
92+
symfony/http-kernel:^$SF_VERSION \
93+
symfony/event-dispatcher:^$SF_VERSION \
94+
symfony/framework-bundle:^$SF_VERSION \
95+
symfony/routing:^$SF_VERSION \
96+
&& composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
97+
&& make build
98+
99+
- name: Tests
100+
run: make test-unit && make test-functional
101+
102+
- name: Create "unit tests" reports group
103+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
104+
id: unit-tests-coverage-group
105+
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
106+
with:
107+
name: unit-tests
108+
format: clover
109+
files: build/coverage-phpunit/unit.clover
110+
flags: |
111+
unit-tests
112+
php-${{ matrix.php-version }}
113+
sf-${{ matrix.symfony-version }}
114+
path: build/coverage-groups
115+
116+
- name: Create "functional tests" coverage group
117+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
118+
id: functional-tests-coverage-group
119+
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
120+
with:
121+
name: functional-tests
122+
format: clover
123+
files: |
124+
build/coverage-phpunit/functional.clover
125+
build/coverage-behat/clover.xml
126+
flags: |
127+
functional-tests
128+
php-${{ matrix.php-version }}
129+
sf-${{ matrix.symfony-version }}
130+
path: build/coverage-groups
131+
132+
- name: Upload coverage reports
133+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: coverage-groups-php${{ matrix.php-version }}-sf${{ matrix.symfony-version }}
137+
path: build/coverage-groups
138+
if-no-files-found: error
139+
140+
static-checks:
141+
name: Static checks
142+
runs-on: ubuntu-latest
143+
steps:
144+
- uses: actions/checkout@v3
145+
146+
- name: Setup PHP 8.2
147+
uses: shivammathur/setup-php@v2
148+
with:
149+
php-version: 8.2 # Latest supported
150+
tools: composer
151+
coverage: none
152+
env:
153+
# Always use latest available patch for the version
154+
update: true
155+
156+
- name: Setup cache
157+
id: cache
158+
uses: actions/cache@v3
159+
with:
160+
path: |
161+
~/.composer
162+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
163+
key: tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}
164+
165+
- name: Build
166+
run: make build
167+
168+
- name: ComposerRequireChecker
169+
uses: docker://webfactory/composer-require-checker:4.5.0
170+
171+
- name: Dependencies check
172+
if: ${{ github.event_name == 'pull_request' }}
173+
uses: actions/dependency-review-action@v1
174+
175+
nightly-tests:
176+
name: Nightly - Symfony ${{ matrix.symfony-version }}
177+
runs-on: ubuntu-latest
178+
env:
179+
COMPOSER_OPTIONS: '--optimize-autoloader --ignore-platform-req=php+'
180+
continue-on-error: true
181+
needs: [ static-checks, tests ]
182+
strategy:
183+
fail-fast: false
184+
max-parallel: 4
185+
matrix:
186+
php-version:
187+
- '8.3' # Current php dev version
188+
symfony-version:
189+
- '4.4' # Lowest LTS
190+
- '5.4' # Latest LTS
191+
- '6.0' # Current major version
192+
include:
193+
- symfony-version: '6.3' # Next symfony minor version to manage with latest supported PHP version
194+
php-version: '8.2'
195+
196+
steps:
197+
- name: Check out code
198+
uses: actions/checkout@v3
199+
200+
- name: Setup PHP ${{ matrix.php-version }}
201+
uses: shivammathur/setup-php@v2
202+
with:
203+
php-version: '${{ matrix.php-version }}'
204+
tools: composer
205+
coverage: none
206+
env:
207+
# Always use latest available patch for the version
208+
update: true
209+
210+
- name: Setup cache
211+
id: cache
212+
uses: actions/cache@v3
213+
with:
214+
path: |
215+
~/.composer
216+
./vendor
217+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
218+
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
219+
220+
- name: Build
221+
run: |
222+
composer config minimum-stability dev \
223+
&& composer require -W ${{ env.COMPOSER_OPTIONS }} \
224+
symfony/config:^${{ matrix.symfony-version }} \
225+
symfony/dependency-injection:^${{ matrix.symfony-version }} \
226+
symfony/http-kernel:^${{ matrix.symfony-version }} \
227+
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
228+
symfony/framework-bundle:^${{ matrix.symfony-version }} \
229+
symfony/routing:^${{ matrix.symfony-version }} \
230+
&& composer update ${{ env.COMPOSER_OPTIONS }} \
231+
&& make build
232+
233+
- name: Test
234+
run: make test-unit && make test-functional

Diff for: .remarkignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor

Diff for: .remarkrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": [
3+
"remark-preset-lint-consistent",
4+
"remark-preset-lint-recommended"
5+
]
6+
}

0 commit comments

Comments
 (0)