Skip to content

Commit ffd4f09

Browse files
authored
Merge pull request #735 from PHPCSStandards/feature/ghactions-dont-cancel-in-progress-take-two
GH Actions/test: allow concurrency for code coverage builds - take two
2 parents 3924468 + f8ed72b commit ffd4f09

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ on:
1414
# Allow manually triggering the workflow.
1515
workflow_dispatch:
1616

17-
# Cancels all previous workflow runs for the same branch that have not yet completed,
18-
# but don't cancel when it's one of the "main" branches as that prevents
19-
# accurate monitoring of code coverage.
20-
concurrency:
21-
# The concurrency group contains the workflow name and the branch name.
22-
group: ${{ github.workflow }}-${{ github.ref }}
23-
cancel-in-progress: ${{ github.ref_name != 'master' && github.ref_name != '4.0' }}
24-
2517
jobs:
2618
build:
19+
# Cancels all previous runs of this particular job for the same branch that have not yet completed.
20+
concurrency:
21+
# The concurrency group contains the workflow name, job name and the branch name.
22+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
2725
runs-on: ubuntu-latest
2826
name: "Build Phar on PHP: 8.0"
2927

@@ -82,6 +80,12 @@ jobs:
8280
run: php phpcbf.phar ./scripts
8381

8482
test:
83+
# Cancels all previous runs of this particular job for the same branch that have not yet completed.
84+
concurrency:
85+
# The concurrency group contains the workflow name, job name, job index and the branch name.
86+
group: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index }}-${{ github.ref }}
87+
cancel-in-progress: true
88+
8589
runs-on: ubuntu-latest
8690
needs: build
8791

@@ -215,6 +219,8 @@ jobs:
215219
run: php phpcs.phar
216220

217221
coverage:
222+
# Explicitly *NOT* setting "concurrency" for this job to allow for monitoring code coverage for all merges.
223+
218224
runs-on: ${{ matrix.os }}
219225

220226
strategy:
@@ -256,8 +262,8 @@ jobs:
256262
shell: bash
257263
run: |
258264
# Set the "short_open_tag" ini to make sure specific conditions are tested.
259-
if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '7.2' ]]; then
260-
echo 'PHP_INI=, date.timezone=Australia/Sydney, short_open_tag=On' >> "$GITHUB_OUTPUT"
265+
if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '7.2' ]]; then
266+
echo 'PHP_INI=, date.timezone=Australia/Sydney, short_open_tag=On' >> "$GITHUB_OUTPUT"
261267
fi
262268
263269
- name: Install PHP

0 commit comments

Comments
 (0)