-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (84 loc) · 2.62 KB
/
python.yml
File metadata and controls
88 lines (84 loc) · 2.62 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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python
on:
push:
branches:
- master
paths:
- .github/actions/setup-python/action.yml
- .github/workflows/python.yml
- .python-version
- requirements.txt
- requirements.lock
- pyproject.toml
- python/**/*.py
pull_request:
paths:
- .github/actions/setup-python/action.yml
- .github/workflows/python.yml
- .python-version
- requirements.txt
- requirements.lock
- pyproject.toml
- python/**/*.py
permissions:
contents: read
pull-requests: read
jobs:
change-detection:
runs-on: ubuntu-latest
outputs:
python-changes: ${{ steps.change-detection.outputs.python }}
steps:
- uses: actions/checkout@v6
- name: Change Detection
uses: dorny/paths-filter@v4
id: change-detection
with:
filters: |
python:
- .github/actions/setup-python/action.yml
- .github/workflows/python.yml
- .python-version
- requirements.txt
- requirements.lock
- pyproject.toml
- python/**/*.py
flake8:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: change-detection
if: needs.change-detection.outputs.python-changes == 'true'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-python
- name: flake8
working-directory: ./python
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
unittest:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: change-detection
if: needs.change-detection.outputs.python-changes == 'true'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-python
- name: UnitTest
working-directory: ./python
run: python -m unittest discover ./test
mypy:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: change-detection
if: needs.change-detection.outputs.python-changes == 'true'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-python
- name: mypy
working-directory: ./python
run: mypy .