Repository navigation
88 lines (76 loc) · 3.27 KB
/
Copy pathmain.yml
File metadata and controls
88 lines (76 loc) · 3.27 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
name: Patterns
on: [push]
jobs:
build:
name: Inspecting
runs-on: ubuntu-latest
strategy:
max-parallel: 8
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- 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 -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
printf "\n"
echo "============================= flake8 session starts =============================="
# Stop the build if there are Python syntax errors or undefined names
printf "\n"
echo "Issues in relation to logic (F7), syntax (Python E9, Flake F7), mathematical
formulae symbols (F63), undefined variable names (F82):"
echo "src/functions"
flake8 --count --select E9,F63,F7,F82 --show-source --statistics src/functions
echo "src/images"
flake8 --count --select E9,F63,F7,F82 --show-source --statistics src/images
echo "src/modelling"
flake8 --count --select E9,F63,F7,F82 --show-source --statistics src/modelling
echo "src/sampling"
flake8 --count --select E9,F63,F7,F82 --show-source --statistics src/sampling
# Herein, --exit-zero treats all errors as warnings. Note, the GitHub editor is 127 characters wide
printf "\n"
echo "Complexity issues:"
echo "src/functions"
flake8 --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics src/functions
echo "src/images"
flake8 --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics src/images
echo "src/modelling"
flake8 --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics src/modelling
echo "src/sampling"
flake8 --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics src/sampling
- name: Lint with pylint
run: |
pip install pylint
printf "\n"
echo "============================= pylint session starts =============================="
# pylint
printf "\n"
echo "src/functions"
pylint --rcfile .pylintrc src/functions
echo "src/images"
pylint --rcfile .pylintrc src/images
echo "src/modelling"
pylint --rcfile .pylintrc src/modelling
echo "src/sampling"
pylint --rcfile .pylintrc src/sampling
- name: Test with pytest
run: |
pip install pytest
printf "\n"
echo "============================= pytest session starts =============================="
printf "\npytest -o python_files=test_*.py"
- name: Coverage with pytest-cov
run: |
pip install coverage
pip install pytest-cov
printf "\n"
echo "============================= coverage session starts =============================="
printf "\nUpcoming: pytest --cov src/functions tests/functions\netc."