Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: build
description: >
Sets up a cross-platform build environment for Basilisk and performs
either a Conan-based build or a pip-based build.
inputs:
python-version:
description: Python version
required: true
conan-args:
required: false
default: ""
is-canary:
description: If a canary build is being performed.
required: false
default: false
skip-build:
description: Used to do all build related setup, while skipping the actual build
required: false
default: false

runs:
using: "composite"
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
cache-dependency-path: |
requirements_dev.txt
requirements_doc.txt
requirements.txt

- name: Install Linux System Deps.
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3-setuptools python3-tk libgtk2.0

- name: SWIG Install (Linux)
if: runner.os == 'Linux'
uses: mmomtchev/setup-swig@v4
with:
version: v4.2.1

- name: SWIG Install (macOS)
if: runner.os == 'macOS'
shell: bash
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_UPGRADE: 1
HOMEBREW_NO_ANALYTICS: 1
run: brew install swig || true

- name: SWIG Install (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$swigDir = "C:\Program Files\SWIG"
if (!(Test-Path $swigDir)) {New-Item -ItemType Directory -Path $swigDir | Out-Null}
$swigZip = "$swigDir\swigwin-4.2.1.zip"
$swigUrl = "https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.2.1/swigwin-4.2.1.zip/download"
Start-Process -NoNewWindow -Wait -FilePath "curl.exe" -ArgumentList "-L -o `"$swigZip`" `"$swigUrl`""
if (!(Test-Path $swigZip) -or ((Get-Item $swigZip).Length -lt 500KB)) { Write-Host "Download failed or file is corrupted." }
Expand-Archive -Path $swigZip -DestinationPath $swigDir -Force

- name: "Add Basilisk and SWIG paths"
if: runner.os == 'Windows'
shell: pwsh
run: |
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$newPath = “C:\Program Files\SWIG\swigwin-4.2.1;$oldpath;${{ env.GITHUB_WORKSPACE }}\dist3\Basilisk”
echo "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Install requirements
shell: bash
run: |
if [[ "${{ inputs.is-canary }}" == 'true' ]]; then
pip install -r .github/workflows/requirements.txt -r .github/workflows/requirements_dev.txt
else
pip install -r requirements.txt -r requirements_dev.txt
fi

- name: Cache Conan
uses: actions/cache@v4
with:
path: ${{ env.HOME }}/.conan2
key: >-
conan-${{ runner.os }}-py${{ inputs.python-version }}-
${{ hashFiles('conan.lock','conanfile.*','**/conanfile.*','CMakeLists.txt','**/*.cmake') }}
restore-keys: |
conan-${{ runner.os }}-py${{ inputs.python-version }}-

- name: Configure Conan profile
shell: bash
run: |
python -m conans.conan profile detect --exist-ok
prof_path="$(python -m conans.conan profile path default)"
grep -q '^\[conf\]' "$prof_path" || printf "\n[conf]\n" >> "$prof_path"
grep -q '^tools.system.package_manager:mode=install$' "$prof_path" || \
printf "tools.system.package_manager:mode=install\n" >> "$prof_path"
grep -q '^tools.system.package_manager:sudo=True$' "$prof_path" || \
printf "tools.system.package_manager:sudo=True\n" >> "$prof_path"

- name: Build Basilisk
shell: bash
if: ${{ inputs.skip-build == 'false' }}
env:
CONAN_ARGS: ${{ inputs.conan-args }}
run: |
pip install --no-build-isolation -e . -v
bskLargeData
33 changes: 33 additions & 0 deletions .github/actions/docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: docs
description: Build Sphinx docs

inputs:
html-dir: { required: false, default: "docs/build/html" }
is-canary:
description: If a canary build is being performed.
required: false
default: false

runs:
using: composite
steps:
- name: Install doc requirements
shell: bash
run: |
brew install doxygen
if [[ "${{ inputs.is-canary }}" == 'true' ]]; then
pip install -r .github/workflows/requirements_doc.txt
else
pip install -r requirements_doc.txt
fi
- name: Generate doc artifacts
shell: bash
env:
MPLBACKEND: agg
working-directory: src
run: pytest -n auto -m "not ciSkip" -rs --dist=loadscope -v
- name: Compile docs
shell: bash
run: |
make -C docs html SPHINXOPTS="-W"
echo "DOCS_HTML=${{ inputs.html-dir }}" >> "$GITHUB_ENV"
15 changes: 15 additions & 0 deletions .github/actions/pre-commit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: pre-commit
description: Run pre-commit on changed files with Python 3.11

runs:
using: composite
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.11

- id: file_changes
uses: tj-actions/changed-files@v44
- uses: pre-commit/action@v3.0.1
with:
extra_args: --files ${{ steps.file_changes.outputs.all_changed_files }}
62 changes: 18 additions & 44 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: "Canary Build"

on:
schedule:
- cron: '0 0 * * 0' # Run weekly on Sunday at midnight
workflow_dispatch:
pull_request:
branches:
Expand All @@ -19,70 +17,46 @@ jobs:
timeout-minutes: 75
strategy:
matrix:
python-version: [ "3.13" ]
python-version: ["3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install swig doxygen

- name: "Create virtual Environment"
run: python3 -m venv .venv
- name: "Capture initial package versions"
- name: Capture initial package versions
run: |
source .venv/bin/activate
pip freeze > initial_versions.txt
echo "Initial package versions:" >> $GITHUB_STEP_SUMMARY
cat initial_versions.txt >> $GITHUB_STEP_SUMMARY
echo "\n" >> $GITHUB_STEP_SUMMARY

- name: "Install canary requirements"
run: |
source .venv/bin/activate
pip3 install -r .github/workflows/requirements.txt
pip3 install -r .github/workflows/requirements_dev.txt
pip3 install -r .github/workflows/requirements_doc.txt
pip3 install pytest-error-for-skips

- name: "Capture final package versions"
- name: Build Basilisk
uses: ./.github/actions/build
with:
python-version: ${{ matrix.python-version }}
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --pyPkgCanary True
is-canary: true
- name: Capture final package versions
run: |
source .venv/bin/activate
pip freeze > final_versions.txt
echo "Final package versions:" >> $GITHUB_STEP_SUMMARY
cat final_versions.txt >> $GITHUB_STEP_SUMMARY
echo "\n" >> $GITHUB_STEP_SUMMARY
echo "Package version changes:" >> $GITHUB_STEP_SUMMARY
diff -u initial_versions.txt final_versions.txt | grep -E '^[+-]' | grep -v '^+++' | grep -v '^---' >> $GITHUB_STEP_SUMMARY

- name: "Build basilisk with latest dependencies"
run: source .venv/bin/activate && python3 conanfile.py --opNav True --allOptPkg --mujoco True --mujocoReplay True --pyPkgCanary True

- name: "Run Python Tests"
run: |
source .venv/bin/activate
cd src
pytest -n auto -m "not ciSkip" -rs --error-for-skips --dist=loadscope -v
if: ${{ always() }}
- name: "Run C/C++ Tests"
# NOTE: The documentation depends on images generated by executing the
# Python tests successfully. As such, the "Build docs" action below
# handles running the Python tests internally
- name: Run C/C++ Tests
working-directory: ./dist3
run: ctest -C Release
if: ${{ always() }}

- name: "Build Documentation"
run: |
source .venv/bin/activate
cd docs
make html SPHINXOPTS="-W"
if: ${{ always() }}

- name: "Upload package version logs"
- name: Build docs
uses: ./.github/actions/docs
with:
is-canary: true
- name: Upload package version logs
if: always()
uses: actions/upload-artifact@v4
with:
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Merge to develop

on:
push:
branches: [develop]
workflow_dispatch:

permissions:
contents: write
actions: read

concurrency:
group: merge-develop
cancel-in-progress: false

jobs:
bump_version:
name: Bump version (skip if already bumped)
runs-on: ubuntu-latest
if: ${{ github.actor != 'AVSlabBot' }}
steps:
- uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
token: ${{ secrets.BOT_ACCESS_TOKEN }}

- name: Bump version
run: ./.github/workflows/version-bumper.sh ./docs/source/bskVersion.txt

- name: Commit and push
run: |
git config user.name "AVSlabBot"
git config user.email "cuavslab@gmail.com"
git commit -a -m "[AUTO] Bump version number" || echo "No changes"
git push || true

build-ubuntu-latest-wheels:
name: Build ubuntu-latest wheels
needs: bump_version
# Allow for manual runs to generate new wheels
if: ${{ always() }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v4

# The 'Build wheel' step will perform the actual build. However, we want
# all pre build setup to still be performed
- uses: ./.github/actions/build
with:
python-version: ${{ matrix.python-version }}
extra-apt: "cmake"
skip-build: true

- name: Build wheel
run: |
python -m pip wheel . -v --wheel-dir /tmp/wheelhouse

- uses: actions/upload-artifact@v4
with:
name: basilisk-wheels_ubuntu-22.04_python${{ matrix['python-version'] }}
path: /tmp/wheelhouse/**/*asilisk*.whl

build_documentation:
name: macOS Docs Deployment
needs: bump_version
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build Basilisk
uses: ./.github/actions/build
with:
python-version: 3.13
conan-args: --opNav True --allOptPkg --mujoco True --mujocoReplay True --recorderPropertyRollback True
- name: Build docs
uses: ./.github/actions/docs
- name: Deploy
if: ${{ success() }} # deploy only if prior steps ok
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
force_orphan: true
10 changes: 10 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Pre-commit
on:
workflow_dispatch:

jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pre-commit
Loading
Loading