Skip to content

Support file paths in CLI positional argument #90

Support file paths in CLI positional argument

Support file paths in CLI positional argument #90

name: Python builds
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
branches:
- main
- master
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64
- x86
- aarch64
- armv7
# - s390x
- ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Calculate openssl-vendored
shell: bash
id: is-openssl-vendored
run: |
if [[ "${{ startsWith(matrix.target, 'x86') }}" == "true" ]]; then
echo "enabled=" >> $GITHUB_OUTPUT
else
echo "enabled=--features openssl-vendored" >> $GITHUB_OUTPUT
fi
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --manifest-path cpp-linter-py/Cargo.toml --release --out dist --find-interpreter ${{ steps.is-openssl-vendored.outputs.enabled }}
manylinux: auto
before-script-linux: |
case "${{ matrix.target }}" in
"aarch64" | "armv7" | "s390x" | "ppc64le")
# NOTE: pypa/manylinux docker images are Debian based
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
;;
"x86" | "x86_64")
# NOTE: rust-cross/manylinux docker images are CentOS based
yum update -y
yum install -y openssl openssl-devel
;;
esac
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: dist/*
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
architecture: ${{ matrix.target }}
- name: Increment version
if: startsWith(github.ref, 'refs/tags/')
run: python .github/workflows/replace_version_spec.py --new-version=${{ github.ref_name }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --manifest-path cpp-linter-py/Cargo.toml --release --out dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: dist/*
macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Increment version
if: startsWith(github.ref, 'refs/tags/')
run: python .github/workflows/replace_version_spec.py --new-version=${{ github.ref_name }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --manifest-path cpp-linter-py/Cargo.toml --release --out dist --find-interpreter --features openssl-vendored
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: dist/*
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --manifest-path cpp-linter-py/Cargo.toml --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist/*
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- run: mv dist/**/*.{whl,gz} dist/
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing dist/*