Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust for move of libcramjam and CLI to own repos #162

Merged
merged 1 commit into from
Apr 30, 2024
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
72 changes: 0 additions & 72 deletions .github/workflows/CI-libcramjam.yml

This file was deleted.

105 changes: 22 additions & 83 deletions .github/workflows/CI-python.yml → .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI-python
name: CI

on:
push:
Expand All @@ -18,21 +18,16 @@ concurrency:
jobs:
build-test:
runs-on: ${{ matrix.conf.os }}
name: ${{ matrix.conf.os }}-${{ matrix.conf.target }}-${{ matrix.package.name }}-${{ matrix.python-version }}-${{ matrix.conf.python-architecture }}-${{ matrix.conf.manylinux }}
name: ${{ matrix.conf.os }}-${{ matrix.conf.target }}-${{ matrix.python-version }}-${{ matrix.conf.python-architecture }}-${{ matrix.conf.manylinux }}
strategy:
fail-fast: ${{ !( startsWith(github.ref, 'refs/heads/master') || !startsWith(github.ref, 'refs/tags/') ) }}
fail-fast: ${{ !( startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/') ) }}
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
package:
- dir: cramjam-python
name: cramjam
- dir: cramjam-cli
name: cramjam-cli
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 @@ -58,86 +53,62 @@ jobs:
# Windows x86_64 pypy
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.9
package: { name: cramjam, dir: cramjam-python }
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.9
package: { name: cramjam-cli, dir: cramjam-cli }
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.10
package: { name: cramjam, dir: cramjam-python }
- conf: { os: windows-latest, target: x86_64, target-triple: x86_64-pc-windows-msvc }
python-version: pypy3.10
package: { name: cramjam-cli, dir: cramjam-cli }

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

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

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

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

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

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -199,14 +170,14 @@ jobs:
# 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 --manifest-path ${{ matrix.package.dir }}/Cargo.toml
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 -p ${{ matrix.package.dir }}
run: cargo test

- name: Build wheel (Linux)
if: runner.os == 'Linux'
Expand All @@ -215,7 +186,7 @@ jobs:
target: ${{ matrix.conf.target }}
manylinux: ${{ matrix.conf.manylinux }}
docker-options: -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 --manifest-path ${{ matrix.package.dir }}/Cargo.toml --features use-system-blosc2
args: -i ${{ matrix.python-version }} --release --out dist --features use-system-blosc2
before-script-linux: ls -l $BLOSC2_INSTALL_PREFIX

- name: Build wheel (Windows)
Expand All @@ -231,8 +202,7 @@ jobs:
--target ${{ matrix.conf.target-triple }} \
--no-default-features \
--features extension-module \
--features blosc2-static \
--manifest-path ${{ matrix.package.dir }}/Cargo.toml
--features blosc2-static

name=$(ls -1 wheels/ | head -n 1)
delvewheel repair -v wheels/$name -w dist
Expand All @@ -243,7 +213,7 @@ jobs:
with:
target: ${{ matrix.conf.target-triple }}
# OSX complains with __cpu_model from blosc2 statically compiled so only enabled shared
args: -i python --release --out dist --manifest-path ${{ matrix.package.dir }}/Cargo.toml --no-default-features --features extension-module --features blosc2-shared
args: -i python --release --out dist --no-default-features --features extension-module --features blosc2-shared

- name: Fix wheel (MacOS)
if: runner.os == 'macOS'
Expand All @@ -263,32 +233,22 @@ jobs:
!( 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 ${{ matrix.package.name }}[dev] --pre --find-links dist --force-reinstall
python -m pip install ${{ matrix.package.name }} --pre --no-index --find-links dist --force-reinstall
python -m pip install cramjam[dev] --pre --find-links dist --force-reinstall
python -m pip install cramjam --pre --no-index --find-links dist --force-reinstall

python -m pytest ${{ matrix.package.dir }} -vs --benchmark-skip
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: |
if [ "${{ matrix.package.name }}" = "cramjam" ]; then
docker run \
-v $(pwd)/dist:/wheels \
--rm python:${{ matrix.python-version }}-alpine sh \
-c "pip install ${{ matrix.package.name }} --no-index --find-links /wheels && python -c 'import cramjam'"
else
docker run \
-v $(pwd)/dist:/wheels \
--rm python:${{ matrix.python-version }}-alpine sh \
-c "pip install ${{ matrix.package.name }} --no-index --find-links /wheels && cramjam-cli --help"
fi
docker run \
-v $(pwd)/dist:/wheels \
--rm python:${{ matrix.python-version }}-alpine sh \
-c "pip install cramjam --no-index --find-links /wheels && python -c 'import cramjam'"

- name: Install built wheel and Test (Cross)
if: |
Expand All @@ -315,9 +275,8 @@ jobs:
PYTHON=python${{ matrix.python-version }}
$PYTHON -m venv venv
venv/bin/pip install -U pip
venv/bin/pip install ${{ matrix.package.name }} --pre --no-index --find-links /artifacts --force-reinstall

venv/bin/python -c 'import cramjam' || venv/bin/cramjam-cli --help
venv/bin/pip install cramjam --pre --no-index --find-links /artifacts --force-reinstall
venv/bin/python -c 'import cramjam'

- name: Upload wheels
uses: actions/upload-artifact@v3
Expand All @@ -336,55 +295,35 @@ jobs:
python-version: 3.12
- name: Build sdist cramjam
run: |
pip install build
python -m build --sdist cramjam-python/ -o ./dist
- name: Build sdist cramjam-cli
run: python -m build --sdist cramjam-cli/ -o ./dist
python -m pip install build
python -m build --sdist -o ./dist
- name: Upload sdists
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

pypi-publish:
name: Upload ${{ matrix.package }} release to PyPI
name: Upload release to PyPI
if: startsWith(github.ref, 'refs/tags/')
strategy:
fail-fast: false
matrix:
package:
- cramjam
- cramjam-cli
runs-on: ubuntu-latest
needs: [build-test, build-sdist]
environment:
name: pypi
url: https://pypi.org/p/${{ matrix.package }}
url: https://pypi.org/p/cramjam
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: dist
- name: Separate packages into directories
run: |
ls -l

mkdir artifacts-cramjam-cli
mv cramjam_cli* artifacts-cramjam-cli/
ls -l artifacts-cramjam-cli/

mkdir artifacts-cramjam
mv cramjam* artifacts-cramjam/
ls -l artifacts-cramjam/

ls -l

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
packages-dir: artifacts-${{ matrix.package }}/
packages-dir: dist/

gh-publish:
name: Publish artifacts to GH
Expand Down
39 changes: 29 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
[workspace]
members = [
"libcramjam",
"cramjam-cli",
"cramjam-python"
]
resolver = "2"

[workspace.package]
[package]
name = "cramjam-python"
version = "2.8.4-rc1"
authors = ["Miles Granger <miles59923@gmail.com>"]
edition = "2021"
homepage = "https://github.com/milesgranger/cramjam"
license = "MIT"
description = "Thin Python bindings to de/compression algorithms in Rust"
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "cramjam"
crate-type = ["cdylib"]

[features]
default = ["extension-module"]
extension-module = ["pyo3/extension-module"]
generate-import-lib = ["pyo3/generate-import-lib"] # needed for Windows PyPy builds

blosc2-static = ["libcramjam/blosc2-static"]
blosc2-shared = ["libcramjam/blosc2-shared"]
use-system-blosc2 = ["libcramjam/use-system-blosc2"]


[dependencies]
pyo3 = { version = "^0.20", default-features = false, features = ["macros"] }
libcramjam = { version = "^0.4" }

[build-dependencies]
pyo3-build-config = "^0.20"

[profile.release]
strip = true
Expand Down
File renamed without changes.
Loading
Loading