Skip to content

Commit ac7934d

Browse files
authored
Fix handling of skippable execution (#875)
1 parent e658e6a commit ac7934d

7 files changed

Lines changed: 52 additions & 28 deletions

.github/workflows/ci_build_library.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,8 @@ jobs:
4848
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

51-
build-wheels:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: >-
54-
${{needs.find-changes.outputs.code == 'true'
55-
|| github.event_name == 'workflow_dispatch'}}
56-
name: ${{matrix.conf.os}}/${{matrix.conf.pyarch}}/py3${{matrix.conf.py}}
51+
build-library:
52+
name: Build for ${{matrix.conf.os}}/${{matrix.conf.pyarch}}/py3${{matrix.conf.py}}
5753
needs: find-changes
5854
runs-on: ${{matrix.conf.os}}
5955
timeout-minutes: 30
@@ -90,6 +86,12 @@ jobs:
9086
# Must use explicit test for true so it works when inputs.debug is null.
9187
use-verbose: ${{github.event.inputs.debug == true}}
9288
steps:
89+
- if: >-
90+
${{needs.find-changes.outputs.code == 'false'
91+
&& github.event_name != 'workflow_dispatch'}}
92+
name: Exit early if there were no changes to code files
93+
run: exit 0
94+
9395
- name: Check out a copy of the git repository
9496
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
9597
with:

.github/workflows/ci_build_wheels.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,20 @@ jobs:
4848
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

51+
build-wheels-skip:
52+
if: >-
53+
${{needs.find-changes.outputs.code == 'false'
54+
&& github.event_name != 'workflow_dispatch'}}
55+
# Important: the name must be the same as that of the build-wheels job.
56+
name: Build & test wheels
57+
needs: find-changes
58+
runs-on: ubuntu-24.04
59+
timeout-minutes: 5
60+
steps:
61+
- name: Exit with success if there were no changes to code files
62+
run: exit 0
63+
5164
build-wheels:
52-
# For efficiency, skip this workflow if there were no code file changes.
5365
if: >-
5466
${{needs.find-changes.outputs.code == 'true'
5567
|| github.event_name == 'workflow_dispatch'}}

.github/workflows/ci_docker_tests.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,20 @@ jobs:
4949
secrets: inherit
5050

5151
build-and-test:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: >-
54-
${{needs.find-changes.outputs.code == 'true'
55-
|| github.event_name == 'workflow_dispatch'}}
56-
name: Build and test Docker images
52+
name: Build & test Docker images
5753
needs: find-changes
5854
runs-on: ubuntu-24.04
5955
timeout-minutes: 30
6056
env:
6157
# The next environment variable is used by Docker.
6258
BUILDKIT_PROGRESS: ${{inputs.debug && 'plain' || ''}}
6359
steps:
60+
- if: >-
61+
${{needs.find-changes.outputs.code == 'false'
62+
&& github.event_name != 'workflow_dispatch'}}
63+
name: Exit early if there were no changes to code files
64+
run: exit 0
65+
6466
- name: Check out a copy of the git repository
6567
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6668
with:

.github/workflows/ci_format_checks.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ jobs:
4949
secrets: inherit
5050

5151
check-format:
52-
# For efficiency, skip this workflow if there were no Python file changes.
53-
if: >-
54-
${{needs.find-changes.outputs.python == 'true'
55-
|| github.event_name == 'workflow_dispatch'}}
5652
name: Python format check
5753
needs: find-changes
5854
runs-on: ubuntu-24.04
@@ -61,6 +57,12 @@ jobs:
6157
# Add xtrace to SHELLOPTS for all Bash scripts when doing debug runs.
6258
SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }}
6359
steps:
60+
- if: >-
61+
${{needs.find-changes.outputs.python == 'false'
62+
&& github.event_name != 'workflow_dispatch'}}
63+
name: Exit early if there were no changes to code files
64+
run: exit 0
65+
6466
- name: Check out a copy of the git repository
6567
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6668
with:

.github/workflows/ci_hardware_options.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ jobs:
4949
secrets: inherit
5050

5151
test-options:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: >-
54-
${{needs.find-changes.outputs.code == 'true'
55-
|| github.event_name == 'workflow_dispatch'}}
5652
name: Test ${{matrix.hardware_opt}} + ${{matrix.parallel_opt}}
5753
needs: find-changes
5854
runs-on: ubuntu-24.04
@@ -67,6 +63,12 @@ jobs:
6763
# Must use explicit test for true so it works when inputs.debug is null.
6864
use-verbose: ${{github.event.inputs.debug == true}}
6965
steps:
66+
- if: >-
67+
${{needs.find-changes.outputs.code == 'false'
68+
&& github.event_name != 'workflow_dispatch'}}
69+
name: Exit early if there were no changes to code files
70+
run: exit 0
71+
7072
- name: Check out a copy of the git repository
7173
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
7274
with:

.github/workflows/ci_sanitizer_tests.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ jobs:
4949
secrets: inherit
5050

5151
sanitizer-tests:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: >-
54-
${{needs.find-changes.outputs.code == 'true'
55-
|| github.event_name == 'workflow_dispatch'}}
5652
name: Test with sanitizers
5753
needs: find-changes
5854
runs-on: ubuntu-24.04
@@ -65,6 +61,12 @@ jobs:
6561
# Must use explicit test for true so it works when inputs.debug is null.
6662
use-verbose: ${{github.event.inputs.debug == true}}
6763
steps:
64+
- if: >-
65+
${{needs.find-changes.outputs.code == 'false'
66+
&& github.event_name != 'workflow_dispatch'}}
67+
name: Exit early if there were no changes to code files
68+
run: exit 0
69+
6870
- name: Check out a copy of the git repository
6971
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
7072
with:

.github/workflows/ci_tcmalloc_test.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ jobs:
4949
secrets: inherit
5050

5151
tcmalloc-test:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: >-
54-
${{needs.find-changes.outputs.code == 'true'
55-
|| github.event_name == 'workflow_dispatch'}}
5652
name: Test with TCMalloc
5753
needs: find-changes
5854
runs-on: ubuntu-24.04
@@ -61,6 +57,12 @@ jobs:
6157
# Must use explicit test for true so it works when inputs.debug is null.
6258
use-verbose: ${{github.event.inputs.debug == true}}
6359
steps:
60+
- if: >-
61+
${{needs.find-changes.outputs.code == 'false'
62+
&& github.event_name != 'workflow_dispatch'}}
63+
name: Exit early if there were no changes to code files
64+
run: exit 0
65+
6466
- name: Check out a copy of the git repository
6567
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6668
with:

0 commit comments

Comments
 (0)