Skip to content

Commit

Permalink
Merge pull request #735 from PHPCSStandards/feature/ghactions-dont-ca…
Browse files Browse the repository at this point in the history
…ncel-in-progress-take-two

GH Actions/test: allow concurrency for code coverage builds - take two
  • Loading branch information
jrfnl authored Nov 27, 2024
2 parents 3924468 + f8ed72b commit ffd4f09
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ on:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed,
# but don't cancel when it's one of the "main" branches as that prevents
# accurate monitoring of code coverage.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'master' && github.ref_name != '4.0' }}

jobs:
build:
# Cancels all previous runs of this particular job for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name, job name and the branch name.
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true

runs-on: ubuntu-latest
name: "Build Phar on PHP: 8.0"

Expand Down Expand Up @@ -82,6 +80,12 @@ jobs:
run: php phpcbf.phar ./scripts

test:
# Cancels all previous runs of this particular job for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name, job name, job index and the branch name.
group: ${{ github.workflow }}-${{ github.job }}-${{ strategy.job-index }}-${{ github.ref }}
cancel-in-progress: true

runs-on: ubuntu-latest
needs: build

Expand Down Expand Up @@ -215,6 +219,8 @@ jobs:
run: php phpcs.phar

coverage:
# Explicitly *NOT* setting "concurrency" for this job to allow for monitoring code coverage for all merges.

runs-on: ${{ matrix.os }}

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

0 comments on commit ffd4f09

Please sign in to comment.