chore(deps): update dependency pre-commit to v4 #137
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some code from https://github.com/pydantic/pydantic-core/blob/d6e7890b36ef21cb28180a7f5b1479da2319012d/.github/workflows/ci.yml | |
# MIT License, see author list by link | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "**" | |
pull_request: {} | |
jobs: | |
test: | |
name: test ${{ matrix.python-version }} pandas ${{ matrix.pandas-version }} ${{ matrix.disable-gil && 'free-threaded' || '' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
pandas-version: | |
- "2.1.*" | |
- "2.2.*" | |
include: | |
- python-version: "3.8" | |
pandas-version: "none" | |
# https://github.com/pandas-dev/pandas/issues/42509 | |
- python-version: "pypy3.8" | |
pandas-version: "none" | |
# https://github.com/pandas-dev/pandas/issues/42509 | |
- python-version: "pypy3.9" | |
pandas-version: "none" | |
# https://github.com/pandas-dev/pandas/issues/42509 | |
- python-version: "pypy3.10" | |
pandas-version: "none" | |
- python-version: "3.13" | |
pandas-version: "2.2.*" | |
# https://github.com/pandas-dev/pandas/issues/60016 | |
- python-version: "3.13" | |
pandas-version: "none" | |
disable-gil: true | |
runs-on: ubuntu-latest | |
env: | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install rust stable | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- id: cache-rust | |
name: cache rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: v3 | |
- name: set up python | |
uses: actions/setup-python@v5 | |
if: "${{ !matrix.disable-gil }}" | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: set up python (free-threaded) | |
uses: deadsnakes/[email protected] | |
if: "${{ matrix.disable-gil }}" | |
with: | |
python-version: ${{ matrix.python-version }} | |
nogil: ${{ matrix.disable-gil }} | |
- id: cache-py | |
name: cache python | |
uses: actions/cache@v4 | |
if: "${{ !matrix.disable-gil }}" | |
with: | |
path: ${{ env.pythonLocation }} | |
key: > | |
py | |
${{ runner.os }} | |
${{ env.pythonLocation }} | |
- run: | | |
if [ ${{ matrix.pandas-version }} == 'none' ]; then | |
pip install pytest | |
else | |
pip install pytest pandas[excel]==${{ matrix.pandas-version }} | |
fi | |
if: steps.cache-py.outputs.cache-hit != 'true' | |
- run: pip install -e . | |
env: | |
RUST_BACKTRACE: 1 | |
- run: pip freeze | |
- if: "${{ matrix.disable-gil }}" | |
continue-on-error: true | |
run: pytest | |
- if: "${{ !matrix.disable-gil }}" | |
continue-on-error: false | |
run: pytest | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: cache rust | |
uses: Swatinem/rust-cache@v2 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@v4 | |
id: cache-py | |
name: cache python | |
with: | |
path: ${{ env.pythonLocation }} | |
key: > | |
py | |
${{ env.pythonLocation }} | |
- run: pip install pre-commit | |
if: steps.cache-py.outputs.cache-hit != 'true' | |
- run: pip install . | |
if: steps.cache-py.outputs.cache-hit != 'true' | |
- run: pip freeze | |
- run: pre-commit run --all-files | |
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks | |
check: | |
if: always() | |
needs: [test, lint] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
build: | |
name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }}) | |
if: success() | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, macos, windows] | |
target: [x86_64, aarch64] | |
manylinux: [auto] | |
include: | |
- os: ubuntu | |
platform: linux | |
- os: windows | |
ls: dir | |
- os: windows | |
ls: dir | |
target: i686 | |
python-architecture: x86 | |
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 | |
- os: windows | |
ls: dir | |
target: aarch64 | |
interpreter: 3.11 3.12 3.13 | |
- os: ubuntu | |
platform: linux | |
target: i686 | |
- os: ubuntu | |
platform: linux | |
target: aarch64 | |
- os: ubuntu | |
platform: linux | |
target: armv7 | |
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 | |
# musllinux | |
- os: ubuntu | |
platform: linux | |
target: x86_64 | |
manylinux: musllinux_1_1 | |
- os: ubuntu | |
platform: linux | |
target: aarch64 | |
manylinux: musllinux_1_1 | |
- os: ubuntu | |
platform: linux | |
target: ppc64le | |
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 | |
- os: ubuntu | |
platform: linux | |
target: s390x | |
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 | |
exclude: | |
# Windows on arm64 only supports Python 3.11+ | |
- os: windows | |
target: aarch64 | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
architecture: ${{ matrix.python-architecture || 'x64' }} | |
- run: pip install -U twine | |
- name: build sdist | |
if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux == 'auto' }} | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
rust-toolchain: stable | |
- name: build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: ${{ matrix.manylinux || 'auto' }} | |
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 pypy3.8 pypy3.9 pypy3.10' }} | |
rust-toolchain: stable | |
- run: ${{ matrix.ls || 'ls -lh' }} dist/ | |
- run: twine check --strict dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.platform || matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux || 'auto' }} | |
path: dist | |
release: | |
needs: [build, check] | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
url: https://pypi.org/p/python-calamine/ | |
permissions: | |
id-token: write | |
steps: | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: wheels-* | |
merge-multiple: true | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |