|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + host-platform: |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + cuda-version: |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: bash --noprofile --norc -xeuo pipefail {0} |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read # This is required for actions/checkout |
| 21 | + |
| 22 | +jobs: |
| 23 | + test-sdist: |
| 24 | + name: Test sdist builds |
| 25 | + runs-on: linux-amd64-cpu8 |
| 26 | + steps: |
| 27 | + - name: Checkout ${{ github.event.repository.name }} |
| 28 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 29 | + with: |
| 30 | + fetch-depth: 0 |
| 31 | + |
| 32 | + - name: Set up Python |
| 33 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 34 | + with: |
| 35 | + python-version: "3.12" |
| 36 | + |
| 37 | + - name: Install build tools |
| 38 | + run: pip install build |
| 39 | + |
| 40 | + # Pure Python packages -- no CTK needed. |
| 41 | + - name: Build cuda.pathfinder sdist and wheel-from-sdist |
| 42 | + run: | |
| 43 | + python -m build --sdist cuda_pathfinder/ |
| 44 | + pip wheel --no-deps --wheel-dir cuda_pathfinder/dist cuda_pathfinder/dist/*.tar.gz |
| 45 | +
|
| 46 | + - name: Build cuda-python sdist and wheel-from-sdist |
| 47 | + run: | |
| 48 | + python -m build --sdist cuda_python/ |
| 49 | + pip wheel --no-deps --wheel-dir cuda_python/dist cuda_python/dist/*.tar.gz |
| 50 | +
|
| 51 | + # Cython packages need CTK + sccache. |
| 52 | + # The env vars ACTIONS_CACHE_SERVICE_V2, ACTIONS_RESULTS_URL, and ACTIONS_RUNTIME_TOKEN |
| 53 | + # are exposed by this action. |
| 54 | + - name: Enable sccache |
| 55 | + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 0.0.9 |
| 56 | + with: |
| 57 | + disable_annotations: 'true' |
| 58 | + |
| 59 | + # xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867 |
| 60 | + - name: Adding additional GHA cache-related env vars |
| 61 | + uses: actions/github-script@v8 |
| 62 | + with: |
| 63 | + script: | |
| 64 | + core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL']) |
| 65 | + core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL']) |
| 66 | +
|
| 67 | + - name: Setup proxy cache |
| 68 | + uses: nv-gha-runners/setup-proxy-cache@main |
| 69 | + continue-on-error: true |
| 70 | + with: |
| 71 | + enable-apt: true |
| 72 | + |
| 73 | + - name: Set up mini CTK |
| 74 | + uses: ./.github/actions/fetch_ctk |
| 75 | + continue-on-error: false |
| 76 | + with: |
| 77 | + host-platform: ${{ inputs.host-platform }} |
| 78 | + cuda-version: ${{ inputs.cuda-version }} |
| 79 | + |
| 80 | + # cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH |
| 81 | + # (set by fetch_ctk) must be available for both sdist and wheel builds. |
| 82 | + - name: Build cuda.bindings sdist and wheel-from-sdist |
| 83 | + run: | |
| 84 | + export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc) |
| 85 | + export CC="sccache cc" |
| 86 | + export CXX="sccache c++" |
| 87 | + python -m build --sdist cuda_bindings/ |
| 88 | + pip wheel --no-deps --wheel-dir cuda_bindings/dist cuda_bindings/dist/*.tar.gz |
| 89 | +
|
| 90 | + # cuda_core sdist delegates to setuptools (no CTK needed), but |
| 91 | + # wheel-from-sdist needs CTK and cuda-bindings (dynamic build dep via |
| 92 | + # get_requires_for_build_wheel in build_hooks.py). |
| 93 | + - name: Build cuda.core sdist and wheel-from-sdist |
| 94 | + run: | |
| 95 | + export CUDA_PYTHON_PARALLEL_LEVEL=$(nproc) |
| 96 | + export CUDA_CORE_BUILD_MAJOR="$(echo '${{ inputs.cuda-version }}' | cut -d. -f1)" |
| 97 | + export CC="sccache cc" |
| 98 | + export CXX="sccache c++" |
| 99 | + export PIP_FIND_LINKS="$(pwd)/cuda_bindings/dist $(pwd)/cuda_pathfinder/dist" |
| 100 | + python -m build --sdist cuda_core/ |
| 101 | + pip wheel --no-deps --wheel-dir cuda_core/dist cuda_core/dist/*.tar.gz |
| 102 | +
|
| 103 | + - name: Show sccache stats |
| 104 | + if: always() |
| 105 | + run: sccache --show-stats |
0 commit comments