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 7145ee5
Show file tree
Hide file tree
Showing 4 changed files with 290 additions and 125 deletions.
121 changes: 33 additions & 88 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,56 @@ on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ubuntu-latest
test-and-build:
runs-on: ${{ matrix.runner }}
name: build (${{ matrix.python }}, ${{ matrix.target }})
strategy:
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: 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
with:
name: wheels
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
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
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 }}
- name: Create a release
uses: ncipollo/release-action@v1
with:
command: upload
args: --non-interactive --skip-existing *
artifacts: "dist/*"
tag: vtest
commit: ${{ github.sha }}
35 changes: 0 additions & 35 deletions .github/workflows/pytest.yaml

This file was deleted.

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 7145ee5

Please sign in to comment.