Convert to pyproject #41
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: Build the Python Wheel | |
on: | |
push: | |
branches: [ main ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: astral-sh/ruff-action@v3 | |
- run: ruff check | |
- run: ruff format --check --diff | |
build-binaries: | |
needs: [ lint ] | |
strategy: | |
matrix: | |
include: | |
- name: x86_64-linux | |
image: ubuntu-22.04 | |
cmake-args: -D ARCHITECTURE=x86_64 | |
- name: x86_64-windows | |
image: windows-2022 | |
cmake-args: -A x64 -D ARCHITECTURE=x86_64 | |
- name: x86_64-darwin | |
image: macos-13 | |
cmake-args: -D CMAKE_OSX_ARCHITECTURES=x86_64 -D ARCHITECTURE=x86_64 | |
- name: aarch64-darwin | |
image: macos-13 | |
cmake-args: -D CMAKE_OSX_ARCHITECTURES=arm64 -D ARCHITECTURE=aarch64 | |
runs-on: ${{ matrix.image }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build NDTable | |
run: | | |
cmake -S C -B C/${{ matrix.name }} ${{ matrix.cmake-args }} | |
cmake --build C/${{ matrix.name }} --target install | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.name }} | |
path: src/sdf/ndtable/${{ matrix.name }} | |
if-no-files-found: error | |
build-wheel: | |
runs-on: ubuntu-22.04 | |
needs: [build-binaries] | |
steps: | |
- uses: astral-sh/setup-uv@v4 | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-linux | |
path: src/sdf/ndtable/x86_64-linux | |
- uses: actions/download-artifact@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-windows | |
path: src/sdf/ndtable/x86_64-windows | |
- uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-darwin | |
path: src/sdf/ndtable/x86_64-darwin | |
- uses: actions/download-artifact@v4 | |
with: | |
name: aarch64-darwin | |
path: src/sdf/ndtable/aarch64-darwin | |
- run: uv build --wheel | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
if-no-files-found: error | |
run-tests: | |
needs: [ build-wheel ] | |
strategy: | |
matrix: | |
include: | |
- name: x86_64-linux | |
image: ubuntu-22.04 | |
- name: x86_64-windows | |
image: windows-2022 | |
- name: x86_64-darwin | |
image: macos-13 | |
- name: aarch64-darwin | |
image: macos-13 | |
runs-on: ${{ matrix.image }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rm pyproject.toml | |
- uses: astral-sh/setup-uv@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
- if: matrix.name == 'x86_64-windows' | |
run: | | |
uv venv --python 3.10 | |
.venv\Scripts\activate | |
uv pip install pytest | |
$files = Get-ChildItem "sdf-*-py3-none-any.whl" | |
foreach ($f in $files) { | |
uv pip install $f.FullName | |
} | |
uv run pytest | |
- if: matrix.name != 'x86_64-windows' | |
run: | | |
uv venv --python 3.10 | |
source .venv/bin/activate | |
uv pip install pytest | |
uv pip install sdf-*-py3-none-any.whl | |
uv run pytest |