Skip to content

Commit 9286598

Browse files
leofangclaude
andcommitted
Fix artifact name mismatch in nightly CI by passing source SHA
Artifact names embed the commit SHA from the build that created them. When the nightly workflow downloads artifacts from a different CI run, it must use that run's SHA — not github.sha (the nightly run's own SHA) — to construct the correct artifact names. - ci-nightly.yml: resolve head_sha from the source CI run via `gh run view --json headSha`, pass it to test workflows - test-wheel-linux/windows.yml: add `sha` input (defaults to github.sha for backward compatibility), use it in env-vars Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cb5aefa commit 9286598

3 files changed

Lines changed: 43 additions & 18 deletions

File tree

.github/workflows/ci-nightly.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
runs-on: ubuntu-latest
3737
outputs:
3838
RUN_ID: ${{ steps.find.outputs.run_id }}
39+
HEAD_SHA: ${{ steps.find.outputs.head_sha }}
3940
CUDA_BUILD_VER: ${{ steps.get-vars.outputs.cuda_build_ver }}
4041
steps:
4142
- name: Checkout repository
@@ -55,27 +56,34 @@ jobs:
5556
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5657
run: |
5758
if [[ -n "${{ inputs.run-id }}" ]]; then
58-
echo "run_id=${{ inputs.run-id }}" >> $GITHUB_OUTPUT
59-
echo "Using manually specified run ID: ${{ inputs.run-id }}"
60-
exit 0
59+
RUN_ID="${{ inputs.run-id }}"
60+
echo "Using manually specified run ID: $RUN_ID"
61+
else
62+
RUN_ID=$(gh run list \
63+
-b main \
64+
-L 1 \
65+
-w "CI" \
66+
-s success \
67+
-R "${{ github.repository }}" \
68+
--json databaseId \
69+
| jq -r '.[0].databaseId')
70+
71+
if [[ -z "$RUN_ID" || "$RUN_ID" == "null" ]]; then
72+
echo "::error::No successful CI run found on main"
73+
exit 1
74+
fi
75+
echo "Using latest successful CI run: $RUN_ID"
6176
fi
6277
63-
RUN_ID=$(gh run list \
64-
-b main \
65-
-L 1 \
66-
-w "CI" \
67-
-s success \
78+
# Resolve the head SHA from the CI run — artifact names embed this.
79+
HEAD_SHA=$(gh run view "$RUN_ID" \
6880
-R "${{ github.repository }}" \
69-
--json databaseId \
70-
| jq -r '.[0].databaseId')
71-
72-
if [[ -z "$RUN_ID" || "$RUN_ID" == "null" ]]; then
73-
echo "::error::No successful CI run found on main"
74-
exit 1
75-
fi
81+
--json headSha \
82+
| jq -r '.headSha')
7683
7784
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
78-
echo "Using latest successful CI run: $RUN_ID"
85+
echo "head_sha=$HEAD_SHA" >> $GITHUB_OUTPUT
86+
echo "Source commit: $HEAD_SHA"
7987
8088
# ── PyTorch interop tests ──
8189

@@ -93,6 +101,7 @@ jobs:
93101
host-platform: linux-64
94102
build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }}
95103
run-id: ${{ needs.find-wheels.outputs.RUN_ID }}
104+
sha: ${{ needs.find-wheels.outputs.HEAD_SHA }}
96105
test-mode: nightly-pytorch
97106
matrix_filter: 'map(select(.MODE == "nightly-pytorch"))'
98107

@@ -110,6 +119,7 @@ jobs:
110119
host-platform: win-64
111120
build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }}
112121
run-id: ${{ needs.find-wheels.outputs.RUN_ID }}
122+
sha: ${{ needs.find-wheels.outputs.HEAD_SHA }}
113123
test-mode: nightly-pytorch
114124
matrix_filter: 'map(select(.MODE == "nightly-pytorch"))'
115125

@@ -129,6 +139,7 @@ jobs:
129139
host-platform: linux-64
130140
build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }}
131141
run-id: ${{ needs.find-wheels.outputs.RUN_ID }}
142+
sha: ${{ needs.find-wheels.outputs.HEAD_SHA }}
132143
test-mode: nightly-numba-cuda
133144
matrix_filter: 'map(select(.MODE == "nightly-numba-cuda"))'
134145

@@ -146,6 +157,7 @@ jobs:
146157
host-platform: linux-aarch64
147158
build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }}
148159
run-id: ${{ needs.find-wheels.outputs.RUN_ID }}
160+
sha: ${{ needs.find-wheels.outputs.HEAD_SHA }}
149161
test-mode: nightly-numba-cuda
150162
matrix_filter: 'map(select(.MODE == "nightly-numba-cuda"))'
151163

@@ -163,6 +175,7 @@ jobs:
163175
host-platform: win-64
164176
build-ctk-ver: ${{ needs.find-wheels.outputs.CUDA_BUILD_VER }}
165177
run-id: ${{ needs.find-wheels.outputs.RUN_ID }}
178+
sha: ${{ needs.find-wheels.outputs.HEAD_SHA }}
166179
test-mode: nightly-numba-cuda
167180
matrix_filter: 'map(select(.MODE == "nightly-numba-cuda"))'
168181

.github/workflows/test-wheel-linux.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ on:
4141
'nightly-numba-cuda'.
4242
type: string
4343
default: 'standard'
44+
sha:
45+
description: >
46+
Commit SHA used to construct artifact names.
47+
Defaults to github.sha (current run) when empty.
48+
type: string
49+
default: ''
4450

4551
defaults:
4652
run:
@@ -131,7 +137,7 @@ jobs:
131137
HOST_PLATFORM: ${{ inputs.host-platform }}
132138
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
133139
PY_VER: ${{ matrix.PY_VER }}
134-
SHA: ${{ github.sha }}
140+
SHA: ${{ inputs.sha || github.sha }}
135141
SKIP_BINDINGS_TEST_OVERRIDE: ${{ inputs.skip-bindings-test && '1' || '0' }}
136142
run: ./ci/tools/env-vars test
137143

.github/workflows/test-wheel-windows.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ on:
4141
'nightly-numba-cuda'.
4242
type: string
4343
default: 'standard'
44+
sha:
45+
description: >
46+
Commit SHA used to construct artifact names.
47+
Defaults to github.sha (current run) when empty.
48+
type: string
49+
default: ''
4450

4551
jobs:
4652
compute-matrix:
@@ -125,7 +131,7 @@ jobs:
125131
HOST_PLATFORM: ${{ inputs.host-platform }}
126132
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
127133
PY_VER: ${{ matrix.PY_VER }}
128-
SHA: ${{ github.sha }}
134+
SHA: ${{ inputs.sha || github.sha }}
129135
SKIP_BINDINGS_TEST_OVERRIDE: ${{ inputs.skip-bindings-test && '1' || '0' }}
130136
shell: bash --noprofile --norc -xeuo pipefail {0}
131137
run: ./ci/tools/env-vars test

0 commit comments

Comments
 (0)