Skip to content

Commit c3a7ff2

Browse files
[#1356] Workflow to publish nightly wheels
1 parent 459ef89 commit c3a7ff2

2 files changed

Lines changed: 166 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# ISC License
2+
#
3+
# Copyright (c) 2026, Autonomous Vehicle Systems Lab, University of Colorado at Boulder
4+
#
5+
# Permission to use, copy, modify, and/or distribute this software for any
6+
# purpose with or without fee is hereby granted, provided that the above
7+
# copyright notice and this permission notice appear in all copies.
8+
#
9+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16+
#
17+
18+
import argparse
19+
from pathlib import Path
20+
21+
22+
def _package_index(wheels: list[Path]) -> str:
23+
links = "\n".join(f' <a href="{w.name}">{w.name}</a><br/>' for w in wheels)
24+
return (
25+
"<!DOCTYPE html>\n"
26+
"<html><head><title>Links for bsk</title></head><body>\n"
27+
"<h1>Links for bsk</h1>\n"
28+
f"{links}\n"
29+
"</body></html>\n"
30+
)
31+
32+
33+
def _root_index() -> str:
34+
return (
35+
"<!DOCTYPE html>\n"
36+
"<html><head><title>Simple Index</title></head><body>\n"
37+
"<h1>Simple Index</h1>\n"
38+
' <a href="bsk/">bsk</a><br/>\n'
39+
"</body></html>\n"
40+
)
41+
42+
43+
def main() -> None:
44+
parser = argparse.ArgumentParser()
45+
parser.add_argument("--wheels-dir", required=True, type=Path)
46+
parser.add_argument("--output-dir", required=True, type=Path)
47+
args = parser.parse_args()
48+
49+
wheels = sorted(args.wheels_dir.glob("*.whl"))
50+
if not wheels:
51+
raise SystemExit(f"No wheels found in {args.wheels_dir}")
52+
53+
pkg_dir = args.output_dir / "bsk"
54+
pkg_dir.mkdir(parents=True, exist_ok=True)
55+
56+
(pkg_dir / "index.html").write_text(_package_index(wheels))
57+
(args.output_dir / "index.html").write_text(_root_index())
58+
59+
for whl in wheels:
60+
(pkg_dir / whl.name).write_bytes(whl.read_bytes())
61+
62+
print(f"Index generated with {len(wheels)} wheel(s) in {args.output_dir}")
63+
64+
65+
if __name__ == "__main__":
66+
main()
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Nightly Wheels
2+
3+
on:
4+
schedule:
5+
- cron: "0 6 * * *" # Every day at 6:00 UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-wheels:
10+
name: Build Wheels (${{ matrix.os }})
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os:
16+
- macos-latest
17+
- ubuntu-latest
18+
- ubuntu-22.04-arm
19+
- windows-latest
20+
21+
steps:
22+
- name: Checkout develop
23+
uses: actions/checkout@v5
24+
with:
25+
ref: develop
26+
27+
- name: Setup system dependencies
28+
uses: ./.github/actions/setup
29+
30+
- name: Build wheels
31+
uses: pypa/cibuildwheel@v3.1.4
32+
env:
33+
CONAN_ARGS: "--opNav True --mujoco True --mujocoReplay True"
34+
CIBW_TEST_SKIP: "*"
35+
36+
- name: Upload wheels
37+
uses: actions/upload-artifact@v6
38+
with:
39+
name: nightly-wheels-${{ matrix.os }}
40+
path: ./wheelhouse/*.whl
41+
42+
publish-index:
43+
name: Publish Nightly Index
44+
needs: build-wheels
45+
runs-on: ubuntu-latest
46+
permissions:
47+
contents: write
48+
49+
steps:
50+
- name: Checkout scripts
51+
uses: actions/checkout@v5
52+
with:
53+
ref: develop
54+
sparse-checkout: .github/scripts
55+
56+
- name: Download all wheels
57+
uses: actions/download-artifact@v4
58+
with:
59+
pattern: nightly-wheels-*
60+
merge-multiple: true
61+
path: wheels
62+
63+
- name: Generate simple index
64+
run: python .github/scripts/generate_nightly_index.py --wheels-dir wheels --output-dir nightly
65+
66+
- name: Deploy nightly index to GitHub Pages
67+
uses: peaceiris/actions-gh-pages@v3
68+
with:
69+
github_token: ${{ secrets.GITHUB_TOKEN }}
70+
publish_dir: ./nightly
71+
destination_dir: nightly
72+
keep_files: false
73+
74+
- name: Checkout gh-pages branch
75+
uses: actions/checkout@v5
76+
with:
77+
ref: gh-pages
78+
fetch-depth: 0
79+
path: gh-pages-site
80+
81+
- name: Trim gh-pages history
82+
shell: bash
83+
working-directory: gh-pages-site
84+
run: |
85+
set -euo pipefail
86+
87+
git config user.name "github-actions[bot]"
88+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
89+
90+
archive_path="${RUNNER_TEMP}/gh-pages-site.tar"
91+
tar --exclude=.git -cf "${archive_path}" .
92+
93+
git checkout --orphan gh-pages-reset
94+
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
95+
tar -xf "${archive_path}"
96+
97+
git add -A
98+
git commit -m "Trim gh-pages history"
99+
git branch -M gh-pages
100+
git push --force origin gh-pages

0 commit comments

Comments
 (0)