Skip to content

Merge pull request #29 from sachinshaji/master #147

Merge pull request #29 from sachinshaji/master

Merge pull request #29 from sachinshaji/master #147

Workflow file for this run

# This workflow will install all necessary Python dependencies and run the unit tests
# SPDX-FileCopyrightText: (c) 2022-2023 Siemens
# SPDX-License-Identifier: MIT
name: Unit tests
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# update pip
python -m pip install --upgrade pip
# install poetry
python -m pip install poetry
# install all dependencies using poetry
poetry install --no-root
- name: Test with pytest
run: |
# run tests with coverage and pytest
poetry run coverage run -m pytest
poetry run coverage report -m --omit "*/site-packages/*.py",*/tests/*
poetry run coverage html --omit "*/site-packages/*.py",*/tests/*
poetry run coverage xml --omit "*/site-packages/*.py"
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '50 75'
- name: Write to Job Summary
run: |
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Create test coverage badge
uses: gaelgirodon/ci-badges-action@v1
with:
gist-id: 6ab639b6f9d1f6161d3db52d348d2997
token: ${{ secrets.GIST_TOKEN_SW360PYTHON }}