Add endpoint to run git fetch on outpack root #52
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: | |
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 --features openssl-vendored | |
manylinux: manylinux2014 | |
before-script-linux: | | |
# If we're running on RHEL centos, install needed packages. | |
if command -v yum &> /dev/null; then | |
yum update -y && yum install -y perl-core libatomic | |
# If we're running on i686 we need to symlink libatomic | |
# in order to build openssl with -latomic flag. | |
if [[ ! -d "/usr/lib64" ]]; then | |
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so | |
fi | |
fi | |
- 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 |