-
Notifications
You must be signed in to change notification settings - Fork 0
202 lines (194 loc) · 5.94 KB
/
testing.yaml
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
name: CI Pipeline
on:
pull_request:
type: [ opened, synchronize ]
push:
branches: [ main ]
env:
WANDB_MODE: offline
SETUPTOOLS_ENABLE_FEATURES: legacy-editable
jobs:
pytest:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.9"
- "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: 'false'
submodules: 'recursive'
ssh-key: ${{ secrets.git_ssh_key }}
- name: Get changed files
uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
base: 'main'
filters: |
py_modified:
- added|modified: "./**/*.py"
- name: Setup Python
if: ${{ steps.filter.outputs.py_modified == 'true' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Setup Go
if: ${{ steps.filter.outputs.py_modified == 'true' }}
uses: actions/setup-go@v4
with:
go-version: '1.18.4'
- name: Install Python dependencies
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: pip install -e '.[modules, test]'
- name: Install CUE
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: go install cuelang.org/go/cmd/cue@latest
- name: Run pytest
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: coverage run -m py.test ./tests/unit
- name: Send coverage repot to codecov
uses: codecov/codecov-action@v3
if: ${{ steps.filter.outputs.py_modified == 'true' }}
with:
files: /home/runner/work/zetta_utils/zetta_utils/coverage.xml
pylint-isort:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.9"
- "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: 'false'
submodules: 'recursive'
ssh-key: ${{ secrets.git_ssh_key }}
- name: Get changed files
uses: dorny/paths-filter@v2
id: filter
with:
base: 'main'
list-files: shell
filters: |
py_modified:
- added|modified: "./**/*.py"
- name: Setup Python
if: ${{ steps.filter.outputs.py_modified == 'true' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install Python dependencies
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: pip install -e '.[modules, test]'
- name: Run pylint
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: pylint ${{ steps.filter.outputs.py_modified_files }}
- name: Run isort
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: isort --check-only --df --verbose --profile black .
mypy:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.9"
- "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: 'false'
submodules: 'recursive'
ssh-key: ${{ secrets.git_ssh_key }}
- name: Get changed files
uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
base: 'main'
filters: |
py_modified:
- added|modified: "./**/*.py"
- name: Setup Python
if: ${{ steps.filter.outputs.py_modified == 'true' }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install Python dependencies
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: pip install -e '.[modules, test]'
- name: Run mypy
if: ${{ steps.filter.outputs.py_modified == 'true' }}
run: mypy .
test-docs:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.9"
- "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: 'false'
submodules: 'recursive'
ssh-key: ${{ secrets.git_ssh_key }}
- name: Get changed files
uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
base: 'main'
filters: |
docs_modified:
- added|modified: "./**/*.rst"
py_modified:
- added|modified: "./**/*.py"
- name: Setup Python
if: ${{ steps.filter.outputs.docs_modified == 'true' || steps.filter.outputs.py_modified == 'true'}}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install Python dependencies
if: ${{ steps.filter.outputs.docs_modified == 'true' || steps.filter.outputs.py_modified == 'true'}}
run: pip install -e '.[modules, docs]'
- name: Doctest
if: ${{ steps.filter.outputs.docs_modified == 'true' || steps.filter.outputs.py_modified == 'true'}}
run: make -C docs doctest
- name: Build Docs
if: ${{ steps.filter.outputs.docs_modified == 'true' || steps.filter.outputs.py_modified == 'true'}}
run: make -C docs html
all-checks-test:
runs-on: ubuntu-20.04
needs: [mypy, pytest, pylint-isort, test-docs]
if: always()
steps:
- name: Success
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failure
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1