Skip to content
Draft
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
176 changes: 176 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: CI

on:
pull_request:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build (${{ matrix.os }}, Python ${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.9", "3.13"]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Sync artifacts
run: python tools/sync_all.py

- name: Build wheel
run: |
pip install build
python -m build --wheel -o dist

- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-py${{ matrix.python }}
path: dist/*.whl

test:
name: Test wheel (${{ matrix.os }}, Python ${{ matrix.python }})
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.9", "3.13"]

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: tests
sparse-checkout-cone-mode: false

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- uses: actions/download-artifact@v4
with:
name: wheel-${{ matrix.os }}-py${{ matrix.python }}
path: dist

- name: Install wheel and test dependencies
run: pip install dist/*.whl pytest
shell: bash

- name: Run smoke tests
run: pytest tests/test_smoke.py -v

examples:
name: Build example plugin (${{ matrix.os }}, Python ${{ matrix.python }})
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.13"]

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
examples
sparse-checkout-cone-mode: false

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- uses: actions/download-artifact@v4
with:
name: wheel-${{ matrix.os }}-py${{ matrix.python }}
path: dist

- name: Install bsk-sdk wheel and dependencies
# swig is a transitive dependency of bsk-sdk; listed explicitly here so
# the version is visible. bsk_add_swig_module.cmake auto-configures
# SWIG_EXECUTABLE / SWIG_DIR / SWIG_LIB from the pip-installed package.
run: pip install dist/*.whl numpy bsk
shell: bash

- name: Build example plugin wheel
run: |
pip install build scikit-build-core
python -m build --wheel --no-isolation -o plugin-dist examples/custom-atm-plugin
shell: bash

- uses: actions/upload-artifact@v4
with:
name: plugin-wheel-${{ matrix.os }}-py${{ matrix.python }}
path: plugin-dist/*.whl
retention-days: 7

- name: Install plugin wheel and test dependencies
run: pip install plugin-dist/*.whl pytest
shell: bash

- name: Run example plugin tests
run: pytest examples/custom-atm-plugin/test_atm_plugin.py -v

# Verify that the SWIG 4.x runtime type-table ABI is stable across minor
# versions within the same SWIG_RUNTIME_VERSION epoch: bsk is built with
# 4.3.1 (SWIG_RUNTIME_VERSION "4"); plugins may use any 4.0–4.3.x release.
# SWIG 4.4.0 bumped SWIG_RUNTIME_VERSION to "5", so >=4.4 is incompatible
# and excluded here (bsk-sdk pins swig<4.4 to prevent accidental use).
swig-compat:
name: SWIG compat (plugin=${{ matrix.plugin_swig }}, bsk=4.3.1)
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plugin_swig: ["4.0.0", "4.2.1", "4.3.1"]

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: examples
sparse-checkout-cone-mode: false

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- uses: actions/download-artifact@v4
with:
name: wheel-ubuntu-latest-py3.13
path: dist

- name: Install bsk-sdk wheel and dependencies
# Install bsk (built with SWIG 4.3.1) then override the swig version
# bsk-sdk pulled in so the plugin is compiled with a different release.
run: |
pip install dist/*.whl numpy bsk
pip install "swig==${{ matrix.plugin_swig }}" --force-reinstall
shell: bash

- name: Build example plugin wheel
run: |
pip install build scikit-build-core
python -m build --wheel --no-isolation -o plugin-dist examples/custom-atm-plugin
shell: bash

- name: Install plugin wheel and run tests
run: |
pip install plugin-dist/*.whl pytest
pytest examples/custom-atm-plugin/test_atm_plugin.py -v
shell: bash
104 changes: 104 additions & 0 deletions .github/workflows/publish-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Publish Wheels

on:
push:
tags:
- "v[0-9]*"
- "test*"

jobs:
build-wheels:
name: Build wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest # manylinux x86_64
- ubuntu-22.04-arm # manylinux aarch64
- macos-latest # macOS arm64
- windows-latest # Windows x86_64

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Sync Basilisk artifacts (host)
run: python tools/sync_all.py

- name: Build wheels
uses: pypa/cibuildwheel@v3.1.4
env:
# Sync artifacts are already present from the host step above;
# the build backend will find them and skip auto-sync.
BSK_SDK_AUTO_SYNC: "0"

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

make-sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Sync Basilisk artifacts
run: python tools/sync_all.py

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

publish:
name: Publish to PyPI
needs: [build-wheels, make-sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
merge-multiple: true
path: dist

- name: Download sdist
uses: actions/download-artifact@v4
with:
name: cibw-sdist
path: dist

- name: Publish to TestPyPI (test tags)
if: startsWith(github.ref, 'refs/tags/test')
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist
skip-existing: true
verbose: true

- name: Publish to PyPI (release tags)
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
73 changes: 73 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

src/bsk_sdk/include/Basilisk/*
src/bsk_sdk/arch_min/*
src/bsk_sdk/include_compat/*
src/bsk_sdk/runtime_min/*
src/bsk_sdk/swig/*

# Standard Python ignores
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Sphinx documentation
docs/_build/

# UV
uv.lock

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "external/basilisk"]
path = external/basilisk
url = https://github.com/AVSLab/basilisk.git
branch = v2.9.1
Loading
Loading