-
Notifications
You must be signed in to change notification settings - Fork 0
213 lines (205 loc) · 8.5 KB
/
python.yml
File metadata and controls
213 lines (205 loc) · 8.5 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: Python Projects CI
on:
push:
branches: [ main ]
paths:
- 'asap-summary-ingest/**'
- 'asap-tools/queriers/prometheus-client/**'
- 'asap-tools/**'
- 'asap-tools/data-sources/prometheus-exporters/**'
- 'asap-tools/execution-utilities/**'
- 'asap-common/dependencies/py/**'
- '.github/workflows/python.yml'
pull_request:
branches: [ main ]
paths:
- 'asap-summary-ingest/**'
- 'asap-tools/queriers/prometheus-client/**'
- 'asap-tools/**'
- 'asap-tools/data-sources/prometheus-exporters/**'
- 'asap-tools/execution-utilities/**'
- 'asap-common/dependencies/py/**'
- '.github/workflows/python.yml'
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
summary_ingest: ${{ steps.filter.outputs.summary_ingest }}
prometheus_client: ${{ steps.filter.outputs.prometheus_client }}
utilities: ${{ steps.filter.outputs.utilities }}
prometheus_exporters: ${{ steps.filter.outputs.prometheus_exporters }}
execution_utilities: ${{ steps.filter.outputs.execution_utilities }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
summary_ingest:
- 'asap-summary-ingest/**'
- 'asap-common/dependencies/py/**'
prometheus_client:
- 'asap-tools/queriers/prometheus-client/**'
- 'asap-common/dependencies/py/**'
utilities:
- 'asap-tools/**'
- 'asap-common/dependencies/py/**'
prometheus_exporters:
- 'asap-tools/data-sources/prometheus-exporters/**'
- 'asap-common/dependencies/py/**'
execution_utilities:
- 'asap-tools/execution-utilities/**'
- 'asap-common/dependencies/py/**'
test-summary-ingest:
needs: detect-changes
if: needs.detect-changes.outputs.summary_ingest == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0
if [ -f asap-summary-ingest/requirements.txt ]; then pip install -r asap-summary-ingest/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-summary-ingest
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-summary-ingest
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../.flake8 --count --exit-zero --max-complexity=10 --statistics
test-prometheus-client:
needs: detect-changes
if: needs.detect-changes.outputs.prometheus_client == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0 mypy types-requests types-PyYAML typing-extensions numpy prometheus-client urllib3
if [ -f asap-tools/queriers/prometheus-client/requirements.txt ]; then pip install -r asap-tools/queriers/prometheus-client/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools/queriers/prometheus-client
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-tools/queriers/prometheus-client
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../../../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../../../.flake8 --count --exit-zero --max-complexity=10 --statistics
- name: Type check with mypy
working-directory: asap-tools/queriers/prometheus-client
run: mypy .
test-utilities:
needs: detect-changes
if: needs.detect-changes.outputs.utilities == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0
if [ -f asap-tools/requirements.txt ]; then pip install -r asap-tools/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-tools
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../.flake8 --count --exit-zero --max-complexity=10 --statistics
test-prometheus-exporters:
needs: detect-changes
if: needs.detect-changes.outputs.prometheus_exporters == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0 mypy isort
if [ -f asap-tools/data-sources/prometheus-exporters/requirements.txt ]; then pip install -r asap-tools/data-sources/prometheus-exporters/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools/data-sources/prometheus-exporters
run: black --check --diff .
- name: Check import sorting with isort
working-directory: asap-tools/data-sources/prometheus-exporters
run: isort --check-only --diff --settings-file .isort.cfg .
- name: Lint with flake8
working-directory: asap-tools/data-sources/prometheus-exporters
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../../../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../../../.flake8 --count --exit-zero --max-complexity=10 --statistics
- name: Type check with mypy
working-directory: asap-tools/data-sources/prometheus-exporters
run: mypy . --config-file=.mypy.ini
test-execution-utilities:
needs: detect-changes
if: needs.detect-changes.outputs.execution_utilities == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.8.0 flake8==6.1.0
if [ -f asap-tools/execution-utilities/requirements.txt ]; then pip install -r asap-tools/execution-utilities/requirements.txt; fi
- name: Check formatting with Black
working-directory: asap-tools/execution-utilities
run: black --check --diff .
- name: Lint with flake8
working-directory: asap-tools/execution-utilities
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --config=../../.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --config=../../.flake8 --count --exit-zero --max-complexity=10 --statistics