.github/workflows/release.yml #18
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
on: | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
build-sdist: | |
name: build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
rust-toolchain: stable | |
- 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) || '' }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [linux, macos, windows] | |
target: [x86_64, aarch64] | |
manylinux: [auto] | |
include: | |
- os: linux | |
manylinux: auto | |
target: i686 | |
- os: linux | |
manylinux: auto | |
target: aarch64 | |
- os: linux | |
manylinux: auto | |
target: armv7 | |
- os: linux | |
manylinux: auto | |
target: ppc64le | |
- os: linux | |
manylinux: auto | |
target: s390x | |
- os: windows | |
target: i686 | |
python-architecture: x86 | |
exclude: | |
- os: windows | |
target: aarch64 | |
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
architecture: ${{ matrix.python-architecture || 'x64' }} | |
- run: pip install -U twine | |
- 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' }} | |
rust-toolchain: stable | |
docker-options: -e CI | |
- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/ | |
- run: twine check --strict dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi_files_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }} | |
path: dist | |
inspect-pypi-assets: | |
needs: [build, build-sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get dist artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: pypi_files_* | |
merge-multiple: true | |
path: dist | |
- name: list dist files | |
run: | | |
ls -lh dist/ | |
ls -l dist/ | |
echo "`ls dist | wc -l` files" | |
- name: extract and list sdist file | |
run: | | |
mkdir sdist-files | |
tar -xvf dist/*.tar.gz -C sdist-files | |
tree -a sdist-files | |
- name: extract and list wheel file | |
run: | | |
ls dist/*cp310-manylinux*x86_64.whl | head -n 1 | |
python -m zipfile --list `ls dist/*cp310-manylinux*x86_64.whl | head -n 1` | |
release: | |
needs: [build, build-sdist] | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- run: pip install -U twine | |
- name: check package version | |
run: python .github/check_version.py | |
- name: get dist 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_API_TOKEN }} | |
- name: get wasm dist artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: wasm_wheels | |
path: wasm | |
- name: upload to github release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
wasm/*.whl | |
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} |