Update ci.yml #15
This file contains 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
# Largely references https://github.com/pydantic/pydantic-core/blob/193f5d7a8627c988b1c7fab9a3712c779afbbe94/.github/workflows/ci.yml | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- next | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Run clippy | |
run: cargo clippy --all-targets | |
build-sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
rust-toolchain: stable | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypi_files_sdist | |
path: dist | |
build: | |
name: Build on ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.interpreter || 'all' }}${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }}) | |
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [linux, macos, windows] | |
target: [x86_64, aarch64] | |
include: | |
# musllinux | |
- os: linux | |
manylinux: musllinux_1_1 | |
target: x86_64 | |
- os: linux | |
manylinux: musllinux_1_1 | |
target: aarch64 | |
# macos | |
- os: macos | |
target: x86_64 | |
- os: macos | |
target: aarch64 | |
# windows | |
- os: windows | |
target: x86_64 | |
- os: windows | |
target: aarch64 | |
interpreter: 3.11 3.12 | |
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
architecture: x64 | |
- run: pip install -U twine 'ruff==0.1.3' typing_extensions | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: ${{ matrix.manylinux }} | |
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 pypy3.9 pypy3.10' }} | |
rust-toolchain: 1.77.0 | |
docker-options: -e CI | |
sccache: true | |
- run: twine check --strict dist/* | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypi_files_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }} | |
path: dist | |
release: | |
name: Release | |
needs: [clippy, build, build-sdist] | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- run: pip install -U twine | |
- name: Get artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: pypi_files_* | |
merge-multiple: true | |
path: dist | |
- run: twine check --strict dist/* | |
- name: Upload to PyPI | |
run: twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |