Skip to content

0.22.2

0.22.2 #310

Workflow file for this run

name: PyO3
env:
PACKAGE_NAME: ast_grep_py # note: maturin package name only accepts underscore
PYTHON_VERSION: "3.8" # to build abi3 wheels
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
defaults:
run:
working-directory: ./crates/pyo3
on:
workflow_dispatch:
inputs:
need_release:
description: "Select this for publish. If not selected, it will be a dry run (no uploads)."
type: boolean
push:
tags:
- "[0-9]+.*"
schedule:
# run pypi every day 9 am
- cron: '0 9 * * *'
permissions:
contents: read
jobs:
linux:
runs-on: ubuntu-20.04
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
CFLAGS: "-std=c11"
CXXFLAGS: "-std=c++11"
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist --find-interpreter
working-directory: crates/pyo3
- name: Test sdist
# GH action only has x86 runner
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
pip install pytest
pip install --no-index --find-links=dist ${{env.PACKAGE_NAME}} --force-reinstall
pytest
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: crates/pyo3/dist
windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
working-directory: crates/pyo3
- name: Test sdist
run: |
pip install pytest
pip install --no-index --find-links=dist ${{env.PACKAGE_NAME}} --force-reinstall
pytest
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: crates/pyo3/dist
macos:
# use old macos due to https://github.com/actions/setup-python/issues/852
runs-on: macos-13
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
# old llvm does not support libc++ by default
CXXFLAGS: "-stdlib=libc++"
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
working-directory: crates/pyo3
- name: Test sdist
if: matrix.target == 'x86_64'
run: |
pip install pytest
pip install --no-index --find-links=dist ${{env.PACKAGE_NAME}} --force-reinstall
pytest
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: crates/pyo3/dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
working-directory: crates/pyo3
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: crates/pyo3/dist
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.event.ref, 'refs/tags') || inputs.need_release"
permissions:
# For pypi trusted publishing
id-token: write
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
command: upload
args: --skip-existing *
# note, release does not need working-directory
# because artifacts are stored under the root dir
# and it does not involve pyproject.toml