Skip to content

Commit 6581c3c

Browse files
authored
Reports group - v0 (#30)
1 parent 7144031 commit 6581c3c

5 files changed

+335
-252
lines changed

.github/workflows/CI.yml

+12-205
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ on: # Build any PRs and main branch changes
55
types:
66
- opened
77
- synchronize
8+
paths-ignore:
9+
# In case of updates to those workflows, they must be pre-checked by `pre-check-CI-updates.yml` rather than this workflow !
10+
# Any updates on those workflows are expected to be restricted to those workflows only ! (no update on code for instance)
11+
- '.github/workflows/pre-check-CI-updates.yml'
12+
- '.github/workflows/CI.yml'
13+
- '.github/workflows/coverage-upload.yml'
14+
- '.github/workflows/reusable-CI-workflow.yml'
15+
- '.github/workflows/reusable-coverage-upload-workflow.yml'
816
push:
917
branches: [ master ]
1018
schedule:
@@ -14,210 +22,9 @@ concurrency:
1422
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
1523
cancel-in-progress: true
1624

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

.github/workflows/coverage-upload.yml

+6-47
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,16 @@
1-
name: 'Coverage upload'
1+
name: 'Coverage'
22
on:
33
workflow_run:
44
workflows: ["CI"]
55
types: [completed]
66

77
jobs:
8-
fetch-info:
9-
name: Fetch triggering workflow metadata
10-
runs-on: ubuntu-latest
11-
permissions:
12-
contents: read
13-
checks: write # For the check run creation !
14-
steps:
15-
- name: 'Check run ○'
16-
uses: yoanm/temp-reports-group-workspace/.github/actions/attach-check-run-to-triggering-workflow-action@develop
17-
with:
18-
name: 'Fetch coverage info'
19-
fails-on-triggering-workflow-failure: true
20-
21-
- uses: yoanm/temp-reports-group-workspace/.github/actions/fetch-workflow-metadata-action@develop
22-
id: fetch-workflow-metadata
23-
24-
outputs:
25-
commit-sha: ${{ steps.fetch-workflow-metadata.outputs.commit-sha }}
26-
run-id: ${{ steps.fetch-workflow-metadata.outputs.run-id }}
27-
28-
codacy-uploader:
29-
name: Codacy
30-
needs: [fetch-info]
31-
uses: yoanm/temp-reports-group-workspace/.github/workflows/codacy-upload-from-artifacts.yml@develop
32-
permissions:
33-
contents: read
34-
checks: write # For the check run creation !
35-
secrets:
36-
PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
37-
with:
38-
artifacts-pattern: coverage-groups-*
39-
run-id: ${{ needs.fetch-info.outputs.run-id }}
40-
41-
codecov-uploader:
42-
name: Codecov
43-
needs: [fetch-info]
44-
uses: yoanm/temp-reports-group-workspace/.github/workflows/codecov-upload-from-artifacts.yml@develop
8+
upload:
9+
name: Upload
4510
permissions:
4611
contents: read
4712
checks: write # For the check run creation !
4813
secrets:
49-
TOKEN: ${{ secrets.CODECOV_TOKEN }}
50-
with:
51-
artifacts-pattern: coverage-groups-*
52-
run-id: ${{ needs.fetch-info.outputs.run-id }}
53-
override-commit: ${{ needs.fetch-info.outputs.commit-sha }}
54-
override-branch: ${{ needs.fetch-info.outputs.branch }}
55-
override-pr: ${{ needs.fetch-info.outputs.pr-number }}
56-
override-build: ${{ needs.fetch-info.outputs.run-id }}
57-
override-build-url: ${{ needs.fetch-info.outputs.run-url }}
14+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
15+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
16+
uses: ./.github/workflows/reusable-coverage-upload-workflow.yml
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 'Test CI updates'
2+
# [DESCRIPTION]
3+
# As CI workflow relies on `workflow_run` trigger for upload, this workflow is used in order to ease updates made on
4+
# CI workflow (or linked workflows/actions). It's kind of pre-check to ensure once updates are merged on main branch,
5+
# the `workflow_run` workflow execution will behave as expected.
6+
7+
on:
8+
pull_request:
9+
types:
10+
- opened
11+
- synchronize
12+
branches: [master] # Only for PR targeting master branch
13+
paths: # /!\ Duplicate the same list as `on.pull_request.paths-ignore` property value for CI workflow !
14+
- '.github/workflows/pre-check-CI-updates.yml' # This workflow
15+
- '.github/workflows/CI.yml'
16+
- '.github/workflows/coverage-upload.yml'
17+
- '.github/workflows/reusable-CI-workflow.yml'
18+
- '.github/workflows/reusable-coverage-upload-workflow.yml'
19+
20+
concurrency:
21+
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
22+
cancel-in-progress: true
23+
24+
jobs:
25+
tests:
26+
name: Tests
27+
permissions:
28+
contents: read
29+
uses: ./.github/workflows/reusable-CI-workflow.yml
30+
31+
upload:
32+
name: Upload
33+
needs: [tests]
34+
permissions:
35+
contents: read
36+
checks: write # For the check run creation !
37+
secrets:
38+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
39+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
40+
uses: ./.github/workflows/reusable-coverage-upload-workflow.yml

0 commit comments

Comments
 (0)