-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (48 loc) · 1.89 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
name: Tests
on: [pull_request, push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore venv cache
uses: actions/cache@v3
id: cache-venv # name for referring later
with:
path: .venv # what we cache: the virtualenv
# The cache key depends on requirements.txt
key: ${{ runner.os }}-${{ matrix.python-version }}-venv-${{hashFiles('requirements*.txt')}}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-venv-
# Build a virtualenv, but only if it doesn't already exist
- name: Install dependencies (if changed)
run: |
python -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
pip install flake8
pip install -r requirements_dev.txt
if: steps.cache-venv.outputs.cache-hit != 'true'
- name: Lint with flake8
run: |
. .venv/bin/activate
# stop the build if there are Python syntax errors or undefined names
flake8 foosball --count --select=E9,F63,F7,F82 --show-source --statistics --config tests/setup.cfg
flake8 foosball --count --exit-zero --max-complexity=10 --statistics --config tests/setup.cfg
- name: Test with pytest
run: |
. .venv/bin/activate
coverage run --concurrency=multiprocessing -m pytest && coverage combine && coverage report -m && coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: false
files: coverage.xml