Skip to content

Commit

Permalink
PyPy raise on known errors (#144)
Browse files Browse the repository at this point in the history
* Add pyo3 build config

* Raise explicit errors for when PyPy won't work

* Remove unneeded extra install of wheel

* Update Cargo.lock, close #136

* Remove windows from pypy job
  • Loading branch information
milesgranger authored Mar 2, 2024
1 parent 2b90ebb commit 2cc2deb
Show file tree
Hide file tree
Showing 11 changed files with 299 additions and 369 deletions.
79 changes: 17 additions & 62 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,10 @@ jobs:
- '3.12'
target: [aarch64, armv7, s390x, ppc64le]
include:
- python: pypy3.7
target: aarch64
- python: pypy3.8
target: aarch64
- python: pypy3.9
target: aarch64
- python: pypy3.10
target: aarch64
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand Down Expand Up @@ -264,14 +262,18 @@ jobs:
name: wheels
path: dist

pypy-linux:
runs-on: ubuntu-latest
pypy:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
# - windows-latest # TODO: fails w/ LINK : fatal error LNK1181: cannot open input file 'python39.lib'
python:
- pypy-3.7
- pypy-3.8
- pypy-3.9
- pypy-3.10
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -298,11 +300,13 @@ jobs:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python }} --release --out dist --manifest-path cramjam-cli/Cargo.toml
- name: Python UnitTest - cramjam-python
- name: cramjam test
run: |
pip install cramjam --no-index --find-links dist
pypy -c "import cramjam"
- name: Python cramjam-cli test
cd cramjam-python
pip install .[dev]
python -m pytest tests -v
- name: cramjam-cli test
run: |
pip install cramjam-cli --no-index --find-links dist
cramjam-cli --help
Expand All @@ -312,60 +316,11 @@ jobs:
name: wheels
path: dist

pypy-macos:
runs-on: macos-latest
strategy:
matrix:
python-version: [ pypy-3.7, pypy-3.8, pypy-3.9 ]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install maturin
run: pip install maturin
- name: Build Wheels - cramjam-python
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python }} --release --out dist --manifest-path cramjam-python/Cargo.toml
- name: Build Wheels - cramjam-cli
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python }} --release --out dist --manifest-path cramjam-cli/Cargo.toml
- name: Install wheel
run: |
pip install cramjam --no-index --find-links dist
pip install cramjam-cli --no-index --find-links dist
- name: Python Import test
run: pypy -c "import cramjam"
- name: Python cramjam-cli test
run: cramjam-cli --help
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

pypi-publish-cramjam-python:
name: Upload cramjam release to PyPI
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux, linux-cross, pypy-linux, pypy-macos ]
needs: [ macos, windows, linux, linux-cross, pypy ]
environment:
name: pypi
url: https://pypi.org/p/cramjam
Expand All @@ -387,7 +342,7 @@ jobs:
name: Upload cramjam-cli release to PyPI
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux, linux-cross, pypy-linux, pypy-macos ]
needs: [ macos, windows, linux, linux-cross, pypy ]
environment:
name: pypi
url: https://pypi.org/p/cramjam-cli
Expand Down
Loading

0 comments on commit 2cc2deb

Please sign in to comment.