diff --git a/.github/workflows/benchmark-riscv64.yml b/.github/workflows/benchmark-riscv64.yml new file mode 100644 index 00000000..a9e2031b --- /dev/null +++ b/.github/workflows/benchmark-riscv64.yml @@ -0,0 +1,64 @@ +name: Benchmark riscv64 wheel build + +on: + workflow_dispatch: + +# Standalone riscv64-only wheel build for timing purposes. +# Bypasses the full CI pipeline (which requires a release to exist on the fork). +# Produces real build times on ubuntu-24.04-riscv (RISE native runner) for +# upstream discussion at jcrist/msgspec#987. + +permissions: + contents: read + +jobs: + sdist: + name: Build source distribution + runs-on: ubuntu-latest + outputs: + sdist-name: ${{ steps.build.outputs.sdist-name }} + steps: + - uses: actions/checkout@v5 + - uses: astral-sh/setup-uv@v7 + - name: Build sdist + id: build + run: | + uv build --sdist + sdist_name=$(basename dist/*.tar.gz) + echo "sdist-name=${sdist_name}" >> "$GITHUB_OUTPUT" + - uses: actions/upload-artifact@v5 + with: + name: artifact-sdist + path: dist/${{ steps.build.outputs.sdist-name }} + if-no-files-found: error + + build-riscv64: + name: Build wheels on ubuntu-24.04-riscv for riscv64 + needs: sdist + runs-on: ubuntu-24.04-riscv + env: + SDIST_NAME: ${{ needs.sdist.outputs.sdist-name }} + steps: + - uses: actions/checkout@v5 + - uses: astral-sh/setup-uv@v7 + - name: Download source distribution + uses: actions/download-artifact@v6 + with: + name: artifact-sdist + path: dist + - name: Build & Test Wheels (riscv64 native) + run: | + uvx cibuildwheel==3.2.1 \ + --config-file "$GITHUB_WORKSPACE/.cibuildwheel.toml" \ + --output-dir wheelhouse \ + "dist/${SDIST_NAME}" + env: + CIBW_ARCHS: riscv64 + # build[uv] from .cibuildwheel.toml requires uv inside the container, + # which is not pre-installed in the musllinux image. Override to pip. + CIBW_BUILD_FRONTEND: pip + - uses: actions/upload-artifact@v5 + with: + name: artifact-wheels-riscv64 + path: wheelhouse/*.whl + if-no-files-found: error diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index e0092df2..93653508 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -23,6 +23,8 @@ jobs: archs: aarch64 - os: ubuntu-latest archs: x86_64 + - os: ubuntu-24.04-riscv + archs: riscv64 - os: macos-latest archs: arm64 - os: macos-15-intel @@ -48,10 +50,23 @@ jobs: # TODO: Remove this once the action supports specifying extras, see: # https://github.com/pypa/cibuildwheel/pull/2630 - name: Install uv - if: runner.os != 'Linux' + if: runner.os != 'Linux' || matrix.archs == 'riscv64' uses: astral-sh/setup-uv@v7 + # On riscv64 the pypa/cibuildwheel action calls actions/setup-python + # internally, which has no riscv64 binaries. Run cibuildwheel via uvx + # instead. Keep version in sync with pypa/cibuildwheel@v3.2.1 below. + - name: Build & Test Wheels (riscv64 native) + if: matrix.archs == 'riscv64' + run: | + uvx cibuildwheel==3.2.1 --output-dir wheelhouse \ + dist/${{ inputs.sdist-name }} + env: + CIBW_ARCHS: riscv64 + CIBW_CONFIG_FILE: ${{ github.workspace }}/.cibuildwheel.toml + - name: Build & Test Wheels + if: matrix.archs != 'riscv64' uses: pypa/cibuildwheel@v3.2.1 with: config-file: .cibuildwheel.toml