-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.26 KB
/
code-quality.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
name: Code quality checks
on:
pull_request:
push:
branches: ['main']
jobs:
code-quality:
name: Code quality checks
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: '.python-version'
- name: Install dependencies
run: pip install .[dev]
- name: Run unit tests
run: |
python -m unittest discover -v -s "./epymorph" -p "*_test.py"
- name: Check imports and formatting
run: |
if isort --check .; then
imp_result=0
else
echo "isort detected inconsistent import sorting"
echo "check that isort is running on your machine!"
imp_result=1
fi
if autopep8 --recursive --in-place --exit-code .; then
fmt_result=0
else
echo "autopep8 detected inconsistent code formatting"
echo "check that autopep8 is running on your machine!"
fmt_result=1
fi
if [[ $fmt_result -ne 0 || $imp_result -ne 0 ]]; then
exit 1
else
echo "All checks passed."
exit 0
fi