-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (53 loc) · 1.57 KB
/
test.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
# Copyright (c) 2023-2024 tracetronic GmbH
#
# SPDX-License-Identifier: MIT
name: Test
run-name: Run unit tests with coverage analysis
on:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
matrix:
py_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py_version }}
- name: Install virtual environment
run: pip3 install poetry
- name: Ensure Python version
run: poetry env use ${{ matrix.py_version }}
- name: Install dependencies
run: poetry install --without workflow --no-root
- name: Execute Tests and create test coverage report
run: poetry run pytest tests --cov=testguide_report_generator --cov-report=xml:coverage.xml
- name: Execute Test
run: poetry run pytest tests
- name: Upload test coverage report
uses: actions/upload-artifact@v3
with:
name: test-coverage-report
path: coverage.xml
publish-coverage:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
needs: test
steps:
- name: Download test coverage report
uses: actions/download-artifact@v3
with:
name: test-coverage-report
- name: Get Cover
uses: orgoro/coverage@v3
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.99