-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (73 loc) · 2.52 KB
/
code-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
---
# lint and test config and script files
name: Code
on: # yamllint disable-line rule:truthy
push:
paths-ignore:
- '**.md'
- '**/.gitignore'
env:
# Nothing to do with the images, this is the version used by scripts/linters
PYTHON_VERSION: '3.8'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache pip downloads
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }}
- name: Cache pipenv virtualenvs
id: pipenv-cache
uses: actions/cache@v1
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install pipenv
run: pip install --upgrade pipenv
- name: Install test dependencies
if: steps.pipenv-cache.outputs.cache-hit != 'true'
run: pipenv install --dev
- name: Run yamllint code linter
run: pipenv run yamllint --config-file=.yamllint .
- name: Run isort import sorter
run: pipenv run isort --settings-path=setup.cfg --check-only --diff
- name: Run black code formatter
run: pipenv run black --config=pyproject.toml --check --diff .
- name: Run pylama code linter
run: pipenv run pylama --options=setup.cfg .
- name: Run mypy type checker
run: pipenv run mypy --config-file=setup.cfg .
test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache pip downloads
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }}
- name: Cache pipenv virtualenvs
id: pipenv-cache
uses: actions/cache@v1
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install pipenv
run: pip install --upgrade pipenv
- name: Install test dependencies
if: steps.pipenv-cache.outputs.cache-hit != 'true'
run: pipenv install --dev
- name: Run pytest
run: pipenv run pytest --cov-config=setup.cfg --cov