-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (135 loc) · 3.82 KB
/
python-test-scan.yml
File metadata and controls
137 lines (135 loc) · 3.82 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
name: Python Tests and Scans
on:
push:
paths:
- .github/workflows/python-test-scan.yml
- req/**
- src/**
- test/**
pull_request:
paths:
- req/**
- src/**
- test/**
workflow_dispatch:
jobs:
pytest-cov:
name: Unit Test with Pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r req/requirements.txt --upgrade
pip install -r req/pytest.txt --upgrade
- run: pytest --help
- run: pytest --cov=src --cov-report=json:code-coverage.json
- name: artifact-html-report
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: Coverage Report HTML
path: cov-html
- name: artifact-json-report
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: Coverage Report JSON
path: code-coverage.json
isort:
name: Import Checks with ISort
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r req/requirements.txt --upgrade
pip install isort --upgrade
- run: python3 -m isort src --check --diff
- run: python3 -m isort test --check --diff
if: ${{ always() }}
black:
name: Code Format with Black
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r req/requirements.txt --upgrade
pip install black --upgrade
- run: black --check src --diff
- run: black --check test --diff
if: ${{ always() }}
ruff-fmt:
name: Code Format with Ruff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Ruff format
uses: chartboost/ruff-action@v1
with:
src: src test
args: format --diff
mypy:
name: Type Checks with Mypy
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r req/requirements.txt --upgrade
pip install -r req/mypy.txt --upgrade
- run: mypy --python-version 3.10
if: ${{ always() }}
- run: mypy --python-version 3.11
if: ${{ always() }}
- run: mypy --python-version 3.12
if: ${{ always() }}
- run: mypy --python-version 3.13
if: ${{ always() }}
- run: mypy --python-version 3.14
if: ${{ always() }}
ruff:
name: Linter Checks with Ruff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v6
- name: Ruff src
uses: chartboost/ruff-action@v1
with:
src: src
args: check --output-format=full
- name: Ruff src diff
uses: chartboost/ruff-action@v1
if: ${{ always() }}
with:
src: src
args: check --diff
- name: Ruff test
uses: chartboost/ruff-action@v1
if: ${{ always() }}
with:
src: test
args: check --output-format=full
- name: Ruff test diff
uses: chartboost/ruff-action@v1
if: ${{ always() }}
with:
src: test
args: check --diff