Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/scripts/ci_check_wheel.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# A Powershell port of `ci_check_wheel.sh`. Refer to that script instead.

# Any change made here should be made in `ci_check_wheel.sh` too.

param (
[Parameter(Mandatory = $true)]
[string]$PYTHON_VERSION,

[Parameter(Mandatory = $true)]
[string]$KEY,

[string]$EXTRA
)

# Equivalent to `set -e`
$ErrorActionPreference = "Stop"

if (Test-Path ".venv") {
Remove-Item -Recurse -Force ".venv"
}

# When $EXTRA is empty powershell passes the argument as an empty argument to
# uv, so we need to explicitly check the argument and only pass it if it is not
# empty to avoid uv from erroring
if ($EXTRA) {
uv venv --no-config .venv -p $PYTHON_VERSION $EXTRA
} else {
uv venv --no-config .venv -p $PYTHON_VERSION
}

.\.venv\Scripts\Activate.ps1
uv run --no-config --no-build --no-sync python --version
uv pip install $(Get-ChildItem -Path .\wheelhouse\ -Recurse -Filter "rabbitizer-*-$KEY*")
uv run --no-config --no-build --no-sync python -c "import rabbitizer; print(rabbitizer.Instruction(0).disassemble())"
33 changes: 33 additions & 0 deletions .github/scripts/ci_check_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This script checks a given Python wheel inside the `dist` is installable in a
# given Python version.
#
# It recieves the following arguments:
# - The python version to check, it must be compatible with uv.
# - A key value to allow searching for the wheel in the `dist` folder. Only a
# single wheel in the folder must contain this value in its name.
# Recommended values: abi3, cp314t, pypy39 and similar values.
# - (OPTIONAL) A single aditional flag to pass to `uv venv`.
# Usually `--managed-python`.

# Any change made here should be made in `ci_check_wheel.ps1` too.

PYTHON_VERSION=$1
KEY=$2
EXTRA=$3

# Exit with an error value if any command produces an error.
set -e

# We make a venv with the Python version we were told to.
rm -rf .venv
uv venv --no-config -p $PYTHON_VERSION $EXTRA
source .venv/bin/activate
# Allows us to check we are actually using the requested Python version.
uv run --no-config --no-build --no-sync python --version

# We install the wheel by looking it up in the dist folder.
# We need to do a `find` command here because we don't know the exact name of
# the wheel (it can be affected by package version, arch, python version, etc.).
uv pip install $(find ./wheelhouse/ -name "rabbitizer-*-$KEY*")
# Check something basic to make sure it was installed correctly.
uv run --no-config --no-build --no-sync python -c "import rabbitizer; print(rabbitizer.Instruction(0).disassemble())"
121 changes: 121 additions & 0 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,106 @@ jobs:
include:
- os: linux-intel
runs-on: ubuntu-22.04
check-wheel: true
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.7'
python_version_max: '3.14'
abi3-key: abi3-manylinux
t-extra-key: -manylinux
check-pypy-wheel: true
- os: linux-arm
runs-on: ubuntu-24.04-arm
check-wheel: true
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.8'
python_version_max: '3.14'
abi3-key: abi3-manylinux
t-extra-key: -manylinux
check-pypy-wheel: true
- os: windows-intel
runs-on: windows-latest
check-wheel: true
wheel-check-script: .github/scripts/ci_check_wheel.ps1
python_version_min: '3.7'
python_version_max: '3.14'
abi3-key: abi3-win_amd64
t-extra-key: '-win_amd64'
check-pypy-wheel: true
- os: windows-arm
runs-on: windows-11-arm
# uv installs x86 binaries on arm windows, so we can't test
# the wheels actually work for arm.
# https://github.com/astral-sh/uv/issues/12906
check-wheel: false
wheel-check-script: .github/scripts/ci_check_wheel.ps1
python_version_min: '3.11'
python_version_max: '3.14'
abi3-key: abi3-win_arm64
t-extra-key: ''
check-pypy-wheel: false
- os: macos-intel
# macos-15-intel is the last x86_64 runner
runs-on: macos-15-intel
check-wheel: true
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.7'
python_version_max: '3.14'
abi3-key: abi3
t-extra-key: ''
check-pypy-wheel: true
- os: macos-arm
# macos-14+ (including latest) are ARM64 runners
runs-on: macos-latest
check-wheel: true
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.8'
python_version_max: '3.14'
abi3-key: abi3
t-extra-key: ''
check-pypy-wheel: true
- os: android-intel
runs-on: ubuntu-22.04
platform: android
check-wheel: false
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.7'
python_version_max: '3.14'
abi3-key: abi3
t-extra-key: ''
check-pypy-wheel: true
- os: android-arm
# GitHub Actions doesn’t currently support the Android emulator on any ARM
# runner. So we build on a non-ARM runner, which will skip the tests.
runs-on: ubuntu-22.04
platform: android
archs: arm64_v8a
check-wheel: false
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.7'
python_version_max: '3.14'
abi3-key: abi3
t-extra-key: ''
check-pypy-wheel: true
- os: ios
runs-on: macos-latest
platform: ios
check-wheel: false
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.7'
python_version_max: '3.14'
abi3-key: abi3
t-extra-key: ''
check-pypy-wheel: true
- os: pyodide
runs-on: ubuntu-22.04
platform: pyodide
check-wheel: false
wheel-check-script: .github/scripts/ci_check_wheel.sh
python_version_min: '3.7'
python_version_max: '3.14'
abi3-key: abi3
t-extra-key: ''
check-pypy-wheel: true

steps:
- name: Checkout reposistory
Expand All @@ -67,6 +140,54 @@ jobs:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

# Test the built wheels are installable in the min and max Python
# versions we are about.
# We do this by installing the Python version in a venv using uv,
# installing the built wheel into the venv and running some simple
# command.
# We can only test the wheels that matches the architecture of the runner
# so we hope the other built wheels will just work, hopefully.
- name: Install uv
uses: astral-sh/setup-uv@v7
if: ${{ matrix.check-wheel }}
- name: Setup Python
uses: actions/setup-python@v6
if: ${{ matrix.check-wheel }}
with:
python-version: |
${{ matrix.python_version_min }}
3.14t
- name: Setup PyPy
uses: actions/setup-python@v6
if: ${{ matrix.check-wheel && matrix.check-pypy-wheel }}
with:
python-version: |
pypy3.9
pypy3.10
pypy3.11
- name: Test wheels with min version (${{ matrix.python_version_min }})
if: ${{ matrix.check-wheel }}
# Check the built wheel is installable on the oldest Python supported
run: |
${{ matrix.wheel-check-script }} ${{ matrix.python_version_min }} ${{ matrix.abi3-key }}
- name: Test wheels with max version (${{ matrix.python_version_max }})
if: ${{ matrix.check-wheel }}
# Check the built wheel is installable on the newest Python we know of
run: |
${{ matrix.wheel-check-script }} ${{ matrix.python_version_max }} ${{ matrix.abi3-key }} --managed-python

- name: Test free threaded wheels
if: ${{ matrix.check-wheel }}
run: |
${{ matrix.wheel-check-script }} 3.14t cp314t${{ matrix.t-extra-key }} --managed-python

- name: Test pypy wheels
if: ${{ matrix.check-wheel && matrix.check-pypy-wheel }}
run: |
${{ matrix.wheel-check-script }} pypy3.9 pypy39 --managed-python
${{ matrix.wheel-check-script }} pypy3.10 pypy310 --managed-python
${{ matrix.wheel-check-script }} pypy3.11 pypy311 --managed-python

build_sdist:
name: Build source distribution
runs-on: ubuntu-22.04
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,5 @@ cython_debug/
/target

.make_options

uv.lock
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- This allows us to build a single wheel that can work in multiple Python
versions, instead of needing to build a wheel for each Python version.
- The minimum Python version for `abi3` compatibility is 3.4 now.
- Install the built wheels in CI to make sure they work corrently in multiple
versions.

## [1.14.3] - 2025-10-12

Expand Down
Loading