Skip to content

workflows: migrate canonical cibuildwheel builds #187

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #187

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `linux` job of
# https://github.com/Stranger6667/css-inline/blob/python-v0.21.2/.github/workflows/python-release.yml
name: Build css-inline wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/css-inline.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-css-inline.yml'
- 'docs/packages/css-inline.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-css-inline.yml'
- 'docs/packages/css-inline.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: css-inline
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build css-inline ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
include:
# pyo3's abi3-py310 feature is on unconditionally (crates/css-inline-python/Cargo.toml),
# so one abi3 wheel serves every interpreter it claims. Upstream publishes no
# free-threaded (cp314t) wheel at all, so there is no second job here.
- tag: cp310-abi3
# Built on cp310 -- the oldest interpreter the abi3 tag claims --
# and re-tested on the newer ones via find_compatible_wheel.
build: >-
cp310-manylinux_riscv64 cp311-manylinux_riscv64
cp312-manylinux_riscv64 cp313-manylinux_riscv64
cp314-manylinux_riscv64
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "css-inline"
version: "${{ matrix.version }}"
repository: "Stranger6667/css-inline"
ref: "python-v${{ matrix.version }}"
artifact-tag: "${{ matrix.tag }}-manylinux_riscv64"
timeout-minutes: 300
cibw-package-dir: "crates/css-inline-python"
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
cibw-build: "${{ matrix.build }}"
# crates/css-inline-python ships 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\""
cibw-test-requires: "pytest hypothesis"
# crates/css-inline/tests carries the background test server and the
# fixture that crates/css-inline-python/tests-py reaches through a relative
# "../css-inline/tests/..." href, so both trees are staged
# together, preserving their layout from the checkout.
cibw-test-sources: >
crates/css-inline-python/tests-py crates/css-inline-python/pyproject.toml
crates/css-inline/tests
# Upstream's own CI backgrounds this same server ahead of every
# Python/Rust/Ruby test job (crates/css-inline/tests/server.py) to serve
# tests-py's remote-stylesheet cases from 127.0.0.1:1234.
# css_inline/__init__.py is a pure-Python re-export shim; the compiled
# extension is the css_inline.css_inline submodule (gotcha 56).
cibw-test-command: >
python crates/css-inline/tests/server.py >/dev/null 2>&1 &
for _ in $(seq 1 20); do
python -c "import socket; socket.create_connection(('127.0.0.1', 1234), timeout=0.2).close()" 2>/dev/null && break;
sleep 0.1;
done &&
python -c "import css_inline.css_inline as m; assert m.__file__.endswith('.so'), m.__file__" &&
cd crates/css-inline-python &&
python -m pytest -v tests-py
publish:
name: Publish css-inline ${{ 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: css-inline-${{ matrix.version }}-*-manylinux_riscv64