-
Notifications
You must be signed in to change notification settings - Fork 331
156 lines (139 loc) · 6.96 KB
/
Copy pathtest-sdist-windows.yml
File metadata and controls
156 lines (139 loc) · 6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
# Windows counterpart of test-sdist-linux.yml. Exists so that platform-gated
# sources (e.g. cuda_bindings/*_windows.pyx selected by build_hooks.py) are
# exercised by the sdist completeness test. Keep the shape of this file in
# sync with test-sdist-linux.yml aside from Windows-specific setup (MSVC,
# no sccache, no proxy cache).
on:
workflow_call:
inputs:
host-platform:
required: true
type: string
cuda-version:
required: true
type: string
workplan:
description: JSON workplan. An empty value builds everything.
required: false
default: ""
type: string
defaults:
run:
shell: bash --noprofile --norc -xeuo pipefail {0}
permissions:
actions: read # This is required for actions/download-artifact
contents: read # This is required for actions/checkout
jobs:
test-sdist:
name: Test sdist builds
if: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).jobs.sdist_tests }}
env:
BUILD_PATHFINDER: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.pathfinder.needs_build }}
BUILD_BINDINGS: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.bindings.needs_build }}
BUILD_CORE: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.core.needs_build }}
BUILD_PYTHON: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.python.needs_build }}
timeout-minutes: 60
runs-on: windows-2022
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Treeless clone: setuptools-scm (invoked via `python -m build`) needs
# the commit graph (`git describe`) but not historical blobs.
fetch-depth: 0
filter: blob:none
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Set up MSVC
if: ${{ env.BUILD_BINDINGS == 'true' || env.BUILD_CORE == 'true' }}
uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1
- name: Install build tools
run: python -m pip install "pip>=25.3" build
# Pure Python packages -- no CTK needed.
- name: Build cuda.pathfinder sdist and wheel-from-sdist
if: ${{ env.BUILD_PATHFINDER == 'true' }}
run: |
python -m build --sdist cuda_pathfinder/
pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz
- name: Build cuda-python sdist and wheel-from-sdist
if: ${{ env.BUILD_PYTHON == 'true' }}
run: |
python -m build --sdist cuda_python/
pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz
- name: Download cuda.pathfinder wheel
if: ${{ env.BUILD_PATHFINDER != 'true' && (env.BUILD_BINDINGS == 'true' || env.BUILD_CORE == 'true') }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: cuda-pathfinder-wheel
path: cuda_pathfinder/dist
- name: Constrain builds to the local cuda.pathfinder wheel
if: ${{ env.BUILD_BINDINGS == 'true' }}
run: |
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
test "${#pathfinder_wheels[@]}" -eq 1
test -f "${pathfinder_wheels[0]}"
mkdir -p wheel-constraints
pathfinder_uri="file:///$(cygpath -am "${pathfinder_wheels[0]}")"
printf 'cuda-pathfinder @ %s\n' "${pathfinder_uri}" | tee wheel-constraints/cuda-bindings.txt
# Cython packages need CTK. No sccache on Windows (this is a correctness
# smoke test, not a production build; see build-wheel.yml which also
# limits sccache to Linux).
- name: Set up mini CTK
if: ${{ env.BUILD_BINDINGS == 'true' || env.BUILD_CORE == 'true' }}
uses: ./.github/actions/fetch_ctk
continue-on-error: false
with:
host-platform: ${{ inputs.host-platform }}
cuda-version: ${{ inputs.cuda-version }}
# cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH
# (set by fetch_ctk) must be available for both sdist and wheel builds.
# Constraint paths are passed as native Windows paths because the pip
# subprocesses run outside Git Bash.
- name: Build cuda.bindings sdist and wheel-from-sdist
if: ${{ env.BUILD_BINDINGS == 'true' }}
run: |
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
export PIP_BUILD_CONSTRAINT="$(cygpath -w "$(pwd)/wheel-constraints/cuda-bindings.txt")"
export PIP_CONSTRAINT="${PIP_BUILD_CONSTRAINT}"
python -m build --sdist cuda_bindings/
pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz
- name: Download cuda.bindings wheel
if: ${{ env.BUILD_BINDINGS != 'true' && env.BUILD_CORE == 'true' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: cuda-bindings-python312-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ github.sha }}
path: cuda_bindings/dist
- name: Constrain cuda.core to the local cuda.bindings wheel
if: ${{ env.BUILD_CORE == 'true' }}
run: |
CUDA_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
bindings_wheels=(cuda_bindings/dist/cuda_bindings-"${CUDA_MAJOR}".*.whl)
test "${#pathfinder_wheels[@]}" -eq 1
test "${#bindings_wheels[@]}" -eq 1
test -f "${pathfinder_wheels[0]}"
test -f "${bindings_wheels[0]}"
mkdir -p wheel-constraints
pathfinder_uri="file:///$(cygpath -am "${pathfinder_wheels[0]}")"
bindings_uri="file:///$(cygpath -am "${bindings_wheels[0]}")"
{
printf 'cuda-pathfinder @ %s\n' "${pathfinder_uri}"
printf 'cuda-bindings @ %s\n' "${bindings_uri}"
} | tee wheel-constraints/cuda-core.txt
# cuda_core sdist delegates to setuptools (no CTK needed), but
# wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via
# get_requires_for_build_wheel in build_hooks.py).
- name: Build cuda.core sdist and wheel-from-sdist
if: ${{ env.BUILD_CORE == 'true' }}
run: |
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
export PIP_BUILD_CONSTRAINT="$(cygpath -w "$(pwd)/wheel-constraints/cuda-core.txt")"
export PIP_CONSTRAINT="${PIP_BUILD_CONSTRAINT}"
python -m build --sdist cuda_core/
pip wheel --no-deps --wheel-dir cuda_core/dist cuda_core/dist/*.tar.gz