-
Notifications
You must be signed in to change notification settings - Fork 102
Refactor GitHub workflows and use composite actions #1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ReeceHumphreys
merged 7 commits into
develop
from
feature/bsk-1072-github-workflow-refactor
Sep 2, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
023d4ad
Update .gitignore to unignore actions/build
ReeceHumphreys 39b8ffc
Create composite actions for building bsk
ReeceHumphreys 293c14d
Remove schedule for canary workflow
ReeceHumphreys 2c8d230
Update workflows to use composite actions
ReeceHumphreys 985a42a
Test latest Python on Windows/Linux; all for macOS
ReeceHumphreys e7b75fd
removed deprecated use of astro constants
schaubh 9d0b878
Update release notes
schaubh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | ||
schaubh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.