Skip to content

Commit

Permalink
bugfix in ci yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Aug 17, 2023
1 parent 40b6565 commit 7a9b682
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 35 deletions.
99 changes: 64 additions & 35 deletions .github/workflows/build_python_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,70 @@ on:

jobs:
build_wheels: # credit to https://github.com/samuelcolvin/rtoml/blob/main/.github/workflows/ci.yml
name: >
build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
(${{ matrix.alt_arch_name || matrix.arch }})
name: build ${{ matrix.python-version }} on ${{ matrix.os }} (${{ matrix.target }})

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: ['cp310', 'pp38', 'pp39', 'pp310']
arch: [main, alt]
include:
- os: ubuntu
platform: linux
- os: windows
ls: dir
- os: macos
arch: alt
alt_arch_name: 'arm64 universal2'

runs-on: ${{ format('{0}-latest', matrix.os) }}
target: [x86_64, aarch64]
python-version: ['cp310', 'pp39', 'pp310', 'pp311']
#manylinux: [auto]
#include:
# - os: windows
# ls: dir
# - os: windows
# ls: dir
# target: i686
# python-architecture: x86
# - os: macos
# target: aarch64
# - os: ubuntu
# target: i686
# # GCC 4.8.5 in manylinux2014 container doesn't support c11 atomic
# # we use manylinux_2_24 container for aarch64 and armv7 targets instead,
# - os: ubuntu
# target: aarch64
# container: messense/manylinux_2_24-cross:aarch64
# - os: ubuntu
# target: armv7
# container: messense/manylinux_2_24-cross:armv7
# - os: ubuntu
# target: ppc64le
# container: messense/manylinux_2_24-cross:ppc64le
# - os: ubuntu
# target: s390x
# container: messense/manylinux_2_24-cross:s390x
# # musllinux
# - os: ubuntu
# target: x86_64
# manylinux: musllinux_1_1
# - os: ubuntu
# target: aarch64
# manylinux: musllinux_1_1
#exclude:
# # this fails
# - os: windows
# target: aarch64

steps:
- uses: actions/checkout@v3

- name: set up python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
architecture: ${{ matrix.python-architecture || 'x64' }}

- name: set up rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
#- name: set up rust
# uses: dtolnay/rust-toolchain@stable
# with:
# toolchain: stable

- name: set up Rust cache
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.alt_arch_name }}

- uses: actions-rs/toolchain@v1
- name: set up rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

Expand All @@ -61,31 +86,35 @@ jobs:
- run: rustup target add i686-pc-windows-msvc
if: matrix.os == 'windows'

# NOTE: This is needed to ensure that hyperdrive-wrappers builds correctly.
- name: install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: install python dependencies
run: pip install -U setuptools wheel twine cibuildwheel platformdirs
run: pip install -U setuptools wheel twine cibuildwheel platformdirs build

- name: build sdist
if: matrix.os == 'ubuntu' && matrix.python-version == 'cp310'
if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux == 'auto' }}
run: |
python -m build --sdist -o wheelhouse crates/hyperdrive-math-py/
- name: build ${{ matrix.platform || matrix.os }} binaries
run: cibuildwheel --output-dir wheelhouse
run: cibuildwheel --output-dir wheelhouse crates/hyperdrive-math-py
env:
CIBW_BUILD: '${{ matrix.python-version }}-*'
# rust doesn't seem to be available for musl linux on i686
CIBW_SKIP: '*-musllinux_i686'
# we build for "alt_arch_name" if it exists, else 'auto'
CIBW_ARCHS: ${{ matrix.alt_arch_name || 'auto' }}
CIBW_ARCHS: ${{ matrix.target }}
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_TERM_COLOR="always"'
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_BEFORE_BUILD: rustup show
CIBW_BEFORE_BUILD_LINUX: >
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=minimal -y &&
rustup show
CIBW_TEST_COMMAND: 'pytest {project}/test'
CIBW_TEST_REQUIRES: pytest requests
CIBW_TEST_SKIP: '*-macosx_arm64 *-macosx_universal2:arm64'
CIBW_TEST_COMMAND: 'pytest python/test'
CIBW_TEST_REQUIRES: pytest
CIBW_BUILD_VERBOSITY: 1

- run: ${{ matrix.ls || 'ls -lh' }} wheelhouse/
Expand Down
1 change: 1 addition & 0 deletions crates/hyperdrive-math-py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
],
# rust extensions are not zip safe, just like C-extensions.
zip_safe=False,
python_requires=">=3.8",
)

0 comments on commit 7a9b682

Please sign in to comment.