Skip to content

Commit 79d0651

Browse files
committed
duplicate workflow for windows
1 parent f878192 commit 79d0651

File tree

3 files changed

+274
-10
lines changed

3 files changed

+274
-10
lines changed

.github/workflows/build-and-test.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,14 @@ jobs:
202202
run: |
203203
echo "CUDA_VERSION=${{ matrix.cuda-version }}" >> $GITHUB_OUTPUT
204204
205-
test:
205+
test-linux:
206206
strategy:
207207
fail-fast: false
208208
# TODO: add driver version here
209209
matrix:
210210
host-platform:
211211
- linux-64
212-
- linux-aarch64
213-
# TODO: enable testing once win-64 GPU runners are up
214-
# - win-64
212+
# - linux-aarch64
215213
python-version:
216214
- "3.13"
217215
- "3.12"
@@ -238,11 +236,50 @@ jobs:
238236
cuda-version: "12.8.0"
239237
local-ctk: 1
240238
runner: H100
241-
- host-platform: win-64
242-
python-version: "3.12"
243-
cuda-version: "12.8.0"
239+
name: Test (${{ matrix.host-platform }}, Python ${{ matrix.python-version }}, CUDA ${{ matrix.cuda-version }}, Runner ${{ matrix.runner }}, ${{ (matrix.local-ctk == '1' && 'local CTK') || 'CTK wheels' }})
240+
if: ${{ github.repository_owner == 'nvidia' }}
241+
permissions:
242+
contents: read # This is required for actions/checkout
243+
needs:
244+
- build
245+
secrets: inherit
246+
uses:
247+
./.github/workflows/test-wheel-linux.yml
248+
with:
249+
host-platform: ${{ matrix.host-platform }}
250+
python-version: ${{ matrix.python-version }}
251+
build-ctk-ver: ${{ needs.build.outputs.BUILD_CTK_VER }}
252+
cuda-version: ${{ matrix.cuda-version }}
253+
local-ctk: ${{ matrix.local-ctk}}
254+
runner: ${{ matrix.runner }}
255+
256+
test-windows:
257+
strategy:
258+
fail-fast: false
259+
# TODO: add driver version here
260+
matrix:
261+
host-platform:
262+
- win-64
263+
python-version:
264+
# - "3.13"
265+
- "3.12"
266+
# - "3.11"
267+
# - "3.10"
268+
# - "3.9"
269+
cuda-version:
270+
# Note: this is for test-time only.
271+
- "12.8.0"
272+
# - "12.0.1"
273+
- "11.8.0"
274+
local-ctk:
275+
- 1 # use mini CTK
276+
- 0 # use CTK wheels
277+
runner:
278+
- default
279+
exclude:
280+
# To test this combo would require nontrivial installation steps.
281+
- cuda-version: "12.0.1"
244282
local-ctk: 0
245-
runner: default
246283
name: Test (${{ matrix.host-platform }}, Python ${{ matrix.python-version }}, CUDA ${{ matrix.cuda-version }}, Runner ${{ matrix.runner }}, ${{ (matrix.local-ctk == '1' && 'local CTK') || 'CTK wheels' }})
247284
if: ${{ github.repository_owner == 'nvidia' }}
248285
permissions:
@@ -251,7 +288,7 @@ jobs:
251288
- build
252289
secrets: inherit
253290
uses:
254-
./.github/workflows/test-wheel.yml
291+
./.github/workflows/test-wheel-windows.yml
255292
with:
256293
host-platform: ${{ matrix.host-platform }}
257294
python-version: ${{ matrix.python-version }}
@@ -282,7 +319,8 @@ jobs:
282319
checks: read
283320
needs:
284321
- build
285-
- test
322+
- test-linux
323+
- test-windows
286324
- doc
287325
secrets: inherit
288326
uses:
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: "CI: Test wheels"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
host-platform:
7+
type: string
8+
required: true
9+
python-version:
10+
type: string
11+
required: true
12+
build-ctk-ver:
13+
type: string
14+
required: true
15+
cuda-version:
16+
type: string
17+
required: true
18+
local-ctk:
19+
type: string
20+
required: true
21+
runner:
22+
type: string
23+
required: true
24+
25+
jobs:
26+
test:
27+
# The build stage could fail but we want the CI to keep moving.
28+
if: ${{ github.repository_owner == 'nvidia' && !cancelled() }}
29+
runs-on: ${{ (inputs.runner == 'default' && inputs.host-platform == 'linux-64' && 'linux-amd64-gpu-v100-latest-1') ||
30+
(inputs.runner == 'default' && inputs.host-platform == 'linux-aarch64' && 'linux-arm64-gpu-a100-latest-1') ||
31+
(inputs.runner == 'default' && inputs.host-platform == 'win-64' && 'cuda-python-windows-gpu-github') ||
32+
(inputs.runner == 'H100' && 'linux-amd64-gpu-h100-latest-1') }}
33+
defaults:
34+
run:
35+
shell: bash --noprofile --norc -xeuo pipefail {0}
36+
steps:
37+
- name: Ensure GPU is working
38+
run: nvidia-smi
39+
40+
- name: Checkout ${{ github.event.repository.name }}
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Set environment variables
46+
run: |
47+
PYTHON_VERSION_FORMATTED=$(echo '${{ inputs.python-version }}' | tr -d '.')
48+
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
49+
REPO_DIR=$(pwd)
50+
elif [[ "${{ inputs.host-platform }}" == win* ]]; then
51+
PWD=$(pwd)
52+
REPO_DIR=$(cygpath -w $PWD)
53+
fi
54+
55+
BUILD_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.build-ctk-ver }})"
56+
TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})"
57+
if [[ $BUILD_CUDA_MAJOR != $TEST_CUDA_MAJOR ]]; then
58+
SKIP_CUDA_BINDINGS_TEST=1
59+
else
60+
SKIP_CUDA_BINDINGS_TEST=0
61+
fi
62+
63+
# make outputs from the previous job as env vars
64+
CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ inputs.host-platform }}"
65+
echo "PYTHON_VERSION_FORMATTED=${PYTHON_VERSION_FORMATTED}" >> $GITHUB_ENV
66+
echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
67+
echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
68+
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
69+
CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.build-ctk-ver }}-${{ inputs.host-platform }}"
70+
echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
71+
echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
72+
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
73+
echo "SKIP_CUDA_BINDINGS_TEST=${SKIP_CUDA_BINDINGS_TEST}" >> $GITHUB_ENV
74+
75+
- name: Install dependencies
76+
uses: ./.github/actions/install_unix_deps
77+
continue-on-error: false
78+
with:
79+
# gcc for Cython tests, jq/wget for artifact fetching
80+
dependencies: "build-essential jq wget"
81+
dependent_exes: "gcc jq wget"
82+
83+
- name: Download cuda-python build artifacts
84+
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0'}}
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: cuda-python-wheel
88+
path: .
89+
90+
- name: Download cuda.bindings build artifacts
91+
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0'}}
92+
uses: actions/download-artifact@v4
93+
with:
94+
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
95+
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
96+
97+
- name: Download cuda-python & cuda.bindings build artifacts from the prior branch
98+
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '1'}}
99+
env:
100+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
run: |
102+
# See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt.
103+
# gh is needed for artifact fetching.
104+
mkdir -p -m 755 /etc/apt/keyrings \
105+
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
106+
&& cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
107+
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
108+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
109+
&& apt update \
110+
&& apt install gh -y
111+
112+
OLD_BRANCH=$(cat .github/BACKPORT_BRANCH)
113+
OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*"
114+
LATEST_PRIOR_RUN_ID=$(gh run list -b ${OLD_BRANCH} -L 1 -w "CI: Build and test" -s completed -R NVIDIA/cuda-python --json databaseId | jq '.[]| .databaseId')
115+
if [[ "$LATEST_PRIOR_RUN_ID" == "" ]]; then
116+
echo "LATEST_PRIOR_RUN_ID not found!"
117+
exit 1
118+
fi
119+
120+
gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python
121+
ls -al $OLD_BASENAME
122+
mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
123+
mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/
124+
rmdir $OLD_BASENAME
125+
126+
gh run download $LATEST_PRIOR_RUN_ID -p cuda-python-wheel -R NVIDIA/cuda-python
127+
ls -al cuda-python-wheel
128+
mv cuda-python-wheel/*.whl .
129+
rmdir cuda-python-wheel
130+
131+
- name: Display structure of downloaded cuda-python artifacts
132+
run: |
133+
pwd
134+
ls -lahR .
135+
136+
- name: Display structure of downloaded cuda.bindings artifacts
137+
run: |
138+
pwd
139+
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
140+
141+
- name: Download cuda.core build artifacts
142+
uses: actions/download-artifact@v4
143+
with:
144+
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
145+
path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
146+
147+
- name: Display structure of downloaded cuda.core build artifacts
148+
run: |
149+
pwd
150+
ls -lahR $CUDA_CORE_ARTIFACTS_DIR
151+
152+
- name: Set up Python ${{ inputs.python-version }}
153+
uses: actions/setup-python@v5
154+
with:
155+
python-version: ${{ inputs.python-version }}
156+
env:
157+
# we use self-hosted runners on which setup-python behaves weirdly...
158+
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
159+
160+
- name: Set up mini CTK
161+
if: ${{ inputs.local-ctk == '1' }}
162+
uses: ./.github/actions/fetch_ctk
163+
continue-on-error: false
164+
with:
165+
host-platform: ${{ inputs.host-platform }}
166+
cuda-version: ${{ inputs.cuda-version }}
167+
168+
- name: Run cuda.bindings tests
169+
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0' }}
170+
run: |
171+
pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
172+
if [[ "${{ inputs.local-ctk }}" == 1 ]]; then
173+
ls $CUDA_PATH
174+
pip install *.whl
175+
else
176+
pip install $(ls *.whl)[all]
177+
fi
178+
popd
179+
180+
pushd ./cuda_bindings
181+
pip install -r requirements.txt
182+
pytest -rxXs tests/
183+
184+
# It is a bit convoluted to run the Cython tests against CTK wheels,
185+
# so let's just skip them.
186+
if [[ "${{ inputs.local-ctk }}" == 1 ]]; then
187+
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
188+
bash tests/cython/build_tests.sh
189+
elif [[ "${{ inputs.host-platform }}" == win* ]]; then
190+
# TODO: enable this once win-64 runners are up
191+
exit 1
192+
fi
193+
pytest -rxXs tests/cython
194+
popd
195+
fi
196+
197+
- name: Run cuda.core tests
198+
run: |
199+
# If build/test majors match: cuda.bindings is installed in the previous step.
200+
# If mismatch: cuda.bindings is installed from the backport branch.
201+
if [[ "${SKIP_CUDA_BINDINGS_TEST}" == 1 ]]; then
202+
pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
203+
if [[ "${{ inputs.local-ctk }}" == 1 ]]; then
204+
pip install *.whl
205+
else
206+
pip install $(ls *.whl)[all]
207+
fi
208+
popd
209+
fi
210+
TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})"
211+
pushd "${CUDA_CORE_ARTIFACTS_DIR}"
212+
pip install $(ls *.whl)["cu${TEST_CUDA_MAJOR}"]
213+
popd
214+
215+
pushd ./cuda_core
216+
pip install -r "tests/requirements-cu${TEST_CUDA_MAJOR}.txt"
217+
pytest -rxXs tests/
218+
popd
219+
220+
- name: Ensure cuda-python installable
221+
run: |
222+
if [[ "${{ inputs.local-ctk }}" == 1 ]]; then
223+
pip install cuda_python*.whl
224+
else
225+
pip install $(ls cuda_python*.whl)[all]
226+
fi

0 commit comments

Comments
 (0)