Skip to content

build: Update codecov #272

build: Update codecov

build: Update codecov #272

Workflow file for this run

name: Test
on:
push:
paths:
- 'scripts/*'
- 'streamdeck_ui/*'
- 'tests/*'
- '.github/workflows/test.yaml'
pull_request:
paths:
- 'scripts/*'
- 'streamdeck_ui/*'
- 'tests/*'
- '.github/workflows/test.yaml'
workflow_dispatch:
workflow_call:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --no-ansi
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction --no-ansi
#----------------------------------------------
# Install required libraries for ImageQt
# This avoids:
# ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt'
#----------------------------------------------
- name: Install library
run: |
sudo apt-get update
sudo apt-get install -y libegl1 libgl1 libxkbcommon0
#----------------------------------------------
# run Lint tests
#----------------------------------------------
- name: Lint
run: ./scripts/lint.sh
# Install required libraries for pytest-qt
# This avoids:
# qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
# https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions
#----------------------------------------------
# install qt libraries
#----------------------------------------------
- uses: tlambert03/setup-qt-libs@v1
#----------------------------------------------
# Add pytest-xvfb to run pytest-qt in headless mode
#----------------------------------------------
- name: Add pytest-xvfb
run: poetry add pytest-xvfb
#----------------------------------------------
# run test suite and output coverage file
#----------------------------------------------
- name: Test
run: bash -c "poetry run pytest tests/ -s --cov=streamdeck_ui/ --cov-report=term-missing ${@-}"
#----------------------------------------------
# generate coverage stats
#----------------------------------------------
- name: Generate Coverage Report
run: poetry run coverage xml
#----------------------------------------------
# upload coverage stats
#----------------------------------------------
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}