|
1 |
| -name: 'CI' |
2 |
| -on: # Build any PRs and main branch changes |
3 |
| - workflow_dispatch: # Allows to run the workflow manually from the Actions tab |
4 |
| - pull_request: |
5 |
| - types: |
6 |
| - - opened |
7 |
| - - synchronize |
8 |
| - push: |
9 |
| - branches: [ master ] |
10 |
| - schedule: |
11 |
| - - cron: '0 0 1 * *' # Every month |
12 |
| - |
13 |
| -concurrency: |
14 |
| - group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" |
15 |
| - cancel-in-progress: true |
16 |
| - |
17 |
| -env: |
18 |
| - TEST_OUTPUT_STYLE: pretty |
19 |
| - COMPOSER_OPTIONS: --optimize-autoloader |
| 1 | +name: 'Coverage upload' |
| 2 | +on: |
| 3 | + workflow_run: |
| 4 | + workflows: ["CI"] |
| 5 | + types: [completed] |
20 | 6 |
|
21 | 7 | jobs:
|
22 |
| - 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@v3 |
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@v3 |
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/tmp-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/tmp-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 |
| 8 | + fetch-info: |
| 9 | + name: Fetch triggering workflow metadata |
113 | 10 | runs-on: ubuntu-latest
|
| 11 | + permissions: |
| 12 | + contents: read |
| 13 | + checks: write # For the check run creation ! |
114 | 14 | steps:
|
115 |
| - - uses: actions/checkout@v3 |
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@v3 |
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@v1 |
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@v3 |
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@v3 |
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 |
| 15 | + - name: 'Check run ○' |
| 16 | + uses: yoanm/tmp-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/tmp-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/tmp-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 | + override-commit: ${{ needs.fetch-info.outputs.commit-sha }} |
| 41 | + |
| 42 | + codecov-uploader: |
| 43 | + name: Codecov |
| 44 | + needs: [fetch-info] |
| 45 | + uses: yoanm/tmp-reports-group-workspace/.github/workflows/codecov-upload-from-artifacts.yml@develop |
| 46 | + permissions: |
| 47 | + contents: read |
| 48 | + checks: write # For the check run creation ! |
| 49 | + secrets: |
| 50 | + TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 51 | + with: |
| 52 | + artifacts-pattern: coverage-groups-* |
| 53 | + run-id: ${{ needs.fetch-info.outputs.run-id }} |
| 54 | + override-commit: ${{ needs.fetch-info.outputs.commit-sha }} |
| 55 | + override-branch: ${{ needs.fetch-info.outputs.branch }} |
| 56 | + override-pr: ${{ needs.fetch-info.outputs.pr-number }} |
| 57 | + override-build: ${{ needs.fetch-info.outputs.run-id }} |
| 58 | + override-build-url: ${{ needs.fetch-info.outputs.run-url }} |
0 commit comments