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 4c758ef
Show file tree
Hide file tree
Showing 4 changed files with 297 additions and 125 deletions.
128 changes: 40 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,63 @@ on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
test:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
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
- run: uv run pytest

windows:
runs-on: windows-latest
build:
runs-on: ${{ matrix.runner }}
name: build (${{ matrix.python }}, ${{ matrix.target }})
strategy:
matrix:
target: [x64, x86]
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"
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
- uses: astral-sh/setup-uv@v3

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
- run: uv python install ${{ matrix.python }}
- run: uv run pytest
- run: uv build -C "target=${{ matrix.target }}"

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

release:
name: Release
# if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
needs:
- test-and-build
steps:
- uses: actions/download-artifact@v4.1.7
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
path: dist
- 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 4c758ef

Please sign in to comment.