Skip to content

Commit d47da7b

Browse files
authored
ci: Allow special branch names to prune CI jobs (#4604)
Quite often I find myself debugging code or CI specific to 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 some logic to ci.yml that lets me do the same just with special branch names, rather than needing to edit ci.yml. Any branch you push containing the substring "windows-only" will not run any Linux or MacOS CI 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 obviously 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 but only need results from one platform. Signed-off-by: Larry Gritz <[email protected]>
1 parent 9979a27 commit d47da7b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ permissions: read-all
3434
jobs:
3535

3636
aswf-old:
37+
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') }}
3738
name: "(old) ${{matrix.desc}}"
3839
strategy:
3940
fail-fast: false
@@ -241,6 +242,7 @@ jobs:
241242
# Linux Tests
242243
#
243244
linux:
245+
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') }}
244246
name: "${{matrix.desc}}"
245247
uses: ./.github/workflows/build-steps.yml
246248
with:
@@ -495,6 +497,7 @@ jobs:
495497
# MacOS Tests
496498
#
497499
macos:
500+
if: ${{ ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'linux-only') }}
498501
name: "${{matrix.desc}}"
499502
uses: ./.github/workflows/build-steps.yml
500503
with:
@@ -557,6 +560,7 @@ jobs:
557560
# Windows Tests
558561
#
559562
windows:
563+
if: ${{ ! contains(github.ref, 'linux-only') && ! contains(github.ref, 'macos-only') }}
560564
name: "${{matrix.desc}}"
561565
uses: ./.github/workflows/build-steps.yml
562566
with:

0 commit comments

Comments
 (0)