-
Notifications
You must be signed in to change notification settings - Fork 20
91 lines (79 loc) · 2.46 KB
/
test.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
name: Code Quality and Tests
on: [push, pull_request]
env:
PYTHON_VERSION: "3.9"
PROJECT_FOLDER: ./rajinipp
TEST_FOLDER: tests
COVERAGE_LIMIT: 60
jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry && poetry install
- name: Lint with flake8
uses: ricardochaves/python-lint@v1.4.0
with:
python-root-list: ${{env.PROJECT_FOLDER}}
use-pylint: false
use-pycodestyle: false
use-flake8: true
use-black: false
use-mypy: false
use-isort: false
extra-flake8-options: "--max-line-length 79 --max-complexity 15 --config .flake8"
- name: Black formatting check
uses: psf/black@stable
with:
options: "--line-length 79"
src: ${{env.PROJECT_FOLDER}}
version: "22.3.0"
code-coverage:
needs: code-quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry && poetry install
- name: Tests with pytest
run: |
poetry install
poetry run pytest ${{env.TEST_FOLDER}} --cov-report=xml --cov=${{env.PROJECT_FOLDER}} --junitxml=./coverage.xml
- name: Code Coverage Summary Report
run: |
pip install coverage
coverage combine && coverage report --fail-under=${{env.COVERAGE_LIMIT}} -m
coverage html
- name: Archive code coverage html report
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: htmlcov/index.html
build-test:
needs: code-coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry build