-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (31 loc) · 954 Bytes
/
main.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
name: CI
on: [push]
jobs:
tests:
name: "Tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Check code quality and run unit tests
run: |
# Install software
sudo apt-get install jq
pip install coverage mypy black
# Run tests one at a time
find $(pwd -P) -name code.py | sort -r | while read FILE;
do
echo "Processing $FILE"
cd $(dirname ${FILE})
# Check code quality
black --check code.py
mypy code.py
# Check code coverage
coverage run -m unittest code.py && coverage json
if [[ ! "$(cat coverage.json | jq .totals.percent_covered)" == "100" ]]; then
echo "Coverage is below 100%"
exit 1
fi
done