Skip to content

Commit

Permalink
ci: Allow special branch names to prune jobs
Browse files Browse the repository at this point in the history
Quite often I find myself debugging the CI for just one platform.  It
makes for much longer iteration for a huge CI job that reruns lots of
tests that won't be affected by the changes I'm experimenting with.
Sometime I make a commit that places `if: 0` in strategic places to
exclude irrelevant batches of tests. But this is a pain to add, and
has to be removed again to re-enable the tests prior to turning the
experiment into a proper PR.

This PR, then, adds a test that lets me do the same just with special
branch names, rather than editing ci.yml. Any branch you push
containing the substring "windows-only" will not run any Linux or
MacOS tests. And the analogous behavior is added for "macos-only" and
"linux-only".

This shouldn't affect any CI jobs in which people are not purposely
using those special branch names. You should NOT use these special
names for branches from which you submit PRs, since of course we want
every PR to validate on all CI combinations. But it is very helpful
for topic branches on your own fork as you are developing and
iterating over many CI runs.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Jan 23, 2025
1 parent 9979a27 commit 16e53ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ permissions: read-all
jobs:

aswf-old:
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') }}
name: "(old) ${{matrix.desc}}"
strategy:
fail-fast: false
Expand Down Expand Up @@ -241,6 +242,7 @@ jobs:
# Linux Tests
#
linux:
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') }}
name: "${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
Expand Down Expand Up @@ -495,6 +497,7 @@ jobs:
# MacOS Tests
#
macos:
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'linux-only') }}
name: "${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
Expand Down Expand Up @@ -557,6 +560,7 @@ jobs:
# Windows Tests
#
windows:
if: ${{ ! contains(github.ref, 'linux-only') && ! contains(github.ref, 'macos-only') }}
name: "${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
Expand Down

0 comments on commit 16e53ce

Please sign in to comment.