-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (99 loc) · 3.06 KB
/
continuous-integration.yml
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
name: CI
on:
pull_request:
env:
HATCH_VERSION: "v1.7.0" # keep in sync with deploy.yml
jobs:
format-black:
name: Format black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run black
run: hatch run code-quality:format
mypy:
name: MyPy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run mypy
run: hatch run code-quality:types
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run pylint
run: hatch run code-quality:lint
isort:
name: Sort imports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run mypy
run: hatch run code-quality:sort
pydocstyle:
name: Check docstrings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run pydocstyle
run: hatch run code-quality:docstrings
scan-for-secrets:
name: Scan for secrets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gitleaks
run: wget -O - https://github.com/gitleaks/gitleaks/releases/download/v8.16.1/gitleaks_8.16.1_linux_x64.tar.gz | tar -xz
- run: ./gitleaks detect --log-opts "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
if: github.event_name == 'pull_request'
- run: ./gitleaks detect --log-opts "${{ github.event.before }}..${{ github.event.after }}"
if: github.event_name == 'push'
tests:
name: Tests
runs-on: ubuntu-latest
env:
API_KEY: "not-a-real-api-key"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run unit tests
run: hatch run test:unit-with-cov
- name: Coverage comment
if: github.event_name == 'push' || github.event_name == 'pull_request'
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@e6ee17f632217eae267a13fbeb4389dce5dc4a26
with:
GITHUB_TOKEN: ${{ github.token }}