Skip to content

Commit

Permalink
ci and uv
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeroll committed Oct 25, 2024
1 parent 6435865 commit 81dceca
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 132 deletions.
132 changes: 39 additions & 93 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This file is autogenerated by maturin v1.4.0
# To update, run
#
# maturin generate-ci github
#
name: build

on:
Expand All @@ -14,106 +9,57 @@ on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ubuntu-latest
test-and-build:
runs-on: ${{ matrix.runner }}
name: test-and-build (${{ matrix.python }}, ${{ matrix.target }})
strategy:
fail-fast: false
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
python:
- "3.12"
- "3.13"
platform: [macos, linux]
include:
- platform: macos
target: aarch64-apple-darwin
runner: macos-latest
- platform: macos
target: x86_64-apple-darwin
runner: macos-latest
- platform: linux
target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
- platform: linux
target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- run: uv python install ${{ matrix.python }}
- run: uv run pytest
- run: uv build -C "target=${{ matrix.target }}"

macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: wheels
name: wheel-${{ matrix.python }}-${{ matrix.target }}
path: dist

sdist:
release:
# if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- test-and-build
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
- uses: actions/download-artifact@v4
with:
name: wheels
pattern: wheel-*
merge-multiple: true
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4.1.7
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
- uses: ncipollo/release-action@v1
with:
command: upload
args: --non-interactive --skip-existing *
artifacts: "dist/*"
tag: v0.1.0
commit: ${{ github.sha }}
35 changes: 0 additions & 35 deletions .github/workflows/pytest.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
## Contributing

- [Install Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)
- Create a new Python environment and activate it
- Install Python dependencies: `pip install ".[dev]"`
- `uv sync`
- Play with the code
- Run tests: `maturin develop && pytest`
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ classifiers = [
]
dynamic = ["version"]

[project.optional-dependencies]
dev = ["maturin", "pytest", "pydantic"]
[tool.uv]
dev-dependencies = ["maturin", "pytest", "pydantic"]

[tool.maturin]
features = ["pyo3/extension-module"]
Expand Down
Loading

0 comments on commit 81dceca

Please sign in to comment.