Skip to content

Commit 2b49dac

Browse files
authored
Updates wheel versioning (#5467)
# Description Adds wheel versioning so QA can identify which build is newer and reproduce any wheel from its commit. The wheel follows PEP 440 local-version `<VERSION>+build<N>.<sha7>`. Downloading in QA env: ``` # Latest from develop RUN_ID=$(gh run list --workflow=wheel.yml --branch=develop -L 1 --json databaseId -q '.[0].databaseId') rm -rf ./out && gh run download "$RUN_ID" --pattern 'isaaclab-*' -D ./out # Latest from a specific PR branch RUN_ID=$(gh run list --workflow=wheel.yml --branch=<branch-name> -L 1 --json databaseId -q '.[0].databaseId') rm -rf ./out && gh run download "$RUN_ID" --pattern 'isaaclab-*' -D ./out # Specific run rm -rf ./out && gh run download <run-id> --pattern 'isaaclab-*' -D ./out # Find newly downloaded wheel file WHEEL_FILE=$(ls -1t ./out/isaaclab-*/*.whl | head -1) # Install it pip install --force-reinstall $WHEEL_FILE ``` ## Type of change - New feature (non-breaking change which adds functionality) ## Checklist - [x] I have read and understood the contribution guidelines - [x] I have run the pre-commit checks with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
1 parent 6dfa5fa commit 2b49dac

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/wheel.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,28 @@ jobs:
4646
python-version: "3.12"
4747
architecture: x64
4848

49+
# Compose Docker-image-style metadata for the artifact. The artifact
50+
# name is what QA sees in `gh run download`, so we make it scannable:
51+
# isaaclab-<VERSION>-build<RUN_NUMBER>-<SHA7>. The wheel inside follows
52+
# PEP 440 (VERSION+buildN.SHA7) since pip requires that format.
53+
- name: Compute wheel metadata
54+
id: meta
55+
run: |
56+
set -euo pipefail
57+
version=$(cat VERSION)
58+
sha_slug="${GITHUB_SHA:0:7}"
59+
echo "artifact_name=isaaclab-${version}-build${{ github.run_number }}-${sha_slug}" >> "$GITHUB_OUTPUT"
60+
4961
- name: Build wheel
62+
env:
63+
WHEEL_BUILD_NUMBER: ${{ github.run_number }}
64+
WHEEL_SHA: ${{ github.sha }}
5065
run: bash tools/wheel_builder/build.sh
5166

5267
- name: Upload wheel artifact
5368
uses: actions/upload-artifact@v7
5469
with:
55-
name: ${{ github.event_name == 'pull_request' && format('isaaclab-wheel-pr-{0}-{1}', github.event.pull_request.number, github.sha) || format('isaaclab-wheel-{0}-{1}', github.ref_name, github.sha) }}
70+
name: ${{ steps.meta.outputs.artifact_name }}
5671
path: tools/wheel_builder/build/dist/isaaclab-*.whl
5772
if-no-files-found: error
5873
retention-days: 30

tools/wheel_builder/build.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ VERSION=$(cat VERSION)
88
BUILD_DIR=$SELF_DIR/build/stage
99
DIST_DIR=$SELF_DIR/build/dist
1010

11+
# Compose a PEP 440 local version when CI metadata is provided so the wheel is
12+
# traceable to a specific build and commit. With both env vars set the version
13+
# becomes e.g. "3.0.0+build123.abc1234" (build number is monotonic, sha slug
14+
# pins the source). If either is missing, fall back to the plain VERSION so
15+
# local dev builds stay simple.
16+
WHEEL_BUILD_NUMBER="${WHEEL_BUILD_NUMBER:-}"
17+
WHEEL_SHA="${WHEEL_SHA:-}"
18+
if [ -n "$WHEEL_BUILD_NUMBER" ] && [ -n "$WHEEL_SHA" ]; then
19+
SHA_SLUG="${WHEEL_SHA:0:7}"
20+
WHEEL_VERSION="${VERSION}+build${WHEEL_BUILD_NUMBER}.${SHA_SLUG}"
21+
else
22+
WHEEL_VERSION="${VERSION}"
23+
fi
24+
echo "[WHEEL VERSION] $WHEEL_VERSION"
25+
1126
# Platform tags matching the official IsaacLab wheel
1227
PYTHON_TAG="${PYTHON_TAG:-cp312}"
1328
ABI_TAG="${ABI_TAG:-cp312}"
@@ -65,7 +80,7 @@ cp "$SELF_DIR/res/__init__.py" "$BUILD_DIR/src/isaaclab/"
6580
cp "$SELF_DIR/res/__main__.py" "$BUILD_DIR/src/isaaclab/"
6681

6782
# 3. Generate pyproject.toml with dependencies from python_packages.toml
68-
python3 "$SELF_DIR/gen_pyproject.py" "$SELF_DIR/res/python_packages.toml" "$BUILD_DIR/pyproject.toml" "$VERSION"
83+
python3 "$SELF_DIR/gen_pyproject.py" "$SELF_DIR/res/python_packages.toml" "$BUILD_DIR/pyproject.toml" "$WHEEL_VERSION"
6984

7085
# 4. Build the wheel
7186
cd "$BUILD_DIR"

0 commit comments

Comments
 (0)