Skip to content

Commit 6cee1ea

Browse files
committed
First stab at nested build matrix
1 parent 05955b3 commit 6cee1ea

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

.github/workflows/build.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
host_platform:
5+
required: true
6+
type: string
7+
cuda_version:
8+
type: string
9+
default: "12.8.0"
10+
11+
defaults:
12+
run:
13+
shell: bash --noprofile --norc -xeuo pipefail {0}
14+
15+
permissions:
16+
contents: read # This is required for actions/checkout
17+
18+
jobs:
19+
build:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
python_version:
24+
- "3.9"
25+
- "3.13"
26+
name: Build (py${{ matrix.python_version }}, ${{ inputs.cuda_version }})
27+
if: ${{ github.repository_owner == 'nvidia' }}
28+
runs-on: ${{ (inputs.host_platform == 'linux-64' && 'linux-amd64-cpu8') ||
29+
(inputs.host-platform == 'linux-aarch64' && 'linux-arm64-cpu8') ||
30+
(inputs.host-platform == 'win-64' && 'windows-2019') }}
31+
steps:
32+
- name: Checkout ${{ github.event.repository.name }}
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Set up Python
38+
if: ${{ startsWith(matrix.host-platform, 'linux') }}
39+
id: setup-python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: "3.12"
43+
44+
- name: Set up MSVC
45+
if: ${{ startsWith(matrix.host-platform, 'win') }}
46+
uses: ilammy/msvc-dev-cmd@v1
47+
48+
- name: Set environment variables
49+
run: |
50+
PYTHON_VERSION_FORMATTED=$(echo '${{ matrix.python_version }}' | tr -d '.')
51+
if [[ "${{ inputs.host_platform }}" == linux* ]]; then
52+
CIBW_BUILD="cp${PYTHON_VERSION_FORMATTED}-manylinux*"
53+
REPO_DIR=$(pwd)
54+
elif [[ "${{ inputs.host_platform }}" == win* ]]; then
55+
CIBW_BUILD="cp${PYTHON_VERSION_FORMATTED}-win_amd64"
56+
PWD=$(pwd)
57+
REPO_DIR=$(cygpath -w $PWD)
58+
fi
59+
60+
echo "CUDA_BINDINGS_PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV
61+
CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}"
62+
echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
63+
echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
64+
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
65+
CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ matrix.cuda-version }}-${{ matrix.host-platform }}"
66+
echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
67+
echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
68+
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
69+
echo "CIBW_BUILD=${CIBW_BUILD}" >> $GITHUB_ENV
70+
71+
- name: Dump environment
72+
run: |
73+
env
74+
75+
- name: Build cuda.core wheel
76+
uses: pypa/cibuildwheel@v2.22.0
77+
env:
78+
CIBW_BUILD: ${{ env.CIBW_BUILD }}
79+
CIBW_ARCHS_LINUX: "native"
80+
CIBW_BUILD_VERBOSITY: 1
81+
with:
82+
package-dir: ./cuda_core/
83+
output-dir: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}

.github/workflows/ci.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "CI"
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{
5+
github.ref_name == 'main' && format('ci-main-build-test-{0}', github.run_id) ||
6+
format('ci-pr-build-test-on-{0}-against-branch-{1}', github.event_name, github.ref_name)
7+
}}
8+
cancel-in-progress: true
9+
10+
on:
11+
push:
12+
branches:
13+
- "pull-request/[0-9]+"
14+
- "main"
15+
16+
jobs:
17+
build:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
host_platform:
22+
- linux-64
23+
- linux-aarch64
24+
- win-64
25+
name: ${{ matrix.host_platform }}
26+
if: ${{ github.repository_owner == 'nvidia' }}
27+
secrets: inherit
28+
uses:
29+
./.github/workflows/build.yml
30+
with:
31+
host_platform: ${{ matrix.host_platform }}
32+
cuda_version: "12.8.0"

0 commit comments

Comments
 (0)