Skip to content

Commit 95df7e0

Browse files
authored
Reports group - v0 (#29)
1 parent b84b21a commit 95df7e0

File tree

5 files changed

+303
-215
lines changed

5 files changed

+303
-215
lines changed

.github/workflows/CI.yml

+13-168
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
name: 'CI'
2+
23
on: # Build any PRs and main branch changes
34
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
45
pull_request:
56
types:
67
- opened
78
- 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'
817
push:
918
branches: [ master ]
1019
schedule:
@@ -20,171 +29,7 @@ env:
2029

2130
jobs:
2231
tests:
23-
name: UTs & FTs - PHP ${{ matrix.php-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-
- php-version: '8.0'
34-
composer-flag: --prefer-lowest
35-
# Up to date versions => Latest versions allowed by composer config
36-
- php-version: '8.2'
37-
steps:
38-
- name: Check out code
39-
uses: actions/checkout@v4
40-
41-
- name: Enable coverage
42-
if: ${{ matrix.php-version == '8.2' }}
43-
run: |
44-
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
45-
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
46-
47-
- name: Setup PHP ${{ matrix.php-version }}
48-
uses: shivammathur/setup-php@v2
49-
env:
50-
update: true # Always use latest available patch for the version
51-
fail-fast: true # step will fail if an extension or tool fails to set up
52-
with:
53-
php-version: '${{ matrix.php-version }}'
54-
tools: composer
55-
coverage: ${{ env.COVERAGE_TYPE }}
56-
57-
- name: Setup cache
58-
id: cache
59-
uses: actions/cache@v4
60-
with:
61-
path: |
62-
~/.composer
63-
./vendor
64-
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
65-
key: tests-${{ matrix.php-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
66-
67-
- name: Build
68-
run: |
69-
composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
70-
&& make build
71-
72-
- name: Tests
73-
run: make test-unit && make test-functional
74-
75-
- name: Create "unit tests" reports group
76-
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
77-
id: unit-tests-coverage-group
78-
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
79-
with:
80-
name: unit-tests
81-
format: clover
82-
files: build/coverage-phpunit/unit.clover
83-
flags: |
84-
unit-tests
85-
php-${{ matrix.php-version }}
86-
path: build/coverage-groups
87-
88-
- name: Create "functional tests" coverage group
89-
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
90-
id: functional-tests-coverage-group
91-
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
92-
with:
93-
name: functional-tests
94-
format: clover
95-
files: |
96-
build/coverage-phpunit/functional.clover
97-
build/coverage-behat/clover.xml
98-
flags: |
99-
functional-tests
100-
php-${{ matrix.php-version }}
101-
path: build/coverage-groups
102-
103-
- name: Upload coverage reports
104-
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
105-
uses: actions/upload-artifact@v4
106-
with:
107-
name: coverage-groups-php${{ matrix.php-version }}
108-
path: build/coverage-groups
109-
if-no-files-found: error
110-
111-
static-checks:
112-
name: Static checks
113-
runs-on: ubuntu-latest
114-
steps:
115-
- uses: actions/checkout@v4
116-
117-
- name: Setup PHP 8.2
118-
uses: shivammathur/setup-php@v2
119-
with:
120-
php-version: 8.2 # Latest supported
121-
tools: composer
122-
coverage: none
123-
env:
124-
# Always use latest available patch for the version
125-
update: true
126-
127-
- name: Setup cache
128-
id: cache
129-
uses: actions/cache@v4
130-
with:
131-
path: |
132-
~/.composer
133-
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
134-
key: tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}
135-
136-
- name: Build
137-
run: make build
138-
139-
- name: ComposerRequireChecker
140-
uses: docker://webfactory/composer-require-checker:4.5.0
141-
142-
- name: Dependencies check
143-
if: ${{ github.event_name == 'pull_request' }}
144-
uses: actions/dependency-review-action@v4
145-
146-
nightly-tests:
147-
name: Nightly - PHP ${{ matrix.php-version }}
148-
runs-on: ubuntu-latest
149-
env:
150-
COMPOSER_OPTIONS: '--optimize-autoloader --ignore-platform-req=php+'
151-
continue-on-error: true
152-
needs: [ static-checks, tests ]
153-
strategy:
154-
fail-fast: false
155-
max-parallel: 4
156-
matrix:
157-
php-version:
158-
- '8.3' # Current php dev version
159-
160-
steps:
161-
- name: Check out code
162-
uses: actions/checkout@v4
163-
164-
- name: Setup PHP ${{ matrix.php-version }}
165-
uses: shivammathur/setup-php@v2
166-
with:
167-
php-version: '${{ matrix.php-version }}'
168-
tools: composer
169-
coverage: none
170-
env:
171-
# Always use latest available patch for the version
172-
update: true
173-
174-
- name: Setup cache
175-
id: cache
176-
uses: actions/cache@v4
177-
with:
178-
path: |
179-
~/.composer
180-
./vendor
181-
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
182-
key: tests-${{ matrix.php-version }}-${{ hashFiles('composer.json') }}
183-
184-
- name: Build
185-
run: |
186-
composer update ${{ env.COMPOSER_OPTIONS }} \
187-
&& make build
188-
189-
- name: Test
190-
run: make test-unit && make test-functional
32+
name: Tests
33+
permissions:
34+
contents: read
35+
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)