Skip to content

ci: add coverage test #31

ci: add coverage test

ci: add coverage test #31

Workflow file for this run

name: Run unit tests
on:
push:
pull_request:
jobs:
test:
name: python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Poetry
run: |
PIPX_BIN_DIR=/usr/local/bin pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: poetry.lock
- name: Set Poetry environment
run: |
poetry env use ${{ matrix.python-version }}
- name: Install dependencies
run: |
poetry install
- name: Run tests
run: |
poetry run pytest -v
- name: Measure coverage
if : ${{ github.event_name == 'push' && github.ref == github.event.repository.default_branch }}
run: |
poetry run pytest -v --cov --cov-report=xml
- name: Upload to Codecov
if : ${{ github.event_name == 'push' && github.ref == github.event.repository.default_branch }}
uses: codecov/codecov-action@v4
with:
directory: ./coverage/reports/
env_vars: OS,PYTHON
fail_ci_if_error: false
files: ./coverage.xml
name: python-woc
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true