Unit tests #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI - Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U setuptools wheel flit | |
pip install .[dev] | |
- name: Test with pre-commit | |
run: SKIP=pylint pre-commit run --all-files | |
pylint-safety: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel flit | |
pip install -e .[dev] | |
pip install safety | |
- name: Run pylint | |
run: pylint --rcfile=pyproject.toml --extension-pkg-whitelist='pydantic' -- s7 | |
- name: Run safety | |
run: pip freeze | safety check --stdin | |
build-package: | |
name: Build distribution package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel flit | |
- name: Check building distribution | |
run: flit build | |
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 }} |