-
Notifications
You must be signed in to change notification settings - Fork 7
69 lines (57 loc) · 1.76 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# This workflow will install Python dependencies and run the tests.
# Copyright (c) 2021-2024 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", "3.12", "3.13"]
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 }}