Skip to content

workflows: migrate canonical cibuildwheel builds #20

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #20

Workflow file for this run

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `linux` job of
# https://github.com/visioncortex/vtracer/blob/0.6.15/.github/workflows/python.yml
name: Build vtracer wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/vtracer.yaml not released yet'
required: false
default: ''
cancel-in-progress:
description: Cancel an in-progress run in the same concurrency group.
required: false
type: boolean
default: true
pull_request:
branches: [main]
paths:
- '.github/workflows/build-vtracer.yml'
- 'docs/packages/vtracer.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-vtracer.yml'
- 'docs/packages/vtracer.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ case(github.event_name == 'pull_request', true, github.event_name == 'workflow_dispatch', inputs['cancel-in-progress'], false) }}
permissions:
contents: read # to fetch code (actions/checkout)
env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: vtracer
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build vtracer ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.setup.outputs.matrix) }}
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "vtracer"
version: "${{ matrix.version }}"
repository: "visioncortex/vtracer"
ref: "${{ matrix.version }}"
artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64"
cibw-package-dir: "cmdapp"
cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64"
# vtracer's pyproject.toml carries no [tool.cibuildwheel], so the
# Rust toolchain its maturin backend needs is installed in-container
# here.
cibw-before-all-linux: >
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
cibw-environment-linux: "PATH=\"$PATH:$HOME/.cargo/bin\""
# Upstream ships no Python test suite at all. Exercise the
# extension for real instead: convert a small two-colour raster to
# SVG and check it actually traced a path, not just the README's
# bare import.
cibw-test-command: >
python -c "import vtracer.vtracer as ext, vtracer;
assert ext.__file__.endswith('.so'), ext.__file__;
w, h = 10, 10;
pixels = [(255, 0, 0, 255) if x < w // 2 else (0, 0, 255, 255) for y in range(h) for x in range(w)];
svg = vtracer.convert_pixels_to_svg(pixels, (w, h));
assert isinstance(svg, str) and '<svg' in svg and '<path' in svg, svg
"
publish:
name: Publish vtracer ${{ matrix.version }}
needs: [setup, build_wheels]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
matrix: ${{ needs.setup.outputs.matrix }}
artifact-pattern: vtracer-${{ matrix.version }}-*-manylinux_riscv64