Repository navigation
85 lines (80 loc) · 2.71 KB
/
Copy pathpython-check.yaml
File metadata and controls
85 lines (80 loc) · 2.71 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Python Check
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
setup:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.setup.outputs.ref }}
repo: ${{ steps.setup.outputs.repo }}
checkout_path: ${{ steps.setup.outputs.checkout_path }}
has_changes: ${{ steps.setup.outputs.has_changes }}
steps:
- name: Workflow setup (Python relevance)
id: setup
uses: Framework-R-D/action-workflow-setup@f73307dd8c13cb66c2565c9ace32571517b1cea8 # v1
with:
include-globs: |
*.py
*.py.in
pyproject.toml
uv.lock
python-check:
needs: setup
if: >
always() && needs.setup.result == 'success' && (
github.event_name != 'pull_request' ||
needs.setup.outputs.has_changes == 'true'
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.setup.outputs.ref }}
path: ${{ needs.setup.outputs.checkout_path }}
repository: ${{ needs.setup.outputs.repo }}
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
python-version: "3.12"
- name: Run ruff check
working-directory: ${{ needs.setup.outputs.checkout_path }}
run: uv run --locked --group lint ruff check
- name: Run ruff format check
working-directory: ${{ needs.setup.outputs.checkout_path }}
run: uv run --locked --group lint ruff format --check
- name: Run mypy
working-directory: ${{ needs.setup.outputs.checkout_path }}
run: uv run --locked --group lint mypy .
python-test:
needs: setup
if: >
always() && needs.setup.result == 'success' && (
github.event_name != 'pull_request' ||
needs.setup.outputs.has_changes == 'true'
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.setup.outputs.ref }}
path: ${{ needs.setup.outputs.checkout_path }}
repository: ${{ needs.setup.outputs.repo }}
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
python-version: "3.12"
- name: Run tests with coverage
working-directory: ${{ needs.setup.outputs.checkout_path }}
run: |
uv run --locked --group test pytest tests/ -v \
--cov=. \
--cov-report=term-missing \
--cov-fail-under=80