Skip to content

[CI] Add test coverage reporting #392

[CI] Add test coverage reporting

[CI] Add test coverage reporting #392

Workflow file for this run

name: pytests

Check failure on line 1 in .github/workflows/pytests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/pytests.yml

Invalid workflow file

(Line: 21, Col: 15): Expected format {org}/{repo}[/path]@ref. Actual 'gardenlinux/python-gardenlinux-lib/.github/actions/setup'
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Gardenlinux
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup
- name: Activate caching based on lockfile
id: lockfile
run: |
if [ -f poetry.lock ]; then
echo "cache_type=poetry" >> $GITHUB_OUTPUT
elif [ -f requirements.txt ]; then
echo "cache_type=pip" >> $GITHUB_OUTPUT
else
# no lockfile present: create empty requirements.txt and use pip caching
touch requirements.txt
echo "cache_type=pip" >> $GITHUB_OUTPUT
fi
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: poetry install --with dev
- name: Prepare environment
run: make install-test
- name: Run tests
run: |
export GLOCI_REGISTRY_TOKEN="invalid"
make test-coverage-ci
- name: Check for report
run: test -f coverage.xml
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}