Skip to content

Use rules_python free-threading config settings #160

Use rules_python free-threading config settings

Use rules_python free-threading config settings #160

Workflow file for this run

name: Lint and test nanobind-bazel
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
buildifier:
name: Lint Bazel files with buildifier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Run pre-commit checks
run: uvx pre-commit run --all-files --verbose --show-diff-on-failure
test:
name: Test nanobind_example on ${{ matrix.os }} w/ Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Check out nanobind example repo
uses: actions/checkout@v4
with:
repository: wjakob/nanobind_example
path: nanobind_example
ref: bazel
- name: Patch nanobind_example stubgen target
run: git apply ${{github.workspace }}/stubgen.patch
working-directory: ${{ github.workspace }}/nanobind_example
- name: Override nanobind_bazel pin in MODULE.bazel
run: python fixup_module_bazel.py ${{ github.workspace}}/nanobind_example
- name: Build and test nanobind_example on ${{ matrix.os }}
# --no-sync is required so that uv does not remove the .so file again.
run: |
uv sync --no-editable
uv run --no-sync -- python -c "import nanobind_example; assert nanobind_example.add(1, 2) == 3"
working-directory: ${{ github.workspace }}/nanobind_example
- name: Check ${{ matrix.os }} CPython>=3.12 wheels for stable ABI violations
if: ${{ contains(fromJSON('["3.12", "3.13"]'), matrix.python-version) }}
run: |
uv pip install abi3audit
uv build --wheel
uv run --no-sync abi3audit dist/*.whl --verbose --summary
shell: bash
working-directory: ${{ github.workspace }}/nanobind_example