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
201 changes: 10 additions & 191 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ jobs:
fail-fast: ${{ !( startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags/') ) }}
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.12' # builds for general python 3
conf:
- { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto }
- { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-musl, manylinux: musllinux_1_1 }
Expand All @@ -48,67 +44,6 @@ jobs:

- { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc, python-architecture: x64 }
- { os: windows-latest, target: i686, target-triple: i686-pc-windows-msvc, python-architecture: x86 }

include:
# Windows x86_64 pypy
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.9
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.9
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.10
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.10

# Linux x86_64 pypy
- conf: { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.9
- conf: { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.9
- conf: { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.10
- conf: { os: ubuntu-latest, target: x86_64, target-triple: x86_64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.10

# Linux arm pypy
- conf: { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.9
- conf: { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.9
- conf: { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.10
- conf: { os: ubuntu-latest, target: aarch64, target-triple: aarch64-unknown-linux-gnu, manylinux: auto }
python-version: pypy3.10

# OSX x86_64 pypy
- conf: { os: macos-13, target: x86_64, target-triple: x86_64-apple-darwin }
python-version: pypy3.9
- conf: { os: macos-13, target: x86_64, target-triple: x86_64-apple-darwin }
python-version: pypy3.9
- conf: { os: macos-13, target: x86_64, target-triple: x86_64-apple-darwin }
python-version: pypy3.10
- conf: { os: macos-13, target: x86_64, target-triple: x86_64-apple-darwin }
python-version: pypy3.10

# OSX universal2 pypy
- conf: { os: macos-13, target: universal2, target-triple: x86_64-apple-darwin }
python-version: pypy3.9
- conf: { os: macos-13, target: universal2, target-triple: x86_64-apple-darwin }
python-version: pypy3.9
- conf: { os: macos-13, target: universal2, target-triple: x86_64-apple-darwin }
python-version: pypy3.10
- conf: { os: macos-13, target: universal2, target-triple: x86_64-apple-darwin }
python-version: pypy3.10

# OSX arm pypy
- conf: { os: macos-13, target: aarch64, target-triple: aarch64-apple-darwin }
python-version: pypy3.9
- conf: { os: macos-13, target: aarch64, target-triple: aarch64-apple-darwin }
python-version: pypy3.9
- conf: { os: macos-13, target: aarch64, target-triple: aarch64-apple-darwin }
python-version: pypy3.10
- conf: { os: macos-13, target: aarch64, target-triple: aarch64-apple-darwin }
python-version: pypy3.10

steps:
- uses: actions/checkout@v4
Expand All @@ -122,150 +57,34 @@ jobs:
with:
target: ${{ matrix.conf.target-triple }}

- name: Setup (Mac)
if: runner.os == 'macOS'
run: |
brew install ninja
echo "MACOSX_DEPLOYMENT_TARGET=10.12" >> $GITHUB_ENV

- name: Setup (Windows)
if: runner.os == 'Windows'
run: |
choco install ninja cmake

- name: Setup (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install ninja-build -y

- name: Setup QEMU
if: runner.os == 'Linux' && matrix.conf.target != 'x86_64' && matrix.conf.target != 'i686'
uses: docker/setup-qemu-action@v1

- name: Setup (Linux)
if: runner.os == 'Linux'
env:
TARGET_TRIPLE: ${{ matrix.conf.target-triple }}
WORKSPACE: ${{ github.workspace }}
BLOSC2_INSTALL_PREFIX: ${{ github.workspace }}/blosc2
CC: gcc
run: |
sudo apt update
sudo apt install ninja-build -y

echo "BLOSC2_INSTALL_PREFIX=$BLOSC2_INSTALL_PREFIX" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BLOSC2_INSTALL_PREFIX/lib:$BLOSC2_INSTALL_PREFIX/lib64" >> $GITHUB_ENV

# maturin action fails building blosc2 for armv7 and aarch64
# so we'll just use 'cross' to build and pass it in for the action for all archs
# nothing special for the revision pin, just deterministic install
cargo install cross --git https://github.com/cross-rs/cross --rev 6d097fb
cross build --release --target $TARGET_TRIPLE --package blosc2-sys --target-dir build
blosc2_sys_dir=$(ls build/$TARGET_TRIPLE/release/build/ | grep blosc2-sys)
mv $WORKSPACE/build/$TARGET_TRIPLE/release/build/$blosc2_sys_dir/out $BLOSC2_INSTALL_PREFIX
tree -L 2 $BLOSC2_INSTALL_PREFIX

- name: Rust Tests
if: matrix.conf.target == 'x86_64' && !startsWith(matrix.python-version, 'pypy') && matrix.python-version == '3.12'
run: cargo test

- name: Build wheel (Linux)
if: runner.os == 'Linux'
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.conf.target-triple }}
manylinux: ${{ matrix.conf.manylinux }}
docker-options: -e CC=gcc -e BLOSC2_INSTALL_PREFIX=${{ github.workspace }}/blosc2 -e LD_LIBRARY_PATH=${{ github.workspace }}/blosc2/lib:${{ github.workspace }}/blosc2/lib64
args: -i ${{ matrix.python-version }} --release --out dist --features use-system-blosc2
before-script-linux: ls -l $BLOSC2_INSTALL_PREFIX
args: -i ${{ matrix.python-version }} --release --out dist

- name: Build wheel (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
python -m pip install maturin delvewheel

maturin build \
-i python \
--release \
--out wheels \
--target ${{ matrix.conf.target-triple }}

name=$(ls -1 wheels/ | head -n 1)
delvewheel repair -v wheels/$name -w dist

- name: Build wheel (MacOS)
if: runner.os == 'macOS'
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.conf.target-triple }}
args: -i python --release --out dist

- name: Fix wheel (MacOS)
if: runner.os == 'macOS'
run: |
python -m pip install delocate
delocate-wheel -v dist/*.whl

- name: Install built wheel and Test (Native)
- name: Install built wheel and Test
# TODO: I'm not sure but the actual collection of tests on windows using pypy3.10 takes forever and/or fails
if: |
!startsWith(matrix.conf.manylinux, 'musl') &&
!( matrix.python-version == 'pypy3.10' && runner.os == 'Windows' ) &&
( matrix.conf.target == 'x86_64' || matrix.conf.target == 'universal2' )
run: |
# TODO: Remove after next release of cramjam-cli
python -m pip install pytest-benchmark cramjam

# Second install guarantees it's going to install from local dir w/ --no-index
# use first to get in dev dependencies
python -m pip install cramjam-cli[dev] --pre --find-links dist --force-reinstall
python -m pip install .[dev] --pre --find-links dist --force-reinstall
python -m pip install cramjam-cli --pre --no-index --find-links dist --force-reinstall

python -m pytest -vs --benchmark-skip

# Could use 'distro: alpine_latest' in 'run-on-arch-action' but seems difficult to install a specific version of python
# so we'll just use existing python alpine images to test import and cli use w/o testing archs other than x86_64
- name: Install built wheel and Test (musllinux)
if: startsWith(matrix.conf.manylinux, 'musl') && matrix.conf.target == 'x86_64'
run: |
docker run \
-v $(pwd)/dist:/wheels \
--rm python:${{ matrix.python-version }}-alpine sh \
-c "pip install cramjam-cli --no-index --find-links /wheels && cramjam-cli --help"

- name: Install built wheel and Test (Cross)
if: |
!startsWith(matrix.conf.manylinux, 'musl') &&
runner.os == 'Linux' &&
!startsWith(matrix.python-version, 'pypy') &&
contains(fromJson('["armv6", "armv7", "aarch64", "riscv64", "s390x", "ppc64le"]'), matrix.conf.target)
uses: uraimo/run-on-arch-action@v2.7.1
with:
arch: ${{ matrix.conf.target }}
distro: ubuntu20.04
githubToken: ${{ github.token }}
# Mount the dist directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}/dist:/artifacts"
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-venv software-properties-common
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get install -y curl python${{ matrix.python-version }}-venv
run: |
ls -lrth /artifacts
PYTHON=python${{ matrix.python-version }}
$PYTHON -m venv venv
venv/bin/pip install -U pip
venv/bin/pip install cramjam-cli --pre --no-index --find-links /artifacts --force-reinstall

venv/bin/cramjam-cli --help
python -m pytest -vs ./tests

- name: Upload wheels
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ ( startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags/') ) }}
with:
name: dist
Expand All @@ -284,7 +103,7 @@ jobs:
python -m pip install build
python -m build --sdist -o ./dist
- name: Upload sdists
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand All @@ -302,7 +121,7 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: dist
- name: List artifacts
Expand All @@ -321,7 +140,7 @@ jobs:
needs: [build-test, build-sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: dist
- name: List artifacts
Expand Down
Loading