Skip to content

Build and Test

Build and Test #647

Workflow file for this run

name: Build and Test
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Set an environment variables for the workflow
env:
UV_HTTP_TIMEOUT: 300
PIP_DISABLE_PIP_VERSION_CHECK: 1
# Define the jobs that run in the workflow
jobs:
# Define the tests job that runs on ubuntu-latest across multiple python versions
sdist-n-tests:
strategy:
fail-fast: true
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
name: sdist and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install rye and uv
run: |
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.rye/env" >> $GITHUB_PATH
echo "$HOME/.rye/shims" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash
- name: Setup rye
run: |
rye config --set-bool behavior.use-uv=true
rye --version
shell: bash
- name: Sync dependencies using rye
run: |
rye pin ${{ matrix.python-versions }}
rye sync
shell: bash
# required for tox testing on mike
- name: Setup doc deploy git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
shell: bash
- name: Run tox
run: |
rye pin ${{ matrix.python-versions }}
rye run tox -e test,lint,doc
# Build and upload the sdist, wheels will be done on arch specific images
- name: Build sdist
run: rye build --sdist
shell: bash
- name: Integration test artifact
run: |
ls -l dist
rm -rf .venv
for pkg in dist/*; do
uv venv
uv pip install $pkg pytest pytest-random-order --force-reinstall
.venv/bin/pytest -v py_integ
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
shell: bash
- name: Upload sdist
if: matrix.python-versions == '3.9'
uses: actions/upload-artifact@v4
with:
name: artifacts-sdist-${{ matrix.python-versions }}
path: dist/*.tar.gz
# Define the manylinux maturin builds, across multiple python versions, these will run in appropriate arch images
linux-x86:
#needs: tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
platform:
- target: "x86_64-unknown-linux-gnu"
# - target: "i686-unknown-linux-gnu"
#- target: "aarch64-unknown-linux-gnu"
#- target: "armv7-unknown-linux-gnueabihf"
#- target: "powerpc64le-unknown-linux-gnu"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}
- run: pip install uv
- name: Build Wheels - manylinux
uses: PyO3/maturin-action@main
with:
target: ${{ matrix.platform.target }}
manylinux: auto
args: --release --locked -j $(nproc) -i python${{ matrix.python-versions }} --out dist
sccache: 'true'
before-script-linux: |
yum install -y openssl-devel
env:
OPENSSL_DIR: /etc/pki/tls
OPENSSL_LIB_DIR: /lib64
- name: Integration test artifact
run: |
for pkg in dist/*; do
uv venv .integ
VIRTUAL_ENV=.integ uv pip install $pkg pytest pytest-random-order --force-reinstall
.integ/bin/pytest -v py_integ
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
shell: bash
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-manylinux-${{ matrix.platform.target }}-${{ matrix.python-versions }}
path: dist
linux-arm:
#needs: tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
platform:
- target: "aarch64-unknown-linux-gnu"
arch: aarch64
- target: "armv7-unknown-linux-gnueabihf"
arch: armv7
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}
- run: pip install uv
- name: Build Wheels
uses: PyO3/maturin-action@main
with:
target: ${{ matrix.platform.target }}
manylinux: "auto"
args: --release --locked -j $(nproc) -i python${{ matrix.python-versions }} --out dist
sccache: 'true'
before-script-linux: |
yum install -y openssl-devel
- uses: uraimo/run-on-arch-action@v2
if: matrix.target == 'aarch64-unknown-linux-gnu'
name: Integration test artifact
with:
arch: ${{ matrix.platform.arch }}
distro: 'ubuntu22.04'
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y software-properties-common build-essential
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
apt-get install -y --no-install-recommends curl python${{ matrix.python-versions }} python${{ matrix.python-versions }}-venv python${{ matrix.python-versions }}-dev
curl -LsSf https://astral.sh/uv/install.sh | sh
run: |
ls -l $HOME
ls -l $HOME/.cargo/bin
ls -l dist
for pkg in dist/*; do
echo "Installing $pkg"
$HOME/.cargo/bin/uv venv .integ -p ${{ matrix.python-versions}}
VIRTUAL_ENV=.integ $HOME/.cargo/bin/uv pip install $pkg pytest pytest-random-order --force-reinstall
.integ/bin/python3 -m fusion --help
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-manylinux-${{ matrix.platform.target }}-${{ matrix.python-versions }}
path: dist
linux-s390x:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
platform:
- target: s390x-unknown-linux-gnu
arch: s390x
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}
- run: pip install uv
- name: Build Wheels
uses: PyO3/maturin-action@main
with:
target: ${{ matrix.platform.target }}
manylinux: "auto"
args: --release --locked -j $(nproc) -i python${{ matrix.python-versions }} --out dist
sccache: 'true'
before-script-linux: |
yum install -y openssl-devel
- uses: uraimo/run-on-arch-action@v2
if: false
name: Integration test artifact
with:
arch: ${{ matrix.platform.arch }}
distro: 'ubuntu22.04'
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y software-properties-common build-essential
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
apt-get install -y --no-install-recommends curl python${{ matrix.python-versions }} python${{ matrix.python-versions }}-venv python${{ matrix.python-versions }}-dev
curl -LsSf https://astral.sh/uv/install.sh | sh
run: |
ls -l $HOME
ls -l $HOME/.cargo/bin
ls -l dist
for pkg in dist/*; do
echo "Installing $pkg"
$HOME/.cargo/bin/uv venv .integ -p ${{ matrix.python-versions}}
VIRTUAL_ENV=.integ $HOME/.cargo/bin/uv pip install $pkg pytest pytest-random-order --force-reinstall
.integ/bin/python3 -m fusion --help
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-manylinux-${{ matrix.platform.target }}-${{ matrix.python-versions }}
path: dist
linux-powerpc:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
platform:
- target: powerpc64le-unknown-linux-gnu
arch: ppc64le
- target: powerpc64-unknown-linux-gnu
arch: ppc64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}
- run: pip install uv
- name: Build Wheels
uses: PyO3/maturin-action@main
with:
target: ${{ matrix.platform.target }}
manylinux: "auto"
args: --release --locked -j $(nproc) -i python${{ matrix.python-versions }} --out dist
sccache: 'true'
before-script-linux: |
yum install -y openssl-devel
- uses: uraimo/run-on-arch-action@v2
if: false
name: Integration test artifact
with:
arch: ${{ matrix.platform.arch }}
distro: 'ubuntu22.04'
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y software-properties-common build-essential
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
apt-get install -y --no-install-recommends curl python${{ matrix.python-versions }} python${{ matrix.python-versions }}-venv python${{ matrix.python-versions }}-dev
curl -LsSf https://astral.sh/uv/install.sh | sh
run: |
ls -l $HOME
ls -l $HOME/.cargo/bin
ls -l dist
for pkg in dist/*; do
echo "Installing $pkg"
$HOME/.cargo/bin/uv venv .integ -p ${{ matrix.python-versions}}
VIRTUAL_ENV=.integ $HOME/.cargo/bin/uv pip install $pkg pytest pytest-random-order --force-reinstall
.integ/bin/python3 -m fusion --help
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-manylinux-${{ matrix.platform.target }}-${{ matrix.python-versions }}
path: dist
# Define the musllinux maturin builds, across multiple python versions, these will run in appropriate arch images
linux-musllinux:
#needs: tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
target: [
"x86_64-unknown-linux-musl",
# "powerpc64le-unknown-linux-musl", # diasble powerpc64le until we decide to build via container quay.io/pypa/musllinux_1_1_ppc64le
]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: ${{ matrix.python-versions }}
- name: Install rye
run: |
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
echo "$HOME/.rye/env" >> $GITHUB_PATH
echo "$HOME/.rye/shims" >> $GITHUB_PATH
shell: bash
- name: Setup rye
run: |
rye config --set-bool behavior.use-uv=true
rye --version
shell: bash
- name: Sync dependencies using rye
run: |
rye pin ${{ matrix.python-versions }}
rye sync
- name: Build Wheels - musllinux
uses: PyO3/maturin-action@main
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_1
args: --release -j $(nproc) -i python${{ matrix.python-versions }} --out dist
sccache: 'false'
before-script-linux: |
yum install -y openssl-devel
- name: list dist files
run: |
ls -l dist
- name: Clear and list dist files
run: |
rm -f dist/*linux_x86_64.whl
ls -l dist
- name: Integration test artifact
if: false
uses: addnab/docker-run-action@v3
with:
image: alpine:3.12
options: -v ${{ github.workspace }}:/io -w /io -e FUSION_CLIENT_ID=${{ secrets.FUSION_CLIENT_ID }} -e FUSION_CLIENT_SECRET=${{ secrets.FUSION_CLIENT_SECRET }}
run: |
apk update
apk add python3 curl
curl -LsSf https://astral.sh/uv/install.sh | sh
ls -l dist
for pkg in dist/*; do
echo "Installing $pkg"
$HOME/.cargo/bin/uv venv .integ -p ${{ matrix.python-versions}}
VIRTUAL_ENV=.integ $HOME/.cargo/bin/uv pip install $pkg pytest pytest-random-order --force-reinstall
.integ/bin/python3 -m fusion --help
done
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-musllinux-${{ matrix.target }}-${{ matrix.python-versions }}
path: dist
# Define the windows maturin builds, across multiple python versions, these will run on windows-latest
windows:
#needs: tests
runs-on: windows-latest
strategy:
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
target: ["x64"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set install environment variables
run: |
$env:RYE_INSTALL_OPTION="--yes"
$env:RYE_TOOLCHAIN_VERSION = "${{ matrix.python-versions }}"
shell: pwsh
- name: Download Rye executable
run: |
Invoke-WebRequest -Uri "https://github.com/astral-sh/rye/releases/latest/download/rye-x86_64-windows.exe" -OutFile "$env:USERPROFILE\rye.exe"
Add-Content $env:GITHUB_PATH "$env:USERPROFILE"
shell: pwsh
- name: Download Rye executable
run: |
rye.exe config --set-bool behavior.use-uv=true
rye.exe --version
shell: pwsh
- name: Sync dependencies using Rye
run: |
rye.exe pin ${{ matrix.python-versions }}
rye.exe sync
shell: pwsh
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -j 10 -i ${{ matrix.python-versions }} --out dist
sccache: 'false'
- name: list dist files
run: ls -l dist
- name: Integration test artifact
if: true
run: |
Get-ChildItem dist -Filter *.whl | ForEach-Object {
rye.exe run uv venv .integ --seed
.\.integ\Scripts\pip.exe install $_.FullName pytest pytest-random-order --force-reinstall
.\.integ\Scripts\pytest.exe -v py_integ
}
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
shell: pwsh
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-win-${{ matrix.target }}-${{ matrix.python-versions }}
path: dist
# Define the macos x86 64 maturin builds, across multiple python versions, these will run on macos-12
macos-x86_64:
#needs: tests
runs-on: macos-12
strategy:
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
target: ["x86_64"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: ${{ matrix.python-versions }}
- name: Install rye
run: |
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
echo "$HOME/.rye/env" >> $GITHUB_PATH
echo "$HOME/.rye/shims" >> $GITHUB_PATH
shell: bash
- name: Setup rye
run: |
rye config --set-bool behavior.use-uv=true
rye --version
shell: bash
- name: Sync dependencies using rye
run: |
rye pin ${{ matrix.python-versions }}
rye sync
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -j 10 -i ${{ matrix.python-versions }} --out dist
sccache: 'false'
manylinux: auto
- name: list dist files
run: ls -l dist
- name: Integration test artifact
if: true
run: |
ls -l dist
for pkg in dist/*; do
rye run uv venv .integ --seed
.integ/bin/pip install $pkg pytest pytest-random-order --force-reinstall
.integ/bin/pytest -v py_integ
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
shell: bash
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-macos-${{ matrix.target }}-${{ matrix.python-versions }}
path: dist
# Define the macos aarch64 maturin builds, across multiple python versions, these will run on macos-14
macos-aarch64:
#needs: tests
runs-on: macos-14
strategy:
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12"]
target: ["aarch64"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: ${{ matrix.python-versions }}
- name: Set up rye
run: |
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
echo "$HOME/.rye/env" >> $GITHUB_PATH
echo "$HOME/.rye/shims" >> $GITHUB_PATH
shell: bash
- name: Add Rye to PATH
run: |
rye config --set-bool behavior.use-uv=true
rye --version
shell: bash
- name: Sync dependencies using rye
run: |
rye pin ${{ matrix.python-versions }}
rye sync
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -j 10 -i ${{ matrix.python-versions }} --out dist
sccache: 'false'
manylinux: auto
- name: list dist files
run: ls -l dist
- name: Integration test artifact
if: true
run: |
ls -l dist
for pkg in dist/*; do
rye run uv venv .integ --seed
.integ/bin/pip install $pkg pytest pytest-random-order --force-reinstall
.integ/bin/pytest -v py_integ
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
shell: bash
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: artifacts-macos-${{ matrix.target }}-${{ matrix.python-versions }}
path: dist
# Define the artifact check job that runs on ubuntu-latest
artifact-check:
needs: [sdist-n-tests, linux-x86, linux-arm, linux-powerpc, linux-s390x, linux-musllinux, windows, macos-x86_64, macos-aarch64]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: dist
merge-multiple: true
- name: list dist files
run: ls -l dist
- uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: "3.10"
- name: Install auditwheel-symbols
run: pip install auditwheel
- name: Check wheels
run: |
for wheel in dist/*manylinux*.whl; do
echo "Processing $wheel"
auditwheel show "$wheel"
done
shell: bash