Skip to content

ci: publish wheels as immutable GitHub releases #13

ci: publish wheels as immutable GitHub releases

ci: publish wheels as immutable GitHub releases #13

Workflow file for this run

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the wheel job of
# https://github.com/astropy/astropy/blob/v8.0.1/.github/workflows/publish.yml,
# which calls OpenAstronomy/github-actions-workflows' publish.yml.
name: Build astropy wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'astropy version to build (git tag without leading v, e.g. 8.0.1)'
required: true
default: '8.0.1'
pull_request:
paths:
- '.github/workflows/build-astropy.yml'
concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '8.0.1' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
# `inputs.version` is empty on pull_request events; default to 8.0.1 there.
ASTROPY_VERSION: ${{ inputs.version || '8.0.1' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
# Upstream's wheel job sets this; pyproject.toml's environment-pass forwards it
# into the container, where extension-helpers turns it into an abi3 build.
EXTENSION_HELPERS_PY_LIMITED_API: 'cp311'
jobs:
setup:
uses: $/.github/workflows/_setup.yml
build_wheels:
needs: [setup]
name: Build astropy ${{ inputs.version || '8.0.1' }} cp311-abi3-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 720
steps:
- name: Checkout astropy v${{ env.ASTROPY_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: astropy/astropy
ref: v${{ env.ASTROPY_VERSION }}
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: wheelhouse/
env:
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# One abi3 wheel, built on cp311 -- the oldest interpreter its tag
# claims -- and re-tested on the newer ones via find_compatible_wheel.
CIBW_BUILD: >-
cp311-manylinux_riscv64 cp312-manylinux_riscv64
cp313-manylinux_riscv64 cp314-manylinux_riscv64
# pyproject.toml asks for ["auto", "aarch64"], which needs emulation here.
CIBW_ARCHS: riscv64
# numpy is a build and a runtime requirement, and only our registry has
# it for riscv64; only-binary keeps a newer PyPI release from winning the
# resolution and then compiling from sdist.
CIBW_ENVIRONMENT: >-
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
PIP_ONLY_BINARY=numpy
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ASTROPY=${{ env.ASTROPY_VERSION }}
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: >-
pytest -Wdefault --astropy-header -m "not hypothesis"
-k "not test_data_out_of_range and not test_set_locale and not TestQuantityTyping"
--strict-markers --pyargs astropy
- name: Check wheel contents
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
path = sys.argv[1]
assert "-cp311-abi3-" in path, path
names = zipfile.ZipFile(path).namelist()
exts = [n for n in names if n.endswith(".abi3.so")]
assert len(exts) == 18, exts
licences = {n.split(".dist-info/licenses/", 1)[1] for n in names
if ".dist-info/licenses/" in n and not n.endswith("/")}
assert {"LICENSE.rst", "licenses/ERFA.rst", "licenses/EXPAT_LICENSE.rst",
"licenses/WCSLIB_LICENSE.rst"} <= licences, licences
EOF
- name: Store wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: astropy-${{ env.ASTROPY_VERSION }}-cp311-abi3-manylinux_riscv64
path: ./wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish astropy ${{ inputs.version || '8.0.1' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish_wheel.yml
with:
artifact-pattern: astropy-${{ inputs.version || '8.0.1' }}-*-manylinux_riscv64