Skip to content

Commit 6897aa3

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

File tree

4 files changed

+788
-0
lines changed

4 files changed

+788
-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: 353 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,353 @@
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+
188+
build_targets_part=$(compress "$build_targets")
189+
ctest_targets_part=$(compress "$ctest_targets")
190+
191+
# Parse "--cuda XX.Y" / "-c XX.Y" and "--host <str>" / "-H <str>"
192+
launch_args="${{ inputs.launch_args }}"
193+
cuda_version=$(grep -oP '(?:--cuda|-c)\s+\K\S+' <<< "$launch_args" || true)
194+
host_name=$(grep -oP '(?:--host|-H)\s+\K\S+' <<< "$launch_args" || true)
195+
196+
# Parse `amd64/arm64` and -gpu-<gpu_name> from runner name.
197+
# Ex: 'linux-amd64-gpu-rtxa6000-latest-1'
198+
runner=${{ inputs.runner }}
199+
cpu_arch=$(echo "${runner}" | grep -oP '(?:^|-)\K(?:amd64|arm64)(?=-)' || true)
200+
gpu_name=$(echo "${runner}" | grep -oP '(?:-gpu-)\K\S+' || true)
201+
202+
unique_name="bisect"
203+
declare -a vars=(
204+
"runner"
205+
"cuda_version"
206+
"host_name"
207+
"preset"
208+
"build_targets_part"
209+
"ctest_targets_part"
210+
"gpu_name"
211+
"cpu_arch"
212+
"short_hash"
213+
)
214+
for var in "${vars[@]}"; do
215+
val=${!var}
216+
if [[ -n "$val" ]]; then
217+
unique_name+="-$(sanitize "$val")"
218+
fi
219+
done
220+
221+
echo "Unique job name: $unique_name"
222+
echo "unique-name=$unique_name" >> "$GITHUB_OUTPUT"
223+
224+
bisect:
225+
needs: [generate-job-name]
226+
name: ${{ needs.generate-job-name.outputs.job-name }}
227+
runs-on: ${{ inputs.runner }}
228+
permissions:
229+
id-token: write
230+
contents: read
231+
steps:
232+
- name: Checkout repository
233+
uses: actions/checkout@v4
234+
with:
235+
persist-credentials: false
236+
fetch-depth: 0 # FULL history
237+
fetch-tags: true # Ensure tags are present
238+
239+
- name: Get AWS credentials for sccache bucket
240+
uses: aws-actions/configure-aws-credentials@v4
241+
with:
242+
role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA
243+
aws-region: us-east-2
244+
role-duration-seconds: 43200 # 12 hours
245+
246+
- name: Prepare AWS config for devcontainer
247+
run: |
248+
# The devcontainer will mount this path to the home directory
249+
aws_dir="${{ github.workspace }}/.aws"
250+
mkdir -p "${aws_dir}"
251+
cat > "${aws_dir}/config" <<EOF
252+
[default]
253+
bucket=rapids-sccache-devs
254+
region=us-east-2
255+
EOF
256+
cat > "${aws_dir}/credentials" <<EOF
257+
[default]
258+
aws_access_key_id=${AWS_ACCESS_KEY_ID}
259+
aws_session_token=${AWS_SESSION_TOKEN}
260+
aws_secret_access_key=${AWS_SECRET_ACCESS_KEY}
261+
EOF
262+
chmod 0600 "${aws_dir}/credentials"
263+
chmod 0664 "${aws_dir}/config"
264+
- name: Run git bisect
265+
env:
266+
GITHUB_TOKEN: ${{ github.token }}
267+
LAUNCH_ARGS: ${{ inputs.launch_args }}
268+
GITHUB_REPOSITORY: ${{ github.repository }}
269+
# AWS credentials from the configure-aws-credentials action
270+
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
271+
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
272+
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
273+
AWS_REGION: ${{ env.AWS_REGION }}
274+
run: |
275+
echo -e "\e[1;34mLaunching devcontainer and running git bisect...\e[0m"
276+
277+
GPU_ARGS=""
278+
if [[ "${{ inputs.runner }}" == *"-gpu-"* ]]; then
279+
if [[ ! "${LAUNCH_ARGS}" =~ "--gpus" ]]; then
280+
echo "GPU runner detected; enabling '--gpus all'"
281+
GPU_ARGS="--gpus all"
282+
else
283+
echo "GPU runner detected, but '--gpus' already present in LAUNCH_ARGS"
284+
fi
285+
fi
286+
287+
# Grab the url for this step summary
288+
run="$GITHUB_RUN_ID"
289+
attempt="${GITHUB_RUN_ATTEMPT:-1}"
290+
server="${GITHUB_SERVER_URL:-https://github.com}"
291+
repo="$GITHUB_REPOSITORY"
292+
job_name="${{ needs.generate-job-name.outputs.job-name }}"
293+
job_id=$(
294+
gh api --paginate --slurp \
295+
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs \
296+
--jq ".jobs[] | select(.name==\"${job_name}\") | .id"
297+
) || :
298+
299+
echo "Job name: ${job_name}"
300+
echo "Job names:"
301+
gh api --paginate --slurp \
302+
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs \
303+
--jq ".jobs[] | .name" || :
304+
echo "Jobs:"
305+
gh api --paginate --slurp \
306+
repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs \
307+
--jq ".jobs[] | .name" || :
308+
309+
GHA_LOG_URL="$server/$repo/actions/runs/$run/jobs/$job_id"
310+
STEP_SUMMARY_URL="$server/$repo/actions/runs/$run/attempts/$attempt#summary-$job_id"
311+
312+
echo -e "\e[1;34mGHA Log URL: $GHA_LOG_URL\e[0m"
313+
echo -e "\e[1;34mBisection Results: $STEP_SUMMARY_URL\e[0m"
314+
315+
mkdir -p /tmp/shared
316+
rc=0
317+
set -x
318+
.devcontainer/launch.sh -d ${LAUNCH_ARGS} ${GPU_ARGS} \
319+
--env "AWS_ROLE_ARN=" \
320+
--env "AWS_REGION=${AWS_REGION}" \
321+
--env "SCCACHE_REGION=${AWS_REGION}" \
322+
--env "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" \
323+
--env "AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}" \
324+
--env "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" \
325+
--env "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" \
326+
--env "LAUNCH_ARGS=${LAUNCH_ARGS} ${GPU_ARGS}" \
327+
--env "STEP_SUMMARY_URL=${STEP_SUMMARY_URL}" \
328+
--env "GHA_LOG_URL=${GHA_LOG_URL}" \
329+
--volume "/tmp/shared:/tmp/shared" \
330+
-- ./ci/util/git_bisect.sh \
331+
--summary-file "/tmp/shared/summary.md" \
332+
--good-ref "${{ inputs.good_ref }}" \
333+
--bad-ref "${{ inputs.bad_ref }}" \
334+
--preset "${{ inputs.preset }}" \
335+
--cmake-options "${{ inputs.cmake_options }}" \
336+
--configure-override "${{ inputs.configure_override }}" \
337+
--build-targets "${{ inputs.build_targets }}" \
338+
--ctest-targets "${{ inputs.ctest_targets }}" \
339+
--lit-precompile-tests "${{ inputs.lit_precompile_tests }}" \
340+
--lit-tests "${{ inputs.lit_tests }}" \
341+
--custom-test-cmd "${{ inputs.custom_test_cmd }}" \
342+
|| rc=$?
343+
set +x
344+
345+
# Append the summary (if any) to the GitHub step summary
346+
if [[ -d /tmp/shared ]]; then
347+
find /tmp/shared -type f -exec cat {} \; >> "$GITHUB_STEP_SUMMARY" || :
348+
fi
349+
350+
echo -e "\e[1;34mGHA Log URL: $GHA_LOG_URL\e[0m"
351+
echo -e "\e[1;34mBisection Results: $STEP_SUMMARY_URL\e[0m"
352+
353+
exit $rc

0 commit comments

Comments
 (0)