-
Notifications
You must be signed in to change notification settings - Fork 30
205 lines (180 loc) · 5.55 KB
/
ci.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
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
name: CI
on: [push]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
cache: "pip"
- uses: pre-commit/[email protected]
pylint:
runs-on: ubuntu-latest
name: Pylint test
strategy:
matrix:
python-version: ["3.8", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Analysing the code with pylint
run: |
pylint --rcfile=.pylintrc src/kili
pyright:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["3.8", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run pyright
run: pyright .
unit-integration-test:
timeout-minutes: 15
name: Unit and integration tests
strategy:
matrix:
include:
- os: ubuntu-latest
python-version: 3.8
- os: windows-latest
python-version: 3.8
- os: ubuntu-latest
python-version: 3.12
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Unit and integration tests
run: pytest -n auto -ra -sv --color yes --code-highlight yes --durations=15 -vv --ignore tests/e2e/ --cov=src/kili --cov-report=term-missing --cov-config=.coveragerc --cov-fail-under=83
markdown-link-check:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lycheeverse/[email protected]
with:
fail: true
debug: false
args: "-qq --no-progress --insecure './**/*.md' './src/kili/**/*.py'"
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build
run: |
python -m build
- name: Test the Build
run: |
python -m pip install . # to install dependencies
python -m pip uninstall -y kili
python -m pip install --find-links=dist --no-index kili
python -c 'from kili.client import Kili; k=Kili(); print("Everything OK!")'
env:
KILI_API_ENDPOINT: https://cloud.kili-technology.com/api/label/v2/graphql
KILI_API_KEY: ${{ secrets.KILI_USER_API_KEY_PROD }}
doc-build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Build
run: |
mkdocs build
- name: Look for Warnings
run: |
mkdocs build 2>&1 | tee doc-build.log
if grep -q "WARNING" doc-build.log; then
echo $(grep "WARNING" doc-build.log)
echo "::error::Documentation build completed with warnings"
exit 1
else
echo "Documentation build completed successfully"
fi
find-dead-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Find dead code with vulture
run: vulture src/kili tests 2>&1 | tee dead_code.txt
- name: Find dead code with dead
run: dead 2>&1 | tee -a dead_code.txt
- name: Filter dead code
run: |
cat dead_code.txt | \
grep -e "src/kili" | \
grep -v \
-e "is only referenced in tests" \
-e "_ is never read" \
-e "affected_rows" \
-e "src/kili/orm" \
-e "src/kili/entrypoints" \
-e "src/kili/services" \
-e "src/kili/types.py" \
-e "src/kili/core/graphql/ws_graphql_client" \
-e "internal" \
-e "src/kili/domain/ontology.py" \
-e "src/kili/domain/annotation.py" \
-e "src/kili/domain/project.py" \
> dead_code_filtered.txt || true
- name: Crash if dead code found
run: |
if [ $(cat dead_code_filtered.txt | wc -l) -gt 0 ]; then
cat dead_code_filtered.txt
exit 1
else
echo "No dead code found"
fi