Skip to content

Refactor explicit dataflow setup tables #542

Refactor explicit dataflow setup tables

Refactor explicit dataflow setup tables #542

Workflow file for this run

name: Release
on:
pull_request:
workflow_dispatch:
push:
tags:
- "v*"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
permissions:
actions: read
contents: read
jobs:
build:
name: Build wheel (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
os: ubuntu-24.04
zig-target: x86_64-linux-gnu
- name: windows-x86_64
os: windows-2025
zig-target: x86_64-windows-gnu
- name: macos-arm64
os: macos-15
zig-target: aarch64-macos
- name: macos-x86_64
os: macos-15-intel
zig-target: x86_64-macos
steps:
- name: Check out source
uses: actions/checkout@v6
- name: Set up Zig
shell: bash
run: |
if command -v python3 >/dev/null 2>&1; then
python3 scripts/ci/install-zig.py 0.15.2
else
python scripts/ci/install-zig.py 0.15.2
fi
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Build wheel
shell: bash
env:
ZDISAMAR_BUILD_PYTHON: "3.11"
ZDISAMAR_ZIG_TARGET: ${{ matrix.zig-target }}
ZDISAMAR_ZIG_OPTIMIZE: ReleaseFast
run: ./scripts/build-wheel.sh dist
- name: Repair Linux wheel
if: runner.os == 'Linux'
shell: bash
run: |
mkdir -p wheelhouse
uvx --with patchelf auditwheel repair dist/*.whl -w wheelhouse
rm dist/*.whl
mv wheelhouse/*.whl dist/
- name: Check wheel metadata
shell: bash
run: uvx twine check dist/*.whl
- name: Upload wheel artifact
uses: actions/upload-artifact@v7
with:
name: wheel-${{ matrix.name }}
path: dist/*.whl
if-no-files-found: error
smoke:
name: Smoke wheel (Python ${{ matrix.python-version }})
needs: build
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- name: Check out source
uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Download Linux wheel
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p dist
artifact_id="$(
gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts" \
--jq '.artifacts[] | select(.name == "wheel-linux-x86_64") | .id'
)"
test -n "${artifact_id}"
gh api "repos/${GITHUB_REPOSITORY}/actions/artifacts/${artifact_id}/zip" > wheel.zip
unzip -q wheel.zip -d dist
- name: Install and smoke test
shell: bash
run: |
smoke_venv="$(mktemp -d /tmp/zdisamar-smoke-${{ matrix.python-version }}.XXXXXX)"
uv venv --python "${{ matrix.python-version }}" "${smoke_venv}/venv"
uv pip install --python "${smoke_venv}/venv/bin/python" dist/*.whl
cd /tmp
"${smoke_venv}/venv/bin/python" \
"${GITHUB_WORKSPACE}/tests/python/wheel_install_smoke_test.py" \
--forbid-path "${GITHUB_WORKSPACE}"
publish:
name: Publish to PyPI
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
needs:
- build
- smoke
runs-on: ubuntu-latest
environment: pypi
permissions:
actions: read
contents: read
id-token: write
steps:
- name: Download wheels
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p artifacts dist
gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts" \
--paginate \
--jq '.artifacts[] | select(.name | startswith("wheel-")) | [.id, .name] | @tsv' \
> artifacts/wheels.tsv
test -s artifacts/wheels.tsv
while IFS="$(printf '\t')" read -r artifact_id name; do
gh api "repos/${GITHUB_REPOSITORY}/actions/artifacts/${artifact_id}/zip" \
> "artifacts/${name}.zip"
unzip -q "artifacts/${name}.zip" -d dist
done < artifacts/wheels.tsv
- name: List distributions
run: ls -lh dist
- name: Publish distributions
uses: pypa/gh-action-pypi-publish@release/v1