Refactor kwargs parsing and passing #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [pull_request, push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache OpenCV | |
uses: UrielCh/opencv-cache-action@V1 | |
with: | |
branch: 4.x | |
BUILD_LIST: core | |
NO_CONTRIB: '' | |
- 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 |