PyPECOS #9
Workflow file for this run
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: PyPECOS-rslib | |
on: | |
push: | |
branches: | |
- master | |
- development | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
- development | |
permissions: | |
contents: read | |
jobs: | |
linux-pypecos-rslib: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11', '3.12'] | |
target: [x86_64, x86, aarch64] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup pre-commit | |
run: | | |
python -m pip install pre-commit | |
pre-commit install | |
- name: Run pre-commit on all files | |
run: pre-commit run --all-files | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --manifest-path ./python/pypecos-rslib/Cargo.toml | |
sccache: 'true' | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.python-version }}-${{ matrix.target }} | |
path: dist | |
- name: pytest | |
if: ${{ startsWith(matrix.target, 'x86_64') }} | |
shell: bash | |
run: | | |
pip install --upgrade pip setuptools | |
pip install pytest-cov | |
set -e | |
PYTHON_VER=$(python -c "import sys; print(''.join(map(str, sys.version_info[:2])))") | |
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER}-*.whl) | |
pip install "${WHEEL_FILE}" --force-reinstall | |
pip install pytest | |
cd ./python/pypecos-rslib && pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html | |
- name: pytest aarch64 | |
if: ${{ !startsWith(matrix.target, 'x86') && !startsWith(matrix.target, 'ppc64')}} | |
uses: uraimo/[email protected] | |
with: | |
arch: ${{ matrix.target }} | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
install: | | |
apt-get update | |
apt-get install -y --no-install-recommends build-essential python3 python3-pip cmake | |
pip3 install -U pip pytest setuptools | |
run: | | |
pip3 install --upgrade pip setuptools | |
pip3 install pytest-cov | |
set -e | |
PYTHON_VER=$(python3 -c "import sys; print(''.join(map(str, sys.version_info[:2])))") | |
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER}-*.whl) | |
pip3 install "${WHEEL_FILE}" --force-reinstall --only-binary :all: | |
cd ./python/pypecos-rslib && python3 -m pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html | |
windows-pypecos-rslib: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11', '3.12'] | |
target: [x64, | |
# x86 | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.target }} | |
- name: Setup pre-commit | |
run: | | |
python -m pip install pre-commit | |
pre-commit install | |
- name: Run pre-commit on all files | |
run: pre-commit run --all-files | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --manifest-path ./python/pypecos-rslib/Cargo.toml | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-windows-${{ matrix.python-version }}-${{ matrix.target }} | |
path: dist | |
- name: pytest | |
if: ${{ !startsWith(matrix.target, 'aarch64') }} | |
shell: bash | |
run: | | |
pip install --upgrade pip setuptools | |
pip install pytest-cov | |
set -e | |
PYTHON_VER=$(python -c "import sys; print(''.join(map(str, sys.version_info[:2])))") | |
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER}-*.whl) | |
pip install "${WHEEL_FILE}" --force-reinstall | |
pip install pytest | |
cd ./python/pypecos-rslib && pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html | |
macos-pypecos-rslib: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11', '3.12'] | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup pre-commit | |
run: | | |
python -m pip install pre-commit | |
pre-commit install | |
- name: Run pre-commit on all files | |
run: pre-commit run --all-files | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --manifest-path ./python/pypecos-rslib/Cargo.toml | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-${{ matrix.python-version }}-${{ matrix.target }} | |
path: dist | |
- name: pytest | |
if: ${{ !startsWith(matrix.target, 'aarch64') }} | |
shell: bash | |
run: | | |
pip install --upgrade pip setuptools | |
pip install pytest-cov | |
set -e | |
PYTHON_VER=$(python -c "import sys; print(''.join(map(str, sys.version_info[:2])))") | |
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER}-*.whl) | |
pip install "${WHEEL_FILE}" --force-reinstall | |
pip install pytest | |
cd ./python/pypecos-rslib && pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html | |
sdist-pypecos-rslib: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Setup pre-commit | |
run: | | |
python -m pip install pre-commit | |
pre-commit install | |
- name: Run pre-commit on all files | |
run: pre-commit run --all-files | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist --manifest-path ./python/pypecos-rslib/Cargo.toml | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: dist | |
# pypecos building/testing (Pure Python) | |
build-pypecos: | |
needs: [ | |
linux-pypecos-rslib, | |
windows-pypecos-rslib, | |
macos-pypecos-rslib, | |
sdist-pypecos-rslib | |
] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macOS-latest ] | |
python-version: [ "3.10", "3.11", "3.12" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
pip install -r python/pypecos/requirements.txt | |
- name: Pre-commit checks | |
run: | | |
python -m pip install pre-commit | |
pre-commit run --all-files | |
- name: Test with pytest | |
run: | | |
pip install pytest-cov | |
pip install ./python/pypecos | |
pytest ./python/pypecos/tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html | |
- name: Test optional dependencies with pytest | |
run: | | |
pip install pytest-cov | |
pip install ./python/pypecos[all] | |
pytest ./python/pypecos/tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html -m optional_dependency | |
sdist-pypecos: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Setup pre-commit | |
run: | | |
python -m pip install pre-commit | |
pre-commit install | |
- name: Run pre-commit on all files | |
run: pre-commit run --all-files | |
- name: Build sdist and wheel | |
run: | | |
python -m pip install -U build wheel | |
python -m build --sdist --wheel --outdir dist python/pypecos/ | |
- name: Upload sdist and wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypecos-distributions | |
path: dist/* | |
release-pypecos-rslib: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [linux-pypecos-rslib, windows-pypecos-rslib, macos-pypecos-rslib, sdist-pypecos-rslib] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheels | |
- 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 * | |
release-pypecos: | |
name: Release PyPECOS | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [ build-pypecos, sdist-pypecos ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypecos-distributions | |
- name: Publish to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: ./dist |