Skip to content

Commit d36d0a2

Browse files
[#9] Extract wheel build into reusable composite action
1 parent 5fb9074 commit d36d0a2

3 files changed

Lines changed: 85 additions & 68 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#
2+
# ISC License
3+
#
4+
# Copyright (c) 2026, Autonomous Vehicle Systems Lab, University of Colorado at Boulder
5+
#
6+
# Permission to use, copy, modify, and/or distribute this software for any
7+
# purpose with or without fee is hereby granted, provided that the above
8+
# copyright notice and this permission notice appear in all copies.
9+
#
10+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17+
#
18+
19+
name: Build bsk-sdk distributions
20+
description: >
21+
Checks out the matching Basilisk submodule, syncs vendored artifacts,
22+
and builds the bsk-sdk wheel.
23+
24+
inputs:
25+
sdist:
26+
description: Build an sdist alongside the wheel
27+
default: "false"
28+
output-dir:
29+
description: Directory to write built distributions into
30+
default: dist
31+
32+
runs:
33+
using: composite
34+
steps:
35+
- name: Determine BSK release tag
36+
id: bsk-tag
37+
shell: bash
38+
run: |
39+
BSK_TAG=$(python -c "
40+
import re
41+
from pathlib import Path
42+
text = Path('pyproject.toml').read_text()
43+
match = re.search(r'(?m)^version\s*=\s*\"([^\"]+)\"', text)
44+
if not match:
45+
raise SystemExit('version not found in pyproject.toml')
46+
print('v' + match.group(1))
47+
")
48+
echo "tag=$BSK_TAG" >> $GITHUB_OUTPUT
49+
50+
- name: Checkout Basilisk submodule at release tag
51+
shell: bash
52+
run: |
53+
git submodule update --init --depth 1 external/basilisk
54+
git -C external/basilisk fetch origin \
55+
refs/tags/${{ steps.bsk-tag.outputs.tag }}:refs/tags/${{ steps.bsk-tag.outputs.tag }} \
56+
--depth 1
57+
git -C external/basilisk checkout ${{ steps.bsk-tag.outputs.tag }}
58+
59+
- name: Sync Basilisk artifacts
60+
shell: bash
61+
run: python tools/sync_all.py
62+
63+
- name: Install build tooling
64+
shell: bash
65+
run: python -m pip install --upgrade pip build
66+
67+
- name: Build distributions
68+
shell: bash
69+
env:
70+
BSK_SDK_AUTO_SYNC: "0"
71+
run: |
72+
if [ "${{ inputs.sdist }}" = "true" ]; then
73+
python -m build --outdir "${{ inputs.output-dir }}"
74+
else
75+
python -m build --wheel --outdir "${{ inputs.output-dir }}"
76+
fi

.github/workflows/ci.yml

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -52,39 +52,9 @@ jobs:
5252
with:
5353
python-version: ${{ matrix.python }}
5454

55-
- name: Determine BSK release tag
56-
id: bsk-tag
57-
shell: bash
58-
run: |
59-
BSK_VERSION=$(python -c "
60-
from pathlib import Path
61-
import re
62-
63-
text = Path('pyproject.toml').read_text()
64-
match = re.search(r'(?m)^version\s*=\s*\"([^\"]+)\"', text)
65-
if not match:
66-
raise SystemExit('Could not find project.version in pyproject.toml')
67-
print(match.group(1))
68-
")
69-
echo "version=$BSK_VERSION" >> $GITHUB_OUTPUT
70-
echo "tag=v$BSK_VERSION" >> $GITHUB_OUTPUT
71-
72-
- name: Checkout Basilisk submodule at release tag
73-
shell: bash
74-
run: |
75-
git submodule update --init --depth 1 external/basilisk
76-
git -C external/basilisk fetch origin \
77-
refs/tags/${{ steps['bsk-tag'].outputs.tag }}:refs/tags/${{ steps['bsk-tag'].outputs.tag }} \
78-
--depth 1
79-
git -C external/basilisk checkout ${{ steps['bsk-tag'].outputs.tag }}
80-
81-
- name: Sync artifacts
82-
run: python tools/sync_all.py
83-
84-
- name: Build wheel
85-
run: |
86-
pip install build
87-
python -m build --wheel -o dist
55+
- uses: ./.github/actions/build-sdk-wheel
56+
with:
57+
output-dir: dist
8858

8959
- uses: actions/upload-artifact@v6
9060
with:
@@ -116,7 +86,7 @@ jobs:
11686
with:
11787
python-version: ${{ matrix.python }}
11888

119-
- uses: actions/download-artifact@v5
89+
- uses: actions/download-artifact@v6
12090
with:
12191
name: wheel-${{ matrix.os }}-py${{ matrix.python }}
12292
path: dist
@@ -154,7 +124,7 @@ jobs:
154124
with:
155125
python-version: ${{ matrix.python }}
156126

157-
- uses: actions/download-artifact@v5
127+
- uses: actions/download-artifact@v6
158128
with:
159129
name: wheel-${{ matrix.os }}-py${{ matrix.python }}
160130
path: dist

.github/workflows/publish-wheels.yml

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,39 +38,10 @@ jobs:
3838
with:
3939
python-version: "3.13"
4040

41-
- name: Determine BSK release tag
42-
id: bsk-tag
43-
shell: bash
44-
run: |
45-
BSK_TAG=$(python -c "
46-
import tomllib
47-
with open('pyproject.toml', 'rb') as f:
48-
version = tomllib.load(f)['project']['version']
49-
print('v' + version)
50-
")
51-
echo "tag=$BSK_TAG" >> $GITHUB_OUTPUT
52-
53-
- name: Checkout Basilisk submodule at release tag
54-
shell: bash
55-
run: |
56-
git submodule update --init --depth 1 external/basilisk
57-
git -C external/basilisk fetch origin \
58-
refs/tags/${{ steps['bsk-tag'].outputs.tag }}:refs/tags/${{ steps['bsk-tag'].outputs.tag }} \
59-
--depth 1
60-
git -C external/basilisk checkout ${{ steps['bsk-tag'].outputs.tag }}
61-
62-
- name: Sync Basilisk artifacts
63-
run: python tools/sync_all.py
64-
65-
- name: Install build tooling
66-
run: python -m pip install --upgrade pip build
67-
68-
- name: Build wheel and sdist
69-
env:
70-
# Sync artifacts are already present from the step above;
71-
# the build backend will find them and skip auto-sync.
72-
BSK_SDK_AUTO_SYNC: "0"
73-
run: python -m build --outdir dist
41+
- uses: ./.github/actions/build-sdk-wheel
42+
with:
43+
sdist: 'true'
44+
output-dir: dist
7445

7546
- uses: actions/upload-artifact@v6
7647
with:

0 commit comments

Comments
 (0)