Skip to content

Commit 817534a

Browse files
authored
Merge branch 'master' into mh-add-license-checker
2 parents b41d97f + 2a79e2b commit 817534a

16 files changed

Lines changed: 207 additions & 80 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: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,21 @@ on:
3838
permissions: read-all
3939

4040
concurrency:
41-
# Cancel any previously-started but still active runs on the same branch.
4241
cancel-in-progress: true
4342
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
4443

4544
jobs:
4645
find-changes:
4746
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
47+
uses: ./.github/workflows/_find_changes.yaml
4948
secrets: inherit
5049

51-
build-wheels:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
54-
name: ${{matrix.conf.os}}/${{matrix.conf.pyarch}}/py3${{matrix.conf.py}}
50+
run-tests:
51+
if: ${{needs.find-changes.outputs.code == 'true' || inputs.debug}}
52+
name: Run tests
5553
needs: find-changes
5654
runs-on: ${{matrix.conf.os}}
55+
continue-on-error: true
5756
timeout-minutes: 30
5857
strategy:
5958
fail-fast: false
@@ -85,9 +84,14 @@ jobs:
8584
{os: windows-2025, pyarch: x64, py: 13},
8685
]
8786
env:
88-
# Must use explicit test for true so it works when inputs.debug is null.
89-
use-verbose: ${{github.event.inputs.debug == true}}
87+
use-verbose: ${{inputs.debug}}
9088
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+
9195
- name: Check out a copy of the git repository
9296
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
9397
with:
@@ -121,7 +125,7 @@ jobs:
121125
- if: matrix.conf.os != 'windows-2025'
122126
name: Run the build and test script (non-Windows case)
123127
env:
124-
# SHELLOPTS is used by Bash. Add xtrace when doing manual debug runs.
128+
# Add xtrace to SHELLOPTS for all Bash scripts when doing debug runs.
125129
SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }}
126130
run: dev_tools/test_libs.sh ${{env.use-verbose && '--config=verbose'}}
127131

@@ -136,3 +140,15 @@ jobs:
136140
SHELLOPTS: ${{env.use-verbose && 'xtrace' || '' }}
137141
shell: cmd
138142
run: bash -x dev_tools/test_libs.sh ${{env.use-verbose && '--config=verbose'}} --action_env PYTHON_BIN_PATH=${{env.pyroot}}\\${{env.pyexe}}
143+
144+
report-results:
145+
if: always()
146+
name: ${{github.workflow}}
147+
needs: run-tests
148+
runs-on: ubuntu-24.04
149+
timeout-minutes: 2
150+
steps:
151+
- name: Exit with an appropriate status code
152+
run: |
153+
result="${{needs.run-tests.result}}"
154+
[[ "$result" == "success" || "$result" == "skipped" ]]

.github/workflows/ci_build_wheels.yaml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,32 @@ on:
3838
permissions: read-all
3939

4040
concurrency:
41-
# Cancel any previously-started but still active runs on the same branch.
4241
cancel-in-progress: true
4342
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
4443

4544
jobs:
4645
find-changes:
4746
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
47+
uses: ./.github/workflows/_find_changes.yaml
4948
secrets: inherit
5049

51-
build-wheels:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
54-
name: Build & test wheels
50+
run-tests:
51+
if: ${{needs.find-changes.outputs.code == 'true' || inputs.debug}}
52+
name: Run tests
5553
needs: find-changes
56-
uses: ./.github/workflows/reusable_build_wheels.yaml
54+
uses: ./.github/workflows/_build_wheels.yaml
5755
secrets: inherit
5856
with:
5957
debug: ${{inputs.debug == true}}
58+
59+
report-results:
60+
if: always()
61+
name: ${{github.workflow}}
62+
needs: run-tests
63+
runs-on: ubuntu-24.04
64+
timeout-minutes: 2
65+
steps:
66+
- name: Exit with an appropriate status code
67+
run: |
68+
result="${{needs.run-tests.result}}"
69+
[[ "$result" == "success" || "$result" == "skipped" ]]

.github/workflows/ci_docker_tests.yaml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,32 @@ on:
3838
permissions: read-all
3939

4040
concurrency:
41-
# Cancel any previously-started but still active runs on the same branch.
4241
cancel-in-progress: true
4342
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
4443

4544
jobs:
4645
find-changes:
4746
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
47+
uses: ./.github/workflows/_find_changes.yaml
4948
secrets: inherit
5049

51-
build-and-test:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
54-
name: Build and test Docker images
50+
run-tests:
51+
if: ${{needs.find-changes.outputs.code == 'true' || inputs.debug}}
52+
name: Run tests
5553
needs: find-changes
5654
runs-on: ubuntu-24.04
55+
continue-on-error: true
5756
timeout-minutes: 30
5857
env:
5958
# The next environment variable is used by Docker.
6059
BUILDKIT_PROGRESS: ${{inputs.debug && 'plain' || ''}}
6160
steps:
61+
- if: >-
62+
${{needs.find-changes.outputs.code == 'false'
63+
&& github.event_name != 'workflow_dispatch'}}
64+
name: Exit early if there were no changes to code files
65+
run: exit 0
66+
6267
- name: Check out a copy of the git repository
6368
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6469
with:
@@ -87,3 +92,15 @@ jobs:
8792
run: |
8893
cd install/tests
8994
docker compose build
95+
96+
report-results:
97+
if: always()
98+
name: ${{github.workflow}}
99+
needs: run-tests
100+
runs-on: ubuntu-24.04
101+
timeout-minutes: 2
102+
steps:
103+
- name: Exit with an appropriate status code
104+
run: |
105+
result="${{needs.run-tests.result}}"
106+
[[ "$result" == "success" || "$result" == "skipped" ]]

