Skip to content

Commit 04c3eed

Browse files
committed
ci: add selective sdist build plumbing
1 parent 4cd463f commit 04c3eed

2 files changed

Lines changed: 75 additions & 1 deletion

File tree

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

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

1527
defaults:
1628
run:
1729
shell: bash --noprofile --norc -xeuo pipefail {0}
1830

1931
permissions:
32+
actions: read # This is required for actions/download-artifact
2033
contents: read # This is required for actions/checkout
2134

2235
jobs:
2336
test-sdist:
2437
name: Test sdist builds
38+
if: ${{ inputs.build-pathfinder || inputs.build-bindings || inputs.build-core || inputs.build-python }}
2539
timeout-minutes: 60
2640
runs-on: linux-amd64-cpu8
2741
steps:
@@ -43,38 +57,51 @@ jobs:
4357

4458
# Pure Python packages -- no CTK needed.
4559
- name: Build cuda.pathfinder sdist and wheel-from-sdist
60+
if: ${{ inputs.build-pathfinder }}
4661
run: |
4762
python -m build --sdist cuda_pathfinder/
4863
pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz
4964
5065
- name: Build cuda-python sdist and wheel-from-sdist
66+
if: ${{ inputs.build-python }}
5167
run: |
5268
python -m build --sdist cuda_python/
5369
pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz
5470
71+
- name: Download cuda.pathfinder wheel
72+
if: ${{ !inputs.build-pathfinder && (inputs.build-bindings || inputs.build-core) }}
73+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
74+
with:
75+
name: cuda-pathfinder-wheel
76+
path: cuda_pathfinder/dist
77+
5578
# Cython packages need CTK + sccache.
5679
# The env vars ACTIONS_CACHE_SERVICE_V2, ACTIONS_RESULTS_URL, and ACTIONS_RUNTIME_TOKEN
5780
# are exposed by this action.
5881
- name: Enable sccache
82+
if: ${{ inputs.build-bindings || inputs.build-core }}
5983
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # 0.0.10
6084
with:
6185
disable_annotations: 'true'
6286

6387
# xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867
6488
- name: Adding additional GHA cache-related env vars
89+
if: ${{ inputs.build-bindings || inputs.build-core }}
6590
uses: actions/github-script@v9
6691
with:
6792
script: |
6893
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
6994
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'])
7095
7196
- name: Setup proxy cache
97+
if: ${{ inputs.build-bindings || inputs.build-core }}
7298
uses: nv-gha-runners/setup-proxy-cache@main
7399
continue-on-error: true
74100
with:
75101
enable-apt: true
76102

