Point linter to project dir #100
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: | |
test: | |
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 -r requirements_dev.txt | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
- name: Lint with ruff | |
uses: chartboost/ruff-action@v1 | |
with: | |
src: "./foosball" | |
- 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 |