.github/workflows/ci_format_checks.yml

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

15-
name: 'CI: lint & format checks'
16-
run-name: Test with linters and formatters
15+
name: 'CI: run code format tests'
16+
run-name: Check source code with linters and formatters
1717

1818
on:
1919
push:
@@ -38,24 +38,32 @@ on:
3838
permissions: read-all
3939

4040
concurrency:
41-
# Cancel any previously-started but still active runs on the same branch.
4241
cancel-in-progress: true
4342
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
4443

4544
jobs:
4645
find-changes:
4746
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
47+
uses: ./.github/workflows/_find_changes.yaml
4948
secrets: inherit
5049

51-
check-format:
52-
# For efficiency, skip this workflow if there were no Python file changes.
53-
if: needs.find-changes.outputs.python || github.event_name == 'workflow_dispatch'
54-
name: Python format check
50+
run-tests:
51+
if: ${{needs.find-changes.outputs.python == 'true' || inputs.debug}}
52+
name: Run tests
5553
needs: find-changes
5654
runs-on: ubuntu-24.04
55+
continue-on-error: true
5756
timeout-minutes: 30
57+
env:
58+
# Add xtrace to SHELLOPTS for all Bash scripts when doing debug runs.
59+
SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }}
5860
steps:
61+
- if: >-
62+
${{needs.find-changes.outputs.python == 'false'
63+
&& github.event_name != 'workflow_dispatch'}}
64+
name: Exit early if there were no changes to code files
65+
run: exit 0
66+
5967
- name: Check out a copy of the git repository
6068
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6169
with:
@@ -77,7 +85,16 @@ jobs:
7785
pip install -r dev-requirements.txt
7886
7987
- 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' || '' }}
8388
run: check/format-incremental
89+
90+
report-results:
91+
if: always()
92+
name: ${{github.workflow}}
93+
needs: run-tests
94+
runs-on: ubuntu-24.04
95+
timeout-minutes: 2
96+
steps:
97+
- name: Exit with an appropriate status code
98+
run: |
99+
result="${{needs.run-tests.result}}"
100+
[[ "$result" == "success" || "$result" == "skipped" ]]

.github/workflows/ci_hardware_options.yaml

Lines changed: 25 additions & 9 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 hardware options'
1616
run-name: Test with instruction set extensions and parallelism
1717

1818
on:
@@ -38,22 +38,21 @@ on:
3838
permissions: read-all
3939

4040
concurrency:
41-
# Cancel any previously-started but still active runs on the same branch.
4241
cancel-in-progress: true
4342
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
4443

4544
jobs:
4645
find-changes:
4746
name: Find changed files
48-
uses: ./.github/workflows/reusable_find_changes.yaml
47+
uses: ./.github/workflows/_find_changes.yaml
4948
secrets: inherit
5049

51-
test-options:
52-
# For efficiency, skip this workflow if there were no code file changes.
53-
if: needs.find-changes.outputs.code || github.event_name == 'workflow_dispatch'
54-
name: Test ${{matrix.hardware_opt}} + ${{matrix.parallel_opt}}
50+
run-tests:
51+
if: ${{needs.find-changes.outputs.code == 'true' || inputs.debug}}
52+
name: Run tests
5553
needs: find-changes
5654
runs-on: ubuntu-24.04
55+
continue-on-error: true
5756
timeout-minutes: 30
5857
strategy:
5958
matrix:
@@ -62,9 +61,14 @@ jobs:
6261
# Optimizers for parallelism.
6362
parallel_opt: [openmp, nopenmp]
6463
env:
65-
# Must use explicit test for true so it works when inputs.debug is null.
66-
use-verbose: ${{github.event.inputs.debug == true}}
64+
use-verbose: ${{inputs.debug}}
6765
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+
6872
- name: Check out a copy of the git repository
6973
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
7074
with:
@@ -108,3 +112,15 @@ jobs:
108112
--config=${{matrix.parallel_opt}} \
109113
${{env.use-verbose && '--config=verbose'}} \
110114
apps:qsim_base -- -c circuits/circuit_q24
115+
116+
report-results:
117+
if: always()
118+
name: ${{github.workflow}}
119+
needs: run-tests
120+
runs-on: ubuntu-24.04
121+
timeout-minutes: 2
122+
steps:
123+
- name: Exit with an appropriate status code
124+
run: |
125+
result="${{needs.run-tests.result}}"
126+
[[ "$result" == "success" || "$result" == "skipped" ]]

0 commit comments

Comments
 (0)