let's forget java package idea #127
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
name: python | |
on: | |
push: | |
paths: | |
- 'matcher_py/src/**' | |
- 'matcher_rs/src/**' | |
- '.github/workflows/python.yml' | |
pull_request: | |
paths: | |
- 'matcher_py/src/**' | |
- 'matcher_rs/src/**' | |
- '.github/workflows/python.yml' | |
permissions: | |
contents: read | |
jobs: | |
linux: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
- runner: ubuntu-latest | |
target: aarch64 | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ matrix.python }}" | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
env: | |
RUSTFLAGS: "-Z threads=2 -D warnings" | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist -i python${{ matrix.python }} | |
sccache: 'true' | |
manylinux: auto | |
rust-toolchain: nightly | |
working-directory: matcher_py | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.python }} | |
path: matcher_py/dist | |
overwrite: true | |
musllinux: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
- runner: ubuntu-latest | |
target: aarch64 | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ matrix.python }}" | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
env: | |
RUSTFLAGS: "-Z threads=2 -D warnings" | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist -i python${{ matrix.python }} | |
sccache: 'true' | |
manylinux: musllinux_1_2 | |
rust-toolchain: nightly | |
working-directory: matcher_py | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-musllinux-${{ matrix.platform.target }}-${{ matrix.python }} | |
path: matcher_py/dist | |
overwrite: true | |
windows: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- runner: windows-latest | |
target: x64 | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ matrix.python }}" | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
env: | |
RUSTFLAGS: "-Z threads=2 -D warnings" | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist -i python${{ matrix.python }} | |
sccache: 'true' | |
rust-toolchain: nightly | |
working-directory: matcher_py | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-windows-${{ matrix.platform.target }}-${{ matrix.python }} | |
path: matcher_py/dist | |
overwrite: true | |
macos: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- runner: macos-12 | |
target: x86_64 | |
- runner: macos-14 | |
target: aarch64 | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ matrix.python }}" | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
env: | |
RUSTFLAGS: "-Z threads=2 -D warnings" | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist -i python${{ matrix.python }} | |
sccache: 'true' | |
rust-toolchain: nightly | |
working-directory: matcher_py | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-${{ matrix.platform.target }}-${{ matrix.python }} | |
path: matcher_py/dist | |
overwrite: true | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
rust-toolchain: nightly | |
working-directory: matcher_py | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: matcher_py/dist | |
overwrite: true | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [linux, musllinux, windows, macos, sdist] | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: wheels-* | |
merge-multiple: true | |
path: dist | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- run: pip install --upgrade pip twine | |
- name: Publish to pypi | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload --skip-existing dist/* |