Skip to content

Unit tests

Unit tests #27

Workflow file for this run

name: CI - Tests
on:
pull_request:
push:
branches:
- 'main'
jobs:
basics:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected]
with:
# General
install_extras: '[dev]'
# pre-commit
run_pre-commit: true
python_version_pre-commit: '3.9'
skip_pre-commit_hooks: pylint,pylint-tests
# pylint & safety
python_version_pylint_safety: '3.9'
run_pylint: true
pylint_targets: s7
pylint_options: |
--rcfile=pyproject.toml
--extension-pkg-whitelist='pydantic'
--recursive=yes
run_safety: true
# Build Python package
run_build_package: true
python_version_package: '3.9'
build_libs: flit
build_cmd: flit build
# Documentation
run_build_docs: false
pytest:
name: pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel flit
pip install -e .[dev]
- name: Run pytest
run: pytest -v -rs --cov=s7 --cov-report=xml --cov-report=term-missing
- name: Upload code coverage report
if: github.repository == 'SINTEF/soft7' && matrix.python-version == '3.9'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
flags: pytest
token: ${{ secrets.CODECOV_TOKEN }}