Skip to content

Commit 49190f9

Browse files
authored
Reports group - v0 (#35)
1 parent 7a71a15 commit 49190f9

File tree

5 files changed

+339
-256
lines changed

5 files changed

+339
-256
lines changed

.github/workflows/CI.yml

+12-209
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,214 +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-
symfony/intl:^$SF_VERSION \
91-
symfony/expression-language:^$SF_VERSION \
92-
&& composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
93-
&& make build
94-
95-
- name: Tests
96-
run: make test-unit && make test-functional
97-
98-
- name: Create "unit tests" reports group
99-
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
100-
id: unit-tests-coverage-group
101-
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
102-
with:
103-
name: unit-tests
104-
format: clover
105-
files: build/coverage-phpunit/unit.clover
106-
flags: |
107-
unit-tests
108-
php-${{ matrix.php-version }}
109-
sf-${{ matrix.symfony-version }}
110-
path: build/coverage-groups
111-
112-
- name: Create "functional tests" coverage group
113-
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
114-
id: functional-tests-coverage-group
115-
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
116-
with:
117-
name: functional-tests
118-
format: clover
119-
files: |
120-
build/coverage-phpunit/functional.clover
121-
build/coverage-behat/clover.xml
122-
flags: |
123-
functional-tests
124-
php-${{ matrix.php-version }}
125-
sf-${{ matrix.symfony-version }}
126-
path: build/coverage-groups
127-
128-
- name: Upload coverage reports
129-
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
130-
uses: actions/upload-artifact@v4
131-
with:
132-
name: coverage-groups-php${{ matrix.php-version }}-sf${{ matrix.symfony-version }}
133-
path: build/coverage-groups
134-
if-no-files-found: error
135-
136-
static-checks:
137-
name: Static checks
138-
runs-on: ubuntu-latest
139-
steps:
140-
- uses: actions/checkout@v4
141-
142-
- name: Setup PHP 8.2
143-
uses: shivammathur/setup-php@v2
144-
with:
145-
php-version: 8.2 # Latest supported
146-
tools: composer
147-
coverage: none
148-
env:
149-
# Always use latest available patch for the version
150-
update: true
151-
152-
- name: Setup cache
153-
id: cache
154-
uses: actions/cache@v4
155-
with:
156-
path: |
157-
~/.composer
158-
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
159-
key: tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}
160-
161-
- name: Build
162-
run: make build
163-
164-
- name: ComposerRequireChecker
165-
uses: docker://webfactory/composer-require-checker:4.5.0
166-
167-
- name: Dependencies check
168-
if: ${{ github.event_name == 'pull_request' }}
169-
uses: actions/dependency-review-action@v4
170-
171-
nightly-tests:
172-
name: Nightly - Symfony ${{ matrix.symfony-version }}
173-
runs-on: ubuntu-latest
174-
env:
175-
COMPOSER_OPTIONS: '--optimize-autoloader --ignore-platform-req=php+'
176-
continue-on-error: true
177-
needs: [ static-checks, tests ]
178-
strategy:
179-
fail-fast: false
180-
max-parallel: 4
181-
matrix:
182-
php-version:
183-
- '8.3' # Current php dev version
184-
symfony-version:
185-
- '4.4' # Lowest LTS
186-
- '5.4' # Latest LTS
187-
- '6.0' # Current major version
188-
include:
189-
- symfony-version: '6.3' # Next symfony minor version to manage with latest supported PHP version
190-
php-version: '8.2'
191-
192-
steps:
193-
- name: Check out code
194-
uses: actions/checkout@v4
195-
196-
- name: Setup PHP ${{ matrix.php-version }}
197-
uses: shivammathur/setup-php@v2
198-
with:
199-
php-version: '${{ matrix.php-version }}'
200-
tools: composer
201-
coverage: none
202-
env:
203-
# Always use latest available patch for the version
204-
update: true
205-
206-
- name: Setup cache
207-
id: cache
208-
uses: actions/cache@v4
209-
with:
210-
path: |
211-
~/.composer
212-
./vendor
213-
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
214-
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
215-
216-
- name: Build
217-
run: |
218-
composer config minimum-stability dev \
219-
&& composer require -W ${{ env.COMPOSER_OPTIONS }} \
220-
symfony/validator:^${{ matrix.symfony-version }} \
221-
symfony/intl:^${{ matrix.symfony-version }} \
222-
symfony/expression-language:^${{ matrix.symfony-version }} \
223-
&& composer update ${{ env.COMPOSER_OPTIONS }} \
224-
&& make build
225-
226-
- name: Test
227-
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)