Skip to content

Commit

Permalink
Python 3.12 wheels, remove Python 3.7 support (#12)
Browse files Browse the repository at this point in the history
* Update CI.yml

Add Python 3.12 to build matrix

* Upgrade deps for Python 3.12, drop 3.7

* Fix to work with latest PyO3

* Re-generate CI workflow with latest maturin

* Build for 3.8-3.12 on macOS and Windows

* Remove 3.12 build for windows

Doesn't seem to be supported yet

* Attempt to compile 3.12 in windows build

* Use 3.11 interpreter for windows arm

* Remove windows ARM support attempt
  • Loading branch information
nfrasser authored Oct 3, 2023
1 parent f83b700 commit 26e6550
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 203 deletions.
218 changes: 123 additions & 95 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,131 +1,159 @@
# This file is autogenerated by maturin v1.3.0
# To update, run
#
# maturin generate-ci github --pytest
#
name: CI

on:
push:
branches: [ main ]
branches:
- main
- master
tags:
- '*'
pull_request:
branches: [ main ]
release:
types: [published]
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.10']
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- 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 }}-python-${{ matrix.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'Pipfile.lock'
- name: pip install pipenv
run: pip install -U pip pipenv
- name: pipenv install
run: pipenv install --dev --python ${{ matrix.python-version }}
- run: pipenv run maturin develop
- run: pipenv run pytest
- run: pipenv run maturin sdist -o dist
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }}
- name: Upload wheels
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }}
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

linux:
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v3
- uses: PyO3/maturin-action@v1
with:
manylinux: auto
command: build
args: --release -o dist -i python${{ matrix.python-version }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: pytest
if: ${{ startsWith(matrix.target, 'x86_64') }}
shell: bash
run: |
set -e
pip install pyoxipng --find-links dist --force-reinstall
pip install pytest
pytest
- name: pytest
if: ${{ !startsWith(matrix.target, 'x86') && matrix.target != 'ppc64' }}
uses: uraimo/run-on-arch-action@v2.5.0
with:
arch: ${{ matrix.target }}
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
pip3 install -U pip pytest
run: |
set -e
pip3 install pyoxipng --find-links dist --force-reinstall
pytest
windows:
runs-on: windows-latest
needs: test
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist -i python${{ matrix.python-version }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter 3.8 3.9 3.10 3.11 3.12
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: pytest
if: ${{ !startsWith(matrix.target, 'aarch64') }}
shell: bash
run: |
set -e
pip install pyoxipng --find-links dist --force-reinstall
pip install pytest
pytest
macos:
runs-on: macos-latest
needs: test
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist --universal2 -i python${{ matrix.python-version }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter 3.8 3.9 3.10 3.11 3.12
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: pytest
if: ${{ !startsWith(matrix.target, 'aarch64') }}
shell: bash
run: |
set -e
pip install pyoxipng --find-links dist --force-reinstall
pip install pytest
pytest
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux ]
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade twine
twine upload --skip-existing *
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD }}
with:
command: upload
args: --non-interactive --skip-existing *
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ name = "oxipng"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.17.3", features = ["extension-module"] }
pyo3 = { version = "0.19.2", features = ["extension-module"] }
oxipng = { version = "8.0.*" }
Loading

0 comments on commit 26e6550

Please sign in to comment.