Skip to content

Commit bb0f5dc

Browse files
authored
Reports group - v0 (#34)
1 parent a9da9b7 commit bb0f5dc

File tree

5 files changed

+345
-262
lines changed

5 files changed

+345
-262
lines changed

.github/workflows/CI.yml

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

18-
env:
19-
TEST_OUTPUT_STYLE: pretty
20-
COMPOSER_OPTIONS: --optimize-autoloader
21-
2226
jobs:
2327
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@v4
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-foundation:^$SF_VERSION \
93-
symfony/http-kernel:^$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@v4
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@v4
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@v4
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@v4
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@v4
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-foundation:^${{ matrix.symfony-version }} \
227-
symfony/http-kernel:^${{ 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
28+
name: Tests
29+
permissions:
30+
contents: read
31+
uses: ./.github/workflows/reusable-CI-workflow.yml

.github/workflows/coverage-upload.yml

Lines changed: 6 additions & 47 deletions
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
Lines changed: 40 additions & 0 deletions
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)