Merge pull request #71 from sachinshaji/main #171
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
# This workflow will install Python dependencies and run the tests. | |
# Copyright (c) 2021-2023 Siemens | |
# Author: [email protected] | |
# SPDX-License-Identifier: MIT | |
name: Unit Tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
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: | | |
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 | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
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: c8f15831ecdcf6e86ab2b69cbb2d4f89 | |
token: ${{ secrets.GIST_TOKEN }} |