-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.63 KB
/
python-package.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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.5.1"
- 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) }}