Skip to content

Commit c78c596

Browse files
authored
ci: add selective sdist build plumbing (#2465)
1 parent bc2e590 commit c78c596

2 files changed

Lines changed: 83 additions & 1 deletion

File tree

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

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,35 @@ on:
1111
cuda-version:
1212
required: true
1313
type: string
14+
build-pathfinder:
15+
required: false
16+
default: true
17+
type: boolean
18+
build-bindings:
19+
required: false
20+
default: true
21+
type: boolean
22+
build-core:
23+
required: false
24+
default: true
25+
type: boolean
26+
build-python:
27+
required: false
28+
default: true
29+
type: boolean
1430

1531
defaults:
1632
run:
1733
shell: bash --noprofile --norc -xeuo pipefail {0}
1834

1935
permissions:
36+
actions: read # This is required for actions/download-artifact
2037
contents: read # This is required for actions/checkout
2138

2239
jobs:
2340
test-sdist:
2441
name: Test sdist builds
42+
if: ${{ inputs.build-pathfinder || inputs.build-bindings || inputs.build-core || inputs.build-python }}
2543
timeout-minutes: 60
2644
runs-on: linux-amd64-cpu8
2745
steps:
@@ -43,16 +61,26 @@ jobs:
4361

4462
# Pure Python packages -- no CTK needed.
4563
- name: Build cuda.pathfinder sdist and wheel-from-sdist
64+
if: ${{ inputs.build-pathfinder }}
4665
run: |
4766
python -m build --sdist cuda_pathfinder/
4867
pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz
4968
5069
- name: Build cuda-python sdist and wheel-from-sdist
70+
if: ${{ inputs.build-python }}
5171
run: |
5272
python -m build --sdist cuda_python/
5373
pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz
5474
75+
- name: Download cuda.pathfinder wheel
76+
if: ${{ !inputs.build-pathfinder && (inputs.build-bindings || inputs.build-core) }}
77+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
78+
with:
79+
name: cuda-pathfinder-wheel
80+
path: cuda_pathfinder/dist
81+
5582
- name: Constrain builds to the local cuda.pathfinder wheel
83+
if: ${{ inputs.build-bindings }}
5684
run: |
5785
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
5886
test "${#pathfinder_wheels[@]}" -eq 1
@@ -65,25 +93,29 @@ jobs:
6593
# The env vars ACTIONS_CACHE_SERVICE_V2, ACTIONS_RESULTS_URL, and ACTIONS_RUNTIME_TOKEN
6694
# are exposed by this action.
6795
- name: Enable sccache
96+
if: ${{ inputs.build-bindings || inputs.build-core }}
6897
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # 0.0.10
6998
with:
7099
disable_annotations: 'true'
71100

72101
# xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867
73102
- name: Adding additional GHA cache-related env vars
103+
if: ${{ inputs.build-bindings || inputs.build-core }}
74104
uses: actions/github-script@v9
75105
with:
76106
script: |
77107
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
78108
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'])
79109
80110
- name: Setup proxy cache
111+
if: ${{ inputs.build-bindings || inputs.build-core }}
81112
uses: nv-gha-runners/setup-proxy-cache@main
82113
continue-on-error: true
83114
with:
84115
enable-apt: true
85116

86117
- name: Set up mini CTK
118+
if: ${{ inputs.build-bindings || inputs.build-core }}
87119
uses: ./.github/actions/fetch_ctk
88120
continue-on-error: false
89121
with:
@@ -93,6 +125,7 @@ jobs:
93125
# cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH
94126
# (set by fetch_ctk) must be available for both sdist and wheel builds.
95127
- name: Build cuda.bindings sdist and wheel-from-sdist
128+
if: ${{ inputs.build-bindings }}
96129
run: |
97130
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
98131
export CC="sccache cc"
@@ -102,7 +135,15 @@ jobs:
102135
python -m build --sdist cuda_bindings/
103136
pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz
104137
138+
- name: Download cuda.bindings wheel
139+
if: ${{ !inputs.build-bindings && inputs.build-core }}
140+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
141+
with:
142+
name: cuda-bindings-python312-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ github.sha }}
143+
path: cuda_bindings/dist
144+
105145
- name: Constrain cuda.core to the local cuda.bindings wheel
146+
if: ${{ inputs.build-core }}
106147
run: |
107148
CUDA_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
108149
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
@@ -123,6 +164,7 @@ jobs:
123164
# wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via
124165
# get_requires_for_build_wheel in build_hooks.py).
125166
- name: Build cuda.core sdist and wheel-from-sdist
167+
if: ${{ inputs.build-core }}
126168
run: |
127169
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
128170
export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
@@ -134,5 +176,5 @@ jobs:
134176
pip wheel --no-deps --wheel-dir cuda_core/dist cuda_core/dist/*.tar.gz
135177
136178
- name: Show sccache stats
137-
if: always()
179+
if: ${{ always() && (inputs.build-bindings || inputs.build-core) }}
138180
run: sccache --show-stats

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,35 @@ on:
1717
cuda-version:
1818
required: true
1919
type: string
20+
build-pathfinder:
21+
required: false
22+
default: true
23+
type: boolean
24+
build-bindings:
25+
required: false
26+
default: true
27+
type: boolean
28+
build-core:
29+
required: false
30+
default: true
31+
type: boolean
32+
build-python:
33+
required: false
34+
default: true
35+
type: boolean
2036

2137
defaults:
2238
run:
2339
shell: bash --noprofile --norc -xeuo pipefail {0}
2440

2541
permissions:
42+
actions: read # This is required for actions/download-artifact
2643
contents: read # This is required for actions/checkout
2744

2845
jobs:
2946
test-sdist:
3047
name: Test sdist builds
48+
if: ${{ inputs.build-pathfinder || inputs.build-bindings || inputs.build-core || inputs.build-python }}
3149
timeout-minutes: 60
3250
runs-on: windows-2022
3351
steps:
@@ -45,23 +63,34 @@ jobs:
4563
python-version: "3.12"
4664

4765
- name: Set up MSVC
66+
if: ${{ inputs.build-bindings || inputs.build-core }}
4867
uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1
4968

5069
- name: Install build tools
5170
run: python -m pip install "pip>=25.3" build
5271

5372
# Pure Python packages -- no CTK needed.
5473
- name: Build cuda.pathfinder sdist and wheel-from-sdist
74+
if: ${{ inputs.build-pathfinder }}
5575
run: |
5676
python -m build --sdist cuda_pathfinder/
5777
pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz
5878
5979
- name: Build cuda-python sdist and wheel-from-sdist
80+
if: ${{ inputs.build-python }}
6081
run: |
6182
python -m build --sdist cuda_python/
6283
pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz
6384
85+
- name: Download cuda.pathfinder wheel
86+
if: ${{ !inputs.build-pathfinder && (inputs.build-bindings || inputs.build-core) }}
87+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
88+
with:
89+
name: cuda-pathfinder-wheel
90+
path: cuda_pathfinder/dist
91+
6492
- name: Constrain builds to the local cuda.pathfinder wheel
93+
if: ${{ inputs.build-bindings }}
6594
run: |
6695
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
6796
test "${#pathfinder_wheels[@]}" -eq 1
@@ -74,6 +103,7 @@ jobs:
74103
# smoke test, not a production build; see build-wheel.yml which also
75104
# limits sccache to Linux).
76105
- name: Set up mini CTK
106+
if: ${{ inputs.build-bindings || inputs.build-core }}
77107
uses: ./.github/actions/fetch_ctk
78108
continue-on-error: false
79109
with:
@@ -85,14 +115,23 @@ jobs:
85115
# Constraint paths are passed as native Windows paths because the pip
86116
# subprocesses run outside Git Bash.
87117
- name: Build cuda.bindings sdist and wheel-from-sdist
118+
if: ${{ inputs.build-bindings }}
88119
run: |
89120
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
90121
export PIP_BUILD_CONSTRAINT="$(cygpath -w "$(pwd)/wheel-constraints/cuda-bindings.txt")"
91122
export PIP_CONSTRAINT="${PIP_BUILD_CONSTRAINT}"
92123
python -m build --sdist cuda_bindings/
93124
pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz
94125
126+
- name: Download cuda.bindings wheel
127+
if: ${{ !inputs.build-bindings && inputs.build-core }}
128+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
129+
with:
130+
name: cuda-bindings-python312-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ github.sha }}
131+
path: cuda_bindings/dist
132+
95133
- name: Constrain cuda.core to the local cuda.bindings wheel
134+
if: ${{ inputs.build-core }}
96135
run: |
97136
CUDA_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
98137
pathfinder_wheels=(cuda_pathfinder/dist/cuda_pathfinder-*.whl)
@@ -113,6 +152,7 @@ jobs:
113152
# wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via
114153
# get_requires_for_build_wheel in build_hooks.py).
115154
- name: Build cuda.core sdist and wheel-from-sdist
155+
if: ${{ inputs.build-core }}
116156
run: |
117157
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
118158
export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"

0 commit comments

Comments
 (0)