Skip to content

Commit 8480b8f

Browse files
committed
Test new workflow.
[skip-matrix][skip-docs][skip-matx][skip-vdc]
1 parent c230ecf commit 8480b8f

File tree

4 files changed

+792
-0
lines changed

4 files changed

+792
-0
lines changed

.github/workflows/ci-workflow-pull-request.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,27 @@ jobs:
190190
upload_workflow_artifact: "true"
191191
upload_pages_artifact: "false"
192192

193+
bisect-workflow:
194+
name: Bisect Workflow Test
195+
needs: build-workflow
196+
permissions:
197+
id-token: write
198+
contents: read
199+
uses: ./.github/workflows/git-bisect.yml
200+
with:
201+
# preset: cudax-cpp17
202+
# launch_args: "--cuda 12.9 --host gcc9"
203+
# build_targets: cudax.cpp17.test.execution
204+
205+
runner: linux-amd64-gpu-rtxa6000-latest-1
206+
launch_args: "--cuda 12.9 --host gcc13 --env CCCL_TEST_MODE=compute-sanitizer-initcheck --env C2H_SEED_COUNT_OVERRIDE=1"
207+
preset: cub-cpp20
208+
cmake_options: "-DCMAKE_CUDA_FLAGS=-lineinfo -DCMAKE_CUDA_ARCHITECTURES=86"
209+
build_targets: cub.cpp20.test.iterator
210+
ctest_targets: cub.cpp20.test.iterator
211+
good_ref: c8e0441
212+
bad_ref: e4c0af6
213+
193214
build-rapids:
194215
name: Build RAPIDS (optional)
195216
if: ${{ contains(github.event.head_commit.message, '[test-rapids]') }}

.github/workflows/git-bisect.yml

