Skip to content

Commit

Permalink
ci: update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Nov 14, 2024
1 parent 8640399 commit 443a933
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 66 deletions.
144 changes: 102 additions & 42 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is autogenerated by maturin v1.3.0
# This file is autogenerated by maturin v1.7.4
# To update, run
#
# maturin generate-ci github
# maturin generate-ci github -m crates/lox-space/Cargo.toml -o .github/workflows/python.yml --pytest
#
name: Python

Expand All @@ -11,7 +11,7 @@ on:
- main
- master
tags:
- lox-space-*
- 'lox-space-*'
pull_request:
workflow_dispatch:

Expand All @@ -20,76 +20,131 @@ permissions:

jobs:
linux:
runs-on: ubuntu-latest
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
target: [ x86_64, x86, aarch64, armv7 ]
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ]
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
working-directory: ./crates/lox-space
args: --release --out dist -i ${{ matrix.python-version }}
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path crates/lox-space/Cargo.toml
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./crates/lox-space/dist
name: wheels-linux-${{ matrix.platform.target }}
path: dist
- name: pytest
if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
shell: bash
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
pip install lox-space --find-links dist --force-reinstall
pip install pytest
cd crates/lox-space && pytest
- name: pytest
if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.platform.target }}
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
pip3 install -U pip pytest
run: |
set -e
pip3 install lox-space --find-links dist --force-reinstall
cd crates/lox-space && pytest
windows:
runs-on: windows-latest
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
target: [ x64, x86 ]
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
working-directory: ./crates/lox-space
args: --release --out dist --find-interpreter
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path crates/lox-space/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./crates/lox-space/dist
name: wheels-windows-${{ matrix.platform.target }}
path: dist
- name: pytest
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
shell: bash
run: |
set -e
python3 -m venv .venv
source .venv/Scripts/activate
pip install lox-space --find-links dist --force-reinstall
pip install pytest
cd crates/lox-space && pytest
macos:
runs-on: macos-latest
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
target: [ x86_64, aarch64 ]
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
working-directory: ./crates/lox-space
args: --release --out dist --find-interpreter
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --manifest-path crates/lox-space/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./crates/lox-space/dist
name: wheels-macos-${{ matrix.platform.target }}
path: dist
- name: pytest
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
pip install lox-space --find-links dist --force-reinstall
pip install pytest
cd crates/lox-space && pytest
sdist:
runs-on: ubuntu-latest
Expand All @@ -98,32 +153,37 @@ jobs:
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: ./crates/lox-space
command: sdist
args: --out dist
args: --out dist --manifest-path crates/lox-space/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./crates/lox-space/dist
name: wheels-sdist
path: dist

release:
name: Release
environment: release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [linux, musllinux, windows, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ linux, windows, macos, sdist ]
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/download-artifact@v4
id: download-wheels
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
name: wheels
path: wheels
subject-path: 'wheels-*/*'
- name: Publish to PyPI
if: "startsWith(github.ref, 'refs/tags/')"
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
working-directory: ${{steps.download-wheels.outputs.download-path}}
command: upload
args: --non-interactive --skip-existing *
args: --non-interactive --skip-existing wheels-*/*
25 changes: 1 addition & 24 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,6 @@ jobs:
- name: Run tests
run: cargo test --all-features

python:
name: Python smoke tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Generate virtual environment
run: python -m venv .venv
- name: Build Python wrapper
uses: PyO3/maturin-action@v1
with:
command: develop
working-directory: ./crates/lox-space
args: --extras dev
- name: Run test
run: |
source .venv/bin/activate
pytest crates/lox-space/tests
fmt:
name: Rustfmt
runs-on: ubuntu-latest
Expand Down Expand Up @@ -71,7 +48,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: 3.x
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
Expand Down

0 comments on commit 443a933

Please sign in to comment.