Skip to content

Replace Rocket with Axum. (#58) #32

Replace Rocket with Axum. (#58)

Replace Rocket with Axum. (#58) #32

Workflow file for this run

on:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
branches: [ main ]
name: Build, Test and Publish Python Bindings
jobs:
test:
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python tooling
run: |
python -m pip install hatch
- name: Run Python tests
run: |
hatch run test
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: |
python -m pip install build
- name: Build source distribution
run: |
python -m build --sdist
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: python-artifacts
path: dist
build-wheels:
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, target: 'x86_64'}
- {os: ubuntu-latest, target: 'x86'}
- {os: ubuntu-latest, target: 'aarch64'}
- {os: windows-latest, target: 'x64'}
- {os: windows-latest, target: 'x86'}
- {os: macos-latest, target: 'x86_64'}
- {os: macos-latest, target: 'aarch64'}
runs-on: ${{ matrix.config.os }}
name: Build wheels for ${{ matrix.config.os }} (${{ matrix.config.target }})
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
if: matrix.config.os == 'windows-latest'
with:
python-version: "3.x"
architecture: ${{ matrix.config.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.config.target }}
args: --release --out dist
manylinux: manylinux2014
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: python-artifacts
path: dist
# This assumes a PyPI Trusted Publisher has been configure for the `outpack_query_parser` package.
# See https://docs.pypi.org/trusted-publishers/ for more details.
publish-to-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Publish Python distribution to PyPI
needs:
- build-sdist
- build-wheels
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/outpack_query_parser
permissions:
# This permission is needed for the workflow to authenticate against PyPI
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-artifacts
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1