Build and Test #537
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: 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 rye | |
run: | | |
curl -sSf https://rye-up.com/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 | |
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 | |
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 sdist | |
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' | |
- name: Integration test artifact | |
run: | | |
ls -l dist | |
for pkg in dist/*; do | |
uv venv .integ | |
source .integ/bin/activate | |
uv pip install $pkg pytest pytest-random-order --force-reinstall | |
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 | |
armv7_job: | |
# The host should always be Linux | |
runs-on: ubuntu-22.04 | |
name: Build on ubuntu-22.04 armv7 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Run commands | |
id: runcmd | |
with: | |
arch: armv7 | |
distro: ubuntu22.04 | |
# Not required, but speeds up builds by storing container images in | |
# a GitHub package registry. | |
githubToken: ${{ github.token }} | |
# Set an output parameter `uname` for use in subsequent steps | |
run: | | |
uname -a | |
echo ::set-output name=uname::$(uname -a) | |
- name: Get the output | |
# Echo the `uname` output parameter from the `runcmd` step | |
run: | | |
echo "The uname output was ${{ steps.runcmd.outputs.uname }}" | |
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 | |
- target: "armv7-unknown-linux-musleabihf" | |
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: ${{ matrix.platform.arch == 'aarch64' && '2_28' || 'auto' }} | |
args: --release --locked -j $(nproc) -i python${{ matrix.python-versions }} --out dist | |
sccache: 'true' | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Integration test artifact | |
with: | |
arch: ${{ matrix.platform.arch }} | |
distro: 'ubuntu22.04' | |
install: | | |
apt-get update | |
apt-get install -y --no-install-recommends python${{ matrix.python-versions }} | |
python3 -m pip install -U uv | |
run: | | |
ls -l dist | |
for pkg in dist/*; do | |
uv venv .integ | |
source .integ/bin/activate | |
uv pip install $pkg pytest pytest-random-order --force-reinstall | |
pytest -v py_integ | |
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", | |
"aarch64-unknown-linux-musl", | |
"armv7-unknown-linux-musleabihf", | |
# "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-up.com/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' | |
- 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 | |
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-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-up.com/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-up.com/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-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 | |