[pre-commit.ci] pre-commit autoupdate (#395) #193
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
name: Python Package | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
merge_group: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.12" | |
- "3.13" | |
steps: | |
- name: Checkout Repo | |
uses: actions/[email protected] | |
- name: Setup uv | |
uses: astral-sh/[email protected] | |
with: | |
enable-cache: true | |
version: "0.4.10" | |
- name: Pin python version to ${{ matrix.python-version }} | |
run: uv python pin ${{ matrix.python-version }} | |
- name: Sanity check Python version | |
# https://docs.python.org/3/using/cmdline.html#cmdoption-version | |
run: | | |
uv run python --version --version | |
[[ "$(uv run python --version)" == Python\ ${{ matrix.python-version }}* ]] | |
- name: Check format (ruff) | |
run: uv run ruff format --check . | |
- name: Lint (ruff) | |
run: uv run ruff check --output-format=github . | |
- name: Check types (mypy) | |
run: uv run mypy . | |
- name: Run tests | |
run: uv run pytest --cov=. --cov-report=xml | |
# consider ditching codecov - https://hynek.me/articles/ditch-codecov-python/ | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
check: | |
if: always() | |
runs-on: Ubuntu-latest | |
needs: | |
- build | |
steps: | |
- name: Print job results | |
run: echo '${{ toJSON(needs) }}' | |
- name: Check if all jobs succeeded | |
uses: re-actors/[email protected] | |
with: | |
jobs: ${{ toJSON(needs) }} |