Skip to content

Commit e658e6a

Browse files
authored
Fix bug in find-changes workflow & rename workflows for greater clarity (#874)
1 parent f69ef7d commit e658e6a

11 files changed

Lines changed: 71 additions & 38 deletions
File renamed without changes.

.github/workflows/reusable_find_changes.yaml renamed to .github/workflows/_find_changes.yaml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
# protection rules work is: "If a workflow is skipped due to path filtering
2222
# [...] the checks associated with that workflow will remain in a Pending
2323
# state. A PR that requires those checks to be successful will be blocked from
24-
# merging." This makes path filters unusable with merge queues. We forgo the
25-
# use of path filters, and instead check file changes using our own workflow.
24+
# merging." This makes path filters unusable with merge queues. So, we forgo the
25+
# use of path filters and instead check file changes using our own workflow.
2626
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2727

2828
# The tilde is only to make our reusable workflows be listed last in the UI.
@@ -31,13 +31,16 @@ run-name: Determine which files have been changed
3131

3232
on:
3333
workflow_call:
34+
# N.B.: GitHub Actions workflow_call output values are ALWAYS strings, even
35+
# for (what you think are) Booleans. Consequently, calling workflows have to
36+
# test values using, e.g., ${{foo = 'false'}}, and not ${{foo}} or similar.
3437
outputs:
3538
code:
36-
description: 'True if any code files were changed'
37-
value: jobs.test.outputs.only-noncode-changes == 'false'
39+
description: 'True if any potential code file was changed'
40+
value: ${{jobs.test.outputs.nondoc-file-changes == 'true'}}
3841
python:
39-
description: 'True if Python files were changed'
40-
value: jobs.test.outputs.have-python-changes == 'true'
42+
description: 'True if any Python file was changed'
43+
value: ${{jobs.test.outputs.python-changes == 'true'}}
4144

4245
permissions: read-all
4346

@@ -47,24 +50,34 @@ jobs:
4750
runs-on: ubuntu-24.04
4851
timeout-minutes: 5
4952
outputs:
50-
only-noncode-changes: steps.only-noncode-files.outputs.matched
51-
python-changes: steps.python-files.outputs.matched
53+
nondoc-file-changes: ${{steps.nondoc-files.outputs.matched}}
54+
python-changes: ${{steps.python-files.outputs.matched}}
5255
steps:
5356
- name: Check out a copy of the git repository
5457
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
5558

56-
- name: Test whether only docs or similar files were changed
59+
- name: Test whether the changes involved one or more non-doc files
5760
uses: tomi/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
58-
id: only-noncode-files
61+
id: nondoc-files
5962
with:
6063
base: ${{github.ref_name}}
61-
predicate-quantifier: 'every'
64+
# Note: when editing the patterns below, always make sure to negate
65+
# the condition (i.e., use a leading '!'). See the next comment.
6266
filters: |
6367
matched:
64-
- '!**/*.md'
65-
- '!docs/**'
6668
- '!.github/ISSUE_TEMPLATE/**'
69+
- '!.github/dependabot.yaml'
70+
- '!.github/problem-matchers/**'
6771
- '!CITATION.cff'
72+
- '!docs/**'
73+
- '!**/*.md'
74+
- '!**/*.png'
75+
# The default paths-filter-action behavior is "match at least one"
76+
# pattern. We change the behavior to be "match every" pattern.
77+
# Combined with negating every pattern above, it means the final output
78+
# will be non-empty only if there is at least one file that is NOT a
79+
# documentation file, or in other words, is a potential code file.
80+
predicate-quantifier: 'every'
6881

6982
- name: Test whether Python files are among the changed files
7083
uses: tomi/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
@@ -74,3 +87,9 @@ jobs:
7487
filters: |
7588
matched:
7689
- '**/*.py'
90+
91+
- name: Summary of test results
92+
run: |
93+
set -x
94+
echo steps.nondoc-files.outputs.matched = │${{steps.nondoc-files.outputs.matched}}│
95+
echo steps.python-files.outputs.matched = │${{steps.python-files.outputs.matched}}│

.github/workflows/ci_build_library.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ concurrency:
4545
jobs:
4646
find-changes:
4747
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
48+
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

5151
build-wheels:
5252
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
53+
if: >-
54+
${{needs.find-changes.outputs.code == 'true'
55+
|| github.event_name == 'workflow_dispatch'}}
5456
name: ${{matrix.conf.os}}/${{matrix.conf.pyarch}}/py3${{matrix.conf.py}}
5557
needs: find-changes
5658
runs-on: ${{matrix.conf.os}}
@@ -121,7 +123,7 @@ jobs:
121123
- if: matrix.conf.os != 'windows-2025'
122124
name: Run the build and test script (non-Windows case)
123125
env:
124-
# SHELLOPTS is used by Bash. Add xtrace when doing manual debug runs.
126+
# Add xtrace to SHELLOPTS for all Bash scripts when doing debug runs.
125127
SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }}
126128
run: dev_tools/test_libs.sh ${{env.use-verbose && '--config=verbose'}}
127129

.github/workflows/ci_build_wheels.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@ concurrency:
4545
jobs:
4646
find-changes:
4747
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
48+
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

5151
build-wheels:
5252
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
53+
if: >-
54+
${{needs.find-changes.outputs.code == 'true'
55+
|| github.event_name == 'workflow_dispatch'}}
5456
name: Build & test wheels
5557
needs: find-changes
56-
uses: ./.github/workflows/reusable_build_wheels.yaml
58+
uses: ./.github/workflows/_build_wheels.yaml
5759
secrets: inherit
5860
with:
5961
debug: ${{inputs.debug == true}}

.github/workflows/ci_docker_tests.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ concurrency:
4545
jobs:
4646
find-changes:
4747
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
48+
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

5151
build-and-test:
5252
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
53+
if: >-
54+
${{needs.find-changes.outputs.code == 'true'
55+
|| github.event_name == 'workflow_dispatch'}}
5456
name: Build and test Docker images
5557
needs: find-changes
5658
runs-on: ubuntu-24.04

.github/workflows/ci_format_checks.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: 'CI: lint & format checks'
15+
name: 'CI: check code format'
1616
run-name: Test with linters and formatters
1717

1818
on:
@@ -45,16 +45,21 @@ concurrency:
4545
jobs:
4646
find-changes:
4747
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
48+
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

5151
check-format:
5252
# For efficiency, skip this workflow if there were no Python file changes.
53-
if: needs.find-changes.outputs.python || github.event_name == 'workflow_dispatch'
53+
if: >-
54+
${{needs.find-changes.outputs.python == 'true'
55+
|| github.event_name == 'workflow_dispatch'}}
5456
name: Python format check
5557
needs: find-changes
5658
runs-on: ubuntu-24.04
5759
timeout-minutes: 30
60+
env:
61+
# Add xtrace to SHELLOPTS for all Bash scripts when doing debug runs.
62+
SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }}
5863
steps:
5964
- name: Check out a copy of the git repository
6065
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -77,7 +82,4 @@ jobs:
7782
pip install -r dev-requirements.txt
7883
7984
- name: Check Python file format
80-
env:
81-
# SHELLOPTS is used by Bash. Add xtrace when doing manual debug runs.
82-
SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }}
8385
run: check/format-incremental

.github/workflows/ci_hardware_options.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: 'CI: hardware options tests'
15+
name: 'CI: test with different hardware options'
1616
run-name: Test with instruction set extensions and parallelism
1717

1818
on:
@@ -45,12 +45,14 @@ concurrency:
4545
jobs:
4646
find-changes:
4747
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
48+
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

5151
test-options:
5252
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
53+
if: >-
54+
${{needs.find-changes.outputs.code == 'true'
55+
|| github.event_name == 'workflow_dispatch'}}
5456
name: Test ${{matrix.hardware_opt}} + ${{matrix.parallel_opt}}
5557
needs: find-changes
5658
runs-on: ubuntu-24.04

.github/workflows/ci_sanitizer_tests.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: 'CI: sanitizer tests'
15+
name: 'CI: run sanitizer tests'
1616
run-name: Test with address and memory sanitizers
1717

1818
on:
@@ -45,12 +45,14 @@ concurrency:
4545
jobs:
4646
find-changes:
4747
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
48+
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

5151
sanitizer-tests:
5252
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
53+
if: >-
54+
${{needs.find-changes.outputs.code == 'true'
55+
|| github.event_name == 'workflow_dispatch'}}
5456
name: Test with sanitizers
5557
needs: find-changes
5658
runs-on: ubuntu-24.04

.github/workflows/ci_tcmalloc_test.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: 'CI: TCMalloc test'
15+
name: 'CI: run TCMalloc test'
1616
run-name: Test with TCMalloc (thread-caching malloc)
1717

1818
on:
@@ -45,12 +45,14 @@ concurrency:
4545
jobs:
4646
find-changes:
4747
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
48+
uses: ./.github/workflows/_find_changes.yaml
4949
secrets: inherit
5050

5151
tcmalloc-test:
5252
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
53+
if: >-
54+
${{needs.find-changes.outputs.code == 'true'
55+
|| github.event_name == 'workflow_dispatch'}}
5456
name: Test with TCMalloc
5557
needs: find-changes
5658
runs-on: ubuntu-24.04

.github/workflows/pr-labeler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# getting applied, check the run summary page for errors.
2020
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2121

22-
name: Pull request labeler
22+
name: Label pull requests
2323
run-name: >-
2424
Label pull request ${{github.event.pull_request.number}} by ${{github.actor}}
2525

0 commit comments

Comments
 (0)