-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (119 loc) · 3.79 KB
/
Copy pathci.yml
File metadata and controls
145 lines (119 loc) · 3.79 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
PYTHON_VERSION: "3.11"
jobs:
format:
name: Format check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pre-commit
- name: Run formatting hooks (black, isort)
run: SKIP=pydocstyle pre-commit run --all-files
- name: Run docstring check (pydocstyle)
# Advisory: large pre-existing numpy-style docstring backlog, tracked
# separately. Runs and reports, but does not block CI (like pyright/vulture).
continue-on-error: true
run: pre-commit run --all-files pydocstyle
type-check:
name: Type check and static analysis
runs-on: ubuntu-latest
env:
PYTHONPATH: ${{ github.workspace }}/src
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test,typecheck]
- name: Run flake8
run: python -m flake8 src
- name: Run pydocstyle
continue-on-error: true
run: python -m pydocstyle src/tnfr
- name: Run mypy
# Advisory: large pre-existing type-annotation backlog (1200+ findings),
# tracked separately. Runs and reports, but does not block CI.
continue-on-error: true
run: python -m mypy src/tnfr
- name: Run pyright
run: python -m pyright src/tnfr
continue-on-error: true
- name: Run vulture
run: python -m vulture --min-confidence 80 src tests
continue-on-error: true
changelog:
name: Changelog fragments
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Fetch base branch
run: git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
- name: Enforce changelog fragments
run: python3 scripts/check_changelog.py --base origin/${{ github.event.pull_request.base.ref }}
tests:
name: Python ${{ matrix.python-version }} tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
env:
PYTHONPATH: ${{ github.workspace }}/src
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test,numpy,yaml,orjson]
- name: Run docstring lint
if: matrix.python-version == '3.11'
continue-on-error: true
run: python -m pydocstyle src/tnfr
- name: Run unit tests
if: matrix.python-version != '3.11'
run: python -m pytest
- name: Run unit tests with coverage
if: matrix.python-version == '3.11'
run: |
python -m coverage run --source=src -m pytest
python -m coverage report -m