Adding qemu for cross-architecture python linux builds #58
Workflow file for this run
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
# This file is autogenerated by maturin v0.15.3 | |
# To update, run | |
# | |
# maturin generate-ci github | |
# | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
do_release: | |
description: "Release to PyPI and crates.io" | |
required: false | |
default: "false" | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
name: Build wheels for Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64, x86, aarch64, armv7] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: "true" | |
manylinux: auto | |
working-directory: ./python | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: python/dist | |
windows: | |
name: Build wheels for Windows | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
target: [x64, x86] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
architecture: ${{ matrix.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: "true" | |
working-directory: ./python | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: python/dist | |
macos: | |
name: Build wheels for 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.11" | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: "true" | |
working-directory: ./python | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: python/dist | |
sdist: | |
name: Build python sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
working-directory: ./python | |
- name: Upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: python/dist | |
release: | |
name: Release to PyPI and crates.io | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || github.event.inputs.do_release == 'true' | |
needs: [linux, windows, macos, sdist, lint, docs] | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
# See https://docs.pypi.org/trusted-publishers/using-a-publisher/ | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: wheels/ | |
verbose: true | |
print-hash: true | |
- name: Publish to crates.io | |
run: cargo publish --package feco3 --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
docs: | |
# From https://squidfunk.github.io/mkdocs-material/publishing-your-site/ | |
name: Build docs, publish to gh-pages on push. | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
defaults: | |
run: | |
working-directory: | |
python | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- name: Install pdm, setup environment | |
run: | | |
pip install pdm | |
pdm install -d | |
- name: Build docs | |
run: pdm run mkdocs build | |
- name: Publish docs | |
if: github.event_name == 'push' | |
run: pdm run mkdocs gh-deploy --force | |
lint: | |
name: Lint python | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: | |
python | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install pdm, setup environment | |
run: | | |
pip install pdm | |
pdm install -d | |
- name: Lint | |
run: | | |
pdm run ruff . | |
pdm run black --check . |