Skip to content

A reusable workflow to build and run the unit test suite #1

A reusable workflow to build and run the unit test suite

A reusable workflow to build and run the unit test suite #1

# This workflow will install Python dependencies, run tests,
# and report test results and code coverage as artifacts. It will
# be called by the workflow that runs tests against new PRs and as
# a first step in the workflow that publishes new Docker images.
name: A reusable workflow to build and run the unit test suite
on:
workflow_call:
secrets:
codecov_token:
required: true
workflow_dispatch:
jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
name: Python ${{ matrix.python-version }} tests
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.3.2
- name: Install ncompare
run: poetry install
- name: Lint
run: |
poetry run ruff check ncompare
- name: Run tests with coverage
run: |
poetry run pytest --cov=ncompare --cov-report=xml:build/reports/coverage${{ matrix.python-version }}.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true