Add python bindings for bonsai #110
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
| name: Rust PR | |
| on: | |
| pull_request: | |
| branches: [ main ] # run only when making a PR for main | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install libudev | |
| run: sudo apt-get update && sudo apt-get install libudev-dev pkg-config librust-alsa-sys-dev | |
| - uses: actions/checkout@v6.0.2 | |
| - uses: actions/setup-python@v6.2.0 | |
| - uses: pre-commit/action@v3.0.1 | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install libudev | |
| run: sudo apt-get update && sudo apt-get install libudev-dev pkg-config librust-alsa-sys-dev | |
| - uses: actions/checkout@v2 | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Build examples | |
| run: cargo build --examples | |
| - name: Run tests | |
| run: cargo test --verbose | |
| pytest: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python: ["3.10", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Create + activate venv (maturin develop requires one) | |
| # $GITHUB_PATH prepends to PATH for every subsequent step; | |
| # $GITHUB_ENV exports VIRTUAL_ENV (which maturin/pip detect) | |
| # so we don't need to `source venv/bin/activate` in each step. | |
| run: | | |
| python -m venv $HOME/.venv | |
| echo "$HOME/.venv/bin" >> $GITHUB_PATH | |
| echo "VIRTUAL_ENV=$HOME/.venv" >> $GITHUB_ENV | |
| - name: Install maturin and test deps | |
| run: pip install "maturin>=1.7,<2.0" pytest pytest-timeout mypy | |
| - name: Build and install bonsai-py | |
| working-directory: bonsai-py | |
| run: maturin develop --release | |
| - name: Run pytest | |
| run: pytest -v bonsai-py/tests/ | |
| - name: Run verify.py (sanity) | |
| run: python bonsai-py/scripts/verify.py |