Lines changed: 357 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,357 @@
1+
name: "Workflow/Bisect"
2+
3+
defaults:
4+
run:
5+
shell: bash --noprofile --norc -euo pipefail {0}
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
runner:
11+
description: "Runner label"
12+
required: false
13+
default: linux-amd64-cpu16
14+
type: string
15+
good_ref:
16+
description: "Good ref/sha/tag/branch. Defaults to latest release tag. Accepts '-Nd' (e.g., '-14d') to mean 'origin/main as of N days ago'."
17+
required: false
18+
type: string
19+
bad_ref:
20+
description: "Bad ref/sha/tag/branch. Defaults to main. Accepts '-Nd' (e.g., '-14d') to mean 'origin/main as of N days ago'."
21+
required: false
22+
type: string
23+
launch_args:
24+
description: "Arguments for .devcontainer/launch.sh -d"
25+
required: false
26+
default: ""
27+
type: string
28+
preset:
29+
description: "CMake preset"
30+
required: false
31+
default: ""
32+
type: string
33+
cmake_options:
34+
description: "Additional options passed to CMake preset configure (e.g. -DVAR=ON)"
35+
required: false
36+
default: ""
37+
type: string
38+
configure_override:
39+
description: "Command to run for configuration; overrides preset and cmake_options"
40+
required: false
41+
default: ""
42+
type: string
43+
build_targets:
44+
description: "Space separated ninja build targets"
45+
required: false
46+
default: ""
47+
type: string
48+
ctest_targets:
49+
description: "Space separated CTest targets"
50+
required: false
51+
default: ""
52+
type: string
53+
lit_precompile_tests:
54+
description: "Space-separated libcudacxx lit test paths to precompile without execution"
55+
required: false
56+
default: ""
57+
type: string
58+
lit_tests:
59+
description: "Space-separated libcudacxx lit test paths to execute"
60+
required: false
61+
default: ""
62+
type: string
63+
custom_test_cmd:
64+
description: "Command run after build and tests"
65+
required: false
66+
default: ""
67+
type: string
68+
workflow_call:
69+
inputs:
70+
runner:
71+
description: "Runner label"
72+
required: false
73+
default: linux-amd64-cpu16
74+
type: string
75+
good_ref:
76+
description: "Good ref/sha/tag/branch. Defaults to latest release tag. Accepts '-Nd' (e.g., '-14d') to mean 'origin/main as of N days ago'."
77+
required: false
78+
type: string
79+
bad_ref:
80+
description: "Bad ref/sha/tag/branch. Defaults to HEAD. Accepts '-Nd' (e.g., '-14d') to mean 'origin/main as of N days ago'."
81+
required: false
82+
type: string
83+
launch_args:
84+
description: "Arguments for .devcontainer/launch.sh -d"
85+
required: false
86+
default: ""
87+
type: string
88+
preset:
89+
description: "CMake preset"
90+
required: false
91+
default: ""
92+
type: string
93+
cmake_options:
94+
description: "Additional options passed to CMake preset configure (e.g. -DVAR=ON)"
95+
required: false
96+
default: ""
97+
type: string
98+
configure_override:
99+
description: "Command to run for configuration; overrides preset and cmake_options"
100+
required: false
101+
default: ""
102+
type: string
103+
build_targets:
104+
description: "Space separated ninja build targets"
105+
required: false
106+
default: ""
107+
type: string
108+
ctest_targets:
109+
description: "Space separated CTest targets"
110+
required: false
111+
default: ""
112+
type: string
113+
lit_precompile_tests:
114+
description: "Space-separated libcudacxx lit test paths to precompile without execution"
115+
required: false
116+
default: ""
117+
type: string
118+
lit_tests:
119+
description: "Space-separated libcudacxx lit test paths to execute"
120+
required: false
121+
default: ""
122+
type: string
123+
custom_test_cmd:
124+
description: "Command run after build and tests"
125+
required: false
126+
default: ""
127+
type: string
128+
129+
jobs:
130+
# Hash all of the inputs and generate a descriptive, but unique, name for the bisect job.
131+
# This is necessary because GitHub Actions does not provide an easy way to get the numeric
132+
# job id from within a running job, unless the name is unique across the entire run.
133+
generate-job-name:
134+
name: Generate Unique Job Name
135+
runs-on: ubuntu-latest
136+
outputs:
137+
job-name: ${{ steps.set-name.outputs.unique-name }}
138+
steps:
139+
- name: Set unique name
140+
id: set-name
141+
run: |
142+
# Hash the inputs to create a unique identifier
143+
input_string=$(cat <<HASH
144+
${{ inputs.runner }}
145+
${{ inputs.launch_args }}
146+
${{ inputs.preset }}
147+
${{ inputs.cmake_options }}
148+
${{ inputs.configure_override }}
149+
${{ inputs.build_targets }}
150+
${{ inputs.ctest_targets }}
151+
${{ inputs.lit_precompile_tests }}
152+
${{ inputs.lit_tests }}
153+
${{ inputs.custom_test_cmd }}
154+
${{ inputs.good_ref }}
155+
${{ inputs.bad_ref }}
156+
HASH
157+
)
158+
hash=$(echo -n "$input_string" | sha256sum | awk '{print $1}')
159+
short_hash=${hash:0:8}
160+
161+
function sanitize() {
162+
echo "$1" | tr -cd '[:alnum:]-'
163+
}
164+
165+
function compress() {
166+
input=$1
167+
input_length=${#input}
168+
169+
# "begin.and.end" -> "begin_d.end"
170+
delim="_"
171+
keep_chars=5
172+
compressed_str=${input:0:keep_chars}$delim${input: -keep_chars}
173+
compressed_length=${#compressed_str}
174+
175+
if [[ $input_length -gt $compressed_length ]]; then
176+
echo "$compressed_str"
177+
else
178+
echo "$input"
179+
fi
180+
}
181+
182+
preset=$(sanitize "${{ inputs.preset }}")
183+
good_ref=$(sanitize "${{ inputs.good_ref }}")
184+
bad_ref=$(sanitize "${{ inputs.bad_ref }}")
185+
build_targets=$(sanitize "${{ inputs.build_targets }}")
186+
ctest_targets=$(sanitize "${{ inputs.ctest_targets }}")
187+
lit_precompile_tests=$(sanitize "${{ inputs.lit_precompile_tests }}")
188+
lit_tests=$(sanitize "${{ inputs.lit_tests }}")
189+
190+
build_targets_part=$(compress "$build_targets")
191+
ctest_targets_part=$(compress "$ctest_targets")
192+
193+
# Parse "--cuda XX.Y" / "-c XX.Y" and "--host <str>" / "-H <str>"
194+
launch_args="${{ inputs.launch_args }}"
195+
cuda_version="ctk$(grep -oP '(?:--cuda|-c)\s+\K\S+' <<< "$launch_args" || true)"
196+
host_name=$(grep -oP '(?:--host|-H)\s+\K\S+' <<< "$launch_args" || true)
197+
198+
# Parse `amd64/arm64` and -gpu-<gpu_name> from runner name.
199+
# Ex: 'linux-amd64-gpu-rtxa6000-latest-1'
200+
runner=${{ inputs.runner }}
201+
cpu_arch=$(echo "${runner}" | grep -oP '(?:^|-)\K(?:amd64|arm64)(?=-)' || true)
202+
gpu_name=$(echo "${runner}" | grep -oP '(?:-gpu-)\K[^-]+' || true)
203+
204+
# Vars to include in unique name:
205+
declare -a vars=(
206+
"cuda_version"
207+
"host_name"
208+
"preset"
209+
"build_targets_part"
210+
"ctest_targets_part"
211+
"lit_precompile_tests"
212+
"lit_tests"
213+
"gpu_name"
214+
"cpu_arch"
215+
"short_hash"
216+
)
217+
unique_name="bisect"
218+
for var in "${vars[@]}"; do
219+
val=${!var}
220+
if [[ -n "$val" ]]; then
221+
unique_name+="-$val""
222+
fi
223+
done
224+
225+
echo "Unique job name: $unique_name"
226+
echo "unique-name=$unique_name" >> "$GITHUB_OUTPUT"
227+
228+
bisect:
229+
needs: [generate-job-name]
230+
name: ${{ needs.generate-job-name.outputs.job-name }}
231+
runs-on: ${{ inputs.runner }}
232+
permissions:
233+
id-token: write
234+
contents: read
235+
steps:
236+
- name: Checkout repository
237+
uses: actions/checkout@v4
238+
with:
239+
persist-credentials: false
240+
fetch-depth: 0 # FULL history
241+
fetch-tags: true # Ensure tags are present
242+
243+
- name: Get AWS credentials for sccache bucket
244+
uses: aws-actions/configure-aws-credentials@v4
245+
with:
246+
role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA
247+
aws-region: us-east-2
248+
role-duration-seconds: 43200 # 12 hours
249+
250+
- name: Prepare AWS config for devcontainer
251+
run: |
252+
# The devcontainer will mount this path to the home directory
253+
aws_dir="${{ github.workspace }}/.aws"
254+
mkdir -p "${aws_dir}"
255+
cat > "${aws_dir}/config" <<EOF
256+
[default]
257+
bucket=rapids-sccache-devs
258+
region=us-east-2
259+
EOF
260+
cat > "${aws_dir}/credentials" <<EOF
261+
[default]
262+
aws_access_key_id=${AWS_ACCESS_KEY_ID}
263+
aws_session_token=${AWS_SESSION_TOKEN}
264+
aws_secret_access_key=${AWS_SECRET_ACCESS_KEY}
265+
EOF
266+
chmod 0600 "${aws_dir}/credentials"
267+
chmod 0664 "${aws_dir}/config"
268+
- name: Run git bisect
269+
env:
270+
GITHUB_TOKEN: ${{ github.token }}
271+
LAUNCH_ARGS: ${{ inputs.launch_args }}
272+
GITHUB_REPOSITORY: ${{ github.repository }}
273+
# AWS credentials from the configure-aws-credentials action
274+
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
275+
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
276+
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
277+
AWS_REGION: ${{ env.AWS_REGION }}
278+
run: |
279+
echo -e "\e[1;34mLaunching devcontainer and running git bisect...\e[0m"
280+
281+
GPU_ARGS=""
282+
if [[ "${{ inputs.runner }}" == *"-gpu-"* ]]; then
283+
if [[ ! "${LAUNCH_ARGS}" =~ "--gpus" ]]; then
284+
echo "GPU runner detected; enabling '--gpus all'"
285+
GPU_ARGS="--gpus all"
286+
else
287+
echo "GPU runner detected, but '--gpus' already present in LAUNCH_ARGS"
288+
fi
289+
fi
290+
291+
# Grab the url for this step summary
292+
run="$GITHUB_RUN_ID"
293+
attempt="${GITHUB_RUN_ATTEMPT:-1}"
294+
server="${GITHUB_SERVER_URL:-https://github.com}"
295+
repo="$GITHUB_REPOSITORY"
296+
job_name="${{ needs.generate-job-name.outputs.job-name }}"
297+
job_id=$(
298+
gh api --paginate \
299+
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs \
300+
--jq ".jobs[] | select(.name==\"${job_name}\") | .id"
301+
) || :
302+
303+
echo "Job name: ${job_name}"
304+
echo "Job names:"
305+
gh api --paginate \
306+
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs \
307+
--jq ".jobs[] | .name" || :
308+
echo "Jobs:"
309+
gh api --paginate \
310+
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs \
311+
--jq ".jobs[] | .name" || :
312+
313+
GHA_LOG_URL="$server/$repo/actions/runs/$run/jobs/$job_id"
314+
STEP_SUMMARY_URL="$server/$repo/actions/runs/$run/attempts/$attempt#summary-$job_id"
315+
316+
echo -e "\e[1;34mGHA Log URL: $GHA_LOG_URL\e[0m"
317+
echo -e "\e[1;34mBisection Results: $STEP_SUMMARY_URL\e[0m"
318+
319+
mkdir -p /tmp/shared
320+
rc=0
321+
set -x
322+
.devcontainer/launch.sh -d ${LAUNCH_ARGS} ${GPU_ARGS} \
323+
--env "AWS_ROLE_ARN=" \
324+
--env "AWS_REGION=${AWS_REGION}" \
325+
--env "SCCACHE_REGION=${AWS_REGION}" \
326+
--env "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" \
327+
--env "AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}" \
328+
--env "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" \
329+
--env "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" \
330+
--env "LAUNCH_ARGS=${LAUNCH_ARGS} ${GPU_ARGS}" \
331+
--env "STEP_SUMMARY_URL=${STEP_SUMMARY_URL}" \
332+
--env "GHA_LOG_URL=${GHA_LOG_URL}" \
333+
--volume "/tmp/shared:/tmp/shared" \
334+
-- ./ci/util/git_bisect.sh \
335+
--summary-file "/tmp/shared/summary.md" \
336+
--good-ref "${{ inputs.good_ref }}" \
337+
--bad-ref "${{ inputs.bad_ref }}" \
338+
--preset "${{ inputs.preset }}" \
339+
--cmake-options "${{ inputs.cmake_options }}" \
340+
--configure-override "${{ inputs.configure_override }}" \
341+
--build-targets "${{ inputs.build_targets }}" \
342+
--ctest-targets "${{ inputs.ctest_targets }}" \
343+
--lit-precompile-tests "${{ inputs.lit_precompile_tests }}" \
344+
--lit-tests "${{ inputs.lit_tests }}" \
345+
--custom-test-cmd "${{ inputs.custom_test_cmd }}" \
346+
|| rc=$?
347+
set +x
348+
349+
# Append the summary (if any) to the GitHub step summary
350+
if [[ -d /tmp/shared ]]; then
351+
find /tmp/shared -type f -exec cat {} \; >> "$GITHUB_STEP_SUMMARY" || :
352+
fi
353+
354+
echo -e "\e[1;34mGHA Log URL: $GHA_LOG_URL\e[0m"
355+
echo -e "\e[1;34mBisection Results: $STEP_SUMMARY_URL\e[0m"
356+
357+
exit $rc

0 commit comments

Comments
 (0)