77103
- name: Set up mini CTK
104+
if: ${{ inputs.build-bindings || inputs.build-core }}
78105
uses: ./.github/actions/fetch_ctk
79106
continue-on-error: false
80107
with:
@@ -84,27 +111,38 @@ jobs:
84111
# cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH
85112
# (set by fetch_ctk) must be available for both sdist and wheel builds.
86113
- name: Build cuda.bindings sdist and wheel-from-sdist
114+
if: ${{ inputs.build-bindings }}
87115
run: |
88116
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
89117
export CC="sccache cc"
90118
export CXX="sccache c++"
91119
export PIP_FIND_LINKS="$(pwd)/cuda_pathfinder/dist"
120+
export PIP_PRE=1
92121
python -m build --sdist cuda_bindings/
93122
pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz
94123
124+
- name: Download cuda.bindings wheel
125+
if: ${{ !inputs.build-bindings && inputs.build-core }}
126+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
127+
with:
128+
name: cuda-bindings-python312-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ github.sha }}
129+
path: cuda_bindings/dist
130+
95131
# cuda_core sdist delegates to setuptools (no CTK needed), but
96132
# wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via
97133
# get_requires_for_build_wheel in build_hooks.py).
98134
- name: Build cuda.core sdist and wheel-from-sdist
135+
if: ${{ inputs.build-core }}
99136
run: |
100137
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
101138
export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
102139
export CC="sccache cc"
103140
export CXX="sccache c++"
104141
export PIP_FIND_LINKS="$(pwd)/cuda_bindings/dist $(pwd)/cuda_pathfinder/dist"
142+
export PIP_PRE=1
105143
python -m build --sdist cuda_core/
106144
pip wheel --no-deps --wheel-dir cuda_core/dist cuda_core/dist/*.tar.gz
107145
108146
- name: Show sccache stats
109-
if: always()
147+
if: ${{ always() && (inputs.build-bindings || inputs.build-core) }}
110148
run: sccache --show-stats

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

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

2133
defaults:
2234
run:
2335
shell: bash --noprofile --norc -xeuo pipefail {0}
2436

2537
permissions:
38+
actions: read # This is required for actions/download-artifact
2639
contents: read # This is required for actions/checkout
2740

2841
jobs:
2942
test-sdist:
3043
name: Test sdist builds
44+
if: ${{ inputs.build-pathfinder || inputs.build-bindings || inputs.build-core || inputs.build-python }}
3145
timeout-minutes: 60
3246
runs-on: windows-2022
3347
steps:
@@ -45,26 +59,37 @@ jobs:
4559
python-version: "3.12"
4660

4761
- name: Set up MSVC
62+
if: ${{ inputs.build-bindings || inputs.build-core }}
4863
uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1
4964

5065
- name: Install build tools
5166
run: pip install build
5267

5368
# Pure Python packages -- no CTK needed.
5469
- name: Build cuda.pathfinder sdist and wheel-from-sdist
70+
if: ${{ inputs.build-pathfinder }}
5571
run: |
5672
python -m build --sdist cuda_pathfinder/
5773
pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz
5874
5975
- name: Build cuda-python sdist and wheel-from-sdist
76+
if: ${{ inputs.build-python }}
6077
run: |
6178
python -m build --sdist cuda_python/
6279
pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz
6380
81+
- name: Download cuda.pathfinder wheel
82+
if: ${{ !inputs.build-pathfinder && (inputs.build-bindings || inputs.build-core) }}
83+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
84+
with:
85+
name: cuda-pathfinder-wheel
86+
path: cuda_pathfinder/dist
87+
6488
# Cython packages need CTK. No sccache on Windows (this is a correctness
6589
# smoke test, not a production build; see build-wheel.yml which also
6690
# limits sccache to Linux).
6791
- name: Set up mini CTK
92+
if: ${{ inputs.build-bindings || inputs.build-core }}
6893
uses: ./.github/actions/fetch_ctk
6994
continue-on-error: false
7095
with:
@@ -78,19 +103,30 @@ jobs:
78103
# picky about mixed path styles (see build-wheel.yml for the same
79104
# convention).
80105
- name: Build cuda.bindings sdist and wheel-from-sdist
106+
if: ${{ inputs.build-bindings }}
81107
run: |
82108
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
83109
export PIP_FIND_LINKS="$(cygpath -w "$(pwd)/cuda_pathfinder/dist")"
110+
export PIP_PRE=1
84111
python -m build --sdist cuda_bindings/
85112
pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz
86113
114+
- name: Download cuda.bindings wheel
115+
if: ${{ !inputs.build-bindings && inputs.build-core }}
116+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
117+
with:
118+
name: cuda-bindings-python312-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ github.sha }}
119+
path: cuda_bindings/dist
120+
87121
# cuda_core sdist delegates to setuptools (no CTK needed), but
88122
# wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via
89123
# get_requires_for_build_wheel in build_hooks.py).
90124
- name: Build cuda.core sdist and wheel-from-sdist
125+
if: ${{ inputs.build-core }}
91126
run: |
92127
export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc)
93128
export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)"
94129
export PIP_FIND_LINKS="$(cygpath -w "$(pwd)/cuda_bindings/dist") $(cygpath -w "$(pwd)/cuda_pathfinder/dist")"
130+
export PIP_PRE=1
95131
python -m build --sdist cuda_core/
96132
pip wheel --no-deps --wheel-dir cuda_core/dist cuda_core/dist/*.tar.gz

0 commit comments

Comments
 (0)