Skip to content

Release Polyglot Piranha #89

Release Polyglot Piranha

Release Polyglot Piranha #89

name: Release Polyglot Piranha
on:
workflow_dispatch:
jobs:
release:
strategy:
matrix:
target: [linux-x86, linux-arm, macos-arm]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ${{ fromJSON('{"linux-x86":"ubuntu-20.04","linux-arm":"ubuntu-latest","macos-arm":"macos-latest"}')[matrix.target] }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: pip install --upgrade maturin
run: |
pip install --upgrade maturin
- name: Setup rustup target linux aarch64
if: ${{ matrix.target == 'linux-arm' }}
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
mkdir -p .cargo
touch .cargo/config.toml
echo "[target.aarch64-unknown-linux-gnu]" >> .cargo/config.toml
echo "linker = \"aarch64-linux-gnu-gcc\"" >> .cargo/config.toml
- name: Setup rustup target macOS
if: ${{ matrix.target == 'macos-arm' }}
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Build wheel with Maturin linux x86
if: ${{ matrix.target == 'linux-x86' }}
run: |
maturin build --release -o dist -i $ {{ matrix.python-version }}
- name: Build wheel with Maturin linux arm
if: ${{ matrix.target == 'linux-arm' }}
run: |
maturin build --release -o dist --target aarch64-unknown-linux-gnu -i ${{ matrix.python-version }}
- name: Build wheel with Maturin macOS
if: ${{ matrix.target == 'macos-arm' }}
run: |
maturin build --release -o dist --target universal2-apple-darwin -i ${{ matrix.python-version }}
- name: Build source distribution
if: ${{ matrix.target == 'linux-x86' }}
run: |
maturin build --sdist -o dist
- name: Pypi Release
run: |
pip install twine
twine upload --repository testpypi --skip-existing -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }} dist/*