Skip to content

workflows: migrate canonical cibuildwheel builds #126

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #126

Workflow file for this run

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Upstream cuts releases without ever pushing a git tag (gotcha 103): this is
# the "Bump minor version to 0.10.0" commit, whose tree is byte-identical to
# the 0.10.0 PyPI sdist (Cargo.toml differs only by the `readme = "README.md"`
# line maturin's own sdist builder injects). Based on upstream's own wheel
# builder at that commit:
# https://github.com/marcelroed/gigatoken/blob/34a1599f0c0ae7d7cd0d1c530e6522320158b360/.github/workflows/wheels.yml
name: Build gigatoken wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/gigatoken.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-gigatoken.yml'
- 'docs/packages/gigatoken.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-gigatoken.yml'
- 'docs/packages/gigatoken.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:
GIGATOKEN_REF: 34a1599f0c0ae7d7cd0d1c530e6522320158b360
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: gigatoken
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build gigatoken ${{ matrix.version }} cp310-abi3-manylinux_riscv64
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "gigatoken"
version: "${{ matrix.version }}"
repository: "marcelroed/gigatoken"
ref: "34a1599f0c0ae7d7cd0d1c530e6522320158b360"
artifact-tag: "cp310-abi3-manylinux_riscv64"
timeout-minutes: 1440
# pyo3 carries an explicit `abi3-py310` feature (Cargo.toml), so
# maturin always tags the wheel cp310-abi3 regardless of which
# interpreter compiles it - matching the one Linux wheel upstream
# publishes per arch (verified locally: a maturin build under
# CPython 3.11 still emits cp310-abi3). numpy and awkward-cpp have
# no riscv64 wheel below cp312 (PyPI or this registry), so cp312 is
# built and cp313/cp314 reuse+retest that wheel (find_compatible_wheel).
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
cibw-build: "cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64"
# gigatoken's `#![feature(portable_simd)]` (src/lib.rs) needs nightly.
# Pinned to the exact date validated locally (cargo build+link for
# riscv64gc-unknown-linux-gnu succeeded end to end under it) rather
# than floating the bare "nightly" channel rust-toolchain.toml
# requests, which is unbounded build-tool drift (gotcha 59).
cibw-before-all-linux: >
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
sh -s -- -y --profile minimal --default-toolchain nightly-2026-10-14
cibw-environment-linux: "PATH=\"$PATH:$HOME/.cargo/bin\" RUSTUP_TOOLCHAIN=nightly-2026-10-14"
# Force wheels-only in the test phase (gotcha 12) so the runtime
# closure (numpy, awkward, awkward-cpp, typer) must resolve as
# riscv64 wheels. awkward's latest release (2.14.0) pins
# awkward-cpp==57, not yet published for riscv64 on this registry;
# 2.13.0 is the newest release pinning the already-published
# awkward-cpp==56, so pre-install it before cibuildwheel's own wheel
# install resolves gigatoken's ">=2.6.3" constraint against it.
cibw-test-environment: "PIP_ONLY_BINARY=:all:"
cibw-before-test: >
pip install --only-binary=:all:
--extra-index-url https://pypi.riseproject.dev/simple/ 'awkward==2.13.0'
# Mirrors upstream's own test-wheels smoke test (wheels.yml).
cibw-test-command: >
python -c "import gigatoken;
tokens = list(gigatoken.pretokenizer(b'Hello, world!'));
assert b''.join(tokens) == b'Hello, world!', tokens;
print('gigatoken OK:', tokens)"
publish:
name: Publish gigatoken ${{ 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: gigatoken-${{ matrix.version }}-*-manylinux_riscv64