This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
CI #181
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v[0-9].*" | |
pull_request: | |
release: | |
types: [published] | |
schedule: | |
# Daily at 5:33 | |
- cron: "33 5 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- uses: pre-commit/[email protected] | |
list: | |
runs-on: ubuntu-latest | |
outputs: | |
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up nox | |
uses: wntrblm/[email protected] | |
- id: noxenvs-matrix | |
run: | | |
echo >>$GITHUB_OUTPUT noxenvs=$( | |
nox --list-sessions --json | jq '[.[].session]' | |
) | |
test: | |
needs: list | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev | |
if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs') | |
- name: Install dependencies | |
run: brew install enchant | |
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs') | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Set up nox | |
uses: wntrblm/[email protected] | |
- name: Run nox | |
run: nox -s "${{ matrix.noxenv }}" | |
linux: | |
needs: 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.x" | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --interpreter '3.8 3.9 3.10 3.11 pypy3.8 pypy3.9' | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
windows: | |
needs: test | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
target: [x64, x86] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
architecture: ${{ matrix.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --sdist | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
macos: | |
needs: test | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [linux, windows, macos] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.pypi_password }} | |
with: | |
command: upload | |
args: --skip-existing * | |
- name: Create a GitHub Release | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
* | |
generate_release_notes: true |