Skip to content

Commit

Permalink
Additional wheels for other archs
Browse files Browse the repository at this point in the history
  • Loading branch information
ariebovenberg committed Jun 20, 2024
1 parent def6619 commit 3b43929
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 66 deletions.
95 changes: 38 additions & 57 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Build and publish wheels

on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
Expand All @@ -12,90 +10,73 @@ permissions:
contents: read

jobs:
linux:
runs-on: ubuntu-latest
binary:
name: build on ${{ matrix.os }} - (target ${{ matrix.target || 'all' }}) - (filter ${{ matrix.build_only || 'all' }})
strategy:
fail-fast: false # TODO: unset
fail-fast: false
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build wheels
run: |
pip install cibuildwheel==2.17.0
cibuildwheel --output-dir dist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: dist/*.whl
include:
- os: windows-latest
- os: macos-latest
- os: ubuntu-latest
target: x86_64
- os: ubuntu-latest
target: i686
- os: ubuntu-latest
target: ppc64le
- os: ubuntu-latest
target: s390x
# parallelized because they are slow
- os: ubuntu-latest
target: aarch64
build_only: 'musllinux'
- os: ubuntu-latest
target: aarch64
build_only: 'manylinux'

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/setup-python@v5
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
python-version: '3.12'
architecture: ${{ matrix.target }}
- name: Build wheels
run: |
pip install cibuildwheel==2.17.0
cibuildwheel --output-dir dist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: dist/*.whl

macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
platforms: all
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build wheels
run: |
pip install cibuildwheel==2.17.0
cibuildwheel --output-dir dist
- run: pip install -U twine cibuildwheel==2.19.1
- run: cibuildwheel --output-dir dist
env:
CIBW_ARCHS: ${{ matrix.target || 'auto' }}
CIBW_BUILD: '*${{ matrix.build_only }}*'
- run: twine check --strict dist/*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: dist/*.whl
name: wheels-binary-${{ runner.os }}-${{ matrix.target || 'all' }}-${{ matrix.build_only || 'all' }}
path: dist/*

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: |
pip install build
pip install build twine
python -m build --sdist --outdir dist
- run: twine check --strict dist/*
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
path: dist/*

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
needs: [binary, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Rust extension module for whenever"
edition = "2021"
rust-version = "1.78"
license = "MIT"
readme = "README.rst"
readme = "README.md"
keywords = []
include = [
"Cargo.toml",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ init:
.PHONY: typecheck
typecheck:
mypy pysrc/ tests/
pytest typesafety/
pytest --mypy-ini-file=tests/mypy.ini typesafety/

.PHONY: format
format:
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,27 @@ module = [
ignore_missing_imports = true

[tool.cibuildwheel]
skip = ["pp*", "*-musllinux_i686"]
skip = ["pp*", "*-musllinux_i686", "*-musllinux_ppc64le", "*-musllinux_s390x"]
free-threaded-support = true
test-command = "pytest -s {project}/tests"
test-requires = [
"pytest",
"pytest-benchmark",
"hypothesis",
"pytest-mypy-plugins",
]
environment = { PATH = "$HOME/.cargo/bin:$PATH" }

[tool.cibuildwheel.linux]
before-all = "curl -sSf https://sh.rustup.rs | sh -s -- -y"
archs = ["x86_64", "i686", "aarch64", "ppc64le", "s390x"]

[tool.cibuildwheel.windows]
before-all = "rustup target add i686-pc-windows-msvc"
environment = { PATH = "$UserProfile\\.cargo\\bin;$PATH" }

[tool.cibuildwheel.macos]
before-all = "rustup target add x86_64-apple-darwin"
archs = ["x86_64", "arm64"]

[[tool.cibuildwheel.overrides]]
select = "*-musllinux*"
before-all = "curl -sSf https://sh.rustup.rs | sh -s -- -y && apk add tzdata"
Expand Down
3 changes: 0 additions & 3 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[pytest]
addopts=
--mypy-ini-file=tests/mypy.ini

filterwarnings =
error
ignore::DeprecationWarning:dateutil.*
1 change: 0 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pytest>=7,<9
pytest-cov>=4,<6
pytest-benchmark[histogram]>=4,<6
pytest-mypy-plugins>=3,<4
hypothesis>=6,<7

# FUTURE: remove these constraints once rdps-py supports python 3.13
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

import platform
from setuptools import setup
from setuptools_rust import Binding, RustExtension, build_rust

Expand Down Expand Up @@ -27,6 +28,7 @@ def run(self):
rust_extensions=(
[]
if os.getenv("WHENEVER_NO_BUILD_RUST_EXT")
or platform.python_implementation() == "PyPy"
else [RustExtension("whenever._whenever", binding=Binding.PyO3)]
),
cmdclass={"build_rust": CustomBuildExtCommand},
Expand Down

0 comments on commit 3b43929

Please sign in to comment.