CI: Try publishing to crates.io #61
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: | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
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.11" | |
- 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: dist | |
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: dist | |
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: dist | |
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: dist | |
release: | |
name: Release to PyPI and crates.io | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: [linux, windows, macos, sdist] | |
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 }} | |
lint_and_docs: | |
# From https://squidfunk.github.io/mkdocs-material/publishing-your-site/ | |
name: Lint python, build docs and publish to gh-pages | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
needs: [linux, windows, macos, sdist] | |
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 and publish docs | |
run: pdm run mkdocs gh-deploy --force | |
- name: Lint | |
run: | | |
pdm run ruff . | |
pdm run black --check . |