-
Notifications
You must be signed in to change notification settings - Fork 7
88 lines (70 loc) · 2.77 KB
/
lint-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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Lint and test
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 8 * * 6' # every saturday at 8:00
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
async-requirements.txt
dev-requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
pip install -r async-requirements.txt
pip install -r dev-requirements.txt
pip install pytest-github-actions-annotate-failures
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 codingame tests examples --count --select=E9,F63,F7,F82 --show-source --statistics \
--format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'
# exit-zero treats all errors as warnings
flake8 codingame tests examples --count --exit-zero --statistics \
--format='::warning file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'
- name: Check formatting with black
run: |
black codingame tests examples --check --line-length 80
- name: Check import ordering with isort
run: |
isort codingame tests examples --check-only
- name: Lint the docs with doc8
run: |
doc8 docs --quiet
- name: Check package build
run: |
python setup.py --quiet sdist
twine check dist/*
- name: Test the mocked API endpoints with pytest
run: |
pytest --only-mocked --overwrite-environ -v
- name: Test with pytest without mocking API enpoints
env:
TEST_LOGIN_REMEMBER_ME_COOKIE: ${{ secrets.TEST_LOGIN_REMEMBER_ME_COOKIE }}
TEST_CODINGAMER_ID: ${{ secrets.TEST_CODINGAMER_ID }}
TEST_CODINGAMER_PSEUDO: ${{ secrets.TEST_CODINGAMER_PSEUDO }}
TEST_CODINGAMER_PUBLIC_HANDLE: ${{ secrets.TEST_CODINGAMER_PUBLIC_HANDLE }}
TEST_CLASHOFCODE_PUBLIC_HANDLE: ${{ secrets.TEST_CLASHOFCODE_PUBLIC_HANDLE }}
run: |
pytest --no-mocking --cov-append -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true