Repository navigation
99 lines (75 loc) · 3.13 KB
/
Copy pathmain.yml
File metadata and controls
99 lines (75 loc) · 3.13 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
89
90
91
92
93
94
95
96
97
98
99
name: Reader Project
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
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 =============================="
printf "\n"
# stop the build if there are Python syntax errors or undefined names
echo "Issues in relation to logic (F7), syntax (Python E9, Flake F7), mathematical
formulae symbols (F63), undefined variable names (F82):"
printf "\n ************* src/io\n"
flake8 --count --select E9,F63,F7,F82 --show-source --statistics src/io
printf "\n ************* src/read\n"
flake8 --count --select E9,F63,F7,F82 --show-source --statistics src/read
printf "\n ************* src/main.py\n"
flake8 --count --select E9,F63,F7,F82 --show-source --statistics src/main.py
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
printf "\n"
echo "Complexity Scores:"
printf "\n ************* src/io\n"
flake8 --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics src/io
printf "\n ************* src/read\n"
flake8 --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics src/read
printf "\n ************* src/main.py\n"
flake8 --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics src/main.py
- name: Lint with pylint
run: |
pip install pylint
printf "\n"
echo "============================= pylint session starts =============================="
printf "\n ************* Package src/io"
pylint --rcfile .pylintrc src/io
printf "\n ************* Module src.main"
pylint --rcfile .pylintrc src/main.py
- name: Test with pytest
run: |
pip install pytest
pytest -o python_files=test_*.py
- name: Coverage with pytest-cov
run: |
pip install coverage
pip install pytest-cov
pytest --cov src/io tests/io
pytest --cov src/read tests/read
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build . --file Dockerfile --tag greyhypotheses/reader:python
- name: Push the image to Docker Hub
run: |
docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_ENTRY}"
docker push greyhypotheses/reader:python
env:
DOCKER_HUB_USERNAME: ${{secrets.DOCKER_HUB_USERNAME}}
DOCKER_HUB_ENTRY: ${{secrets.DOCKER_HUB_ENTRY}}