-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (40 loc) · 1.62 KB
/
run_unit_tests.yml
File metadata and controls
42 lines (40 loc) · 1.62 KB
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
name: Run unit tests
on:
workflow_call:
workflow_dispatch:
jobs:
run_unit_tests:
name: Run unit tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ["3.10", 3.11, 3.12, 3.13]
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
# incomplete JUnit XML results.
fail-fast: false
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: ni/python-actions/setup-python@a2894c635a2cba635a1086c1f89796fec2c52f74 # 0.7.2
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@a2894c635a2cba635a1086c1f89796fec2c52f74 # 0.7.2
- name: Cache virtualenv
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: .venv
key: nipanel-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install nipanel
run: poetry install -v
- name: Run unit tests and code coverage
run: poetry run pytest ./tests/unit -v --cov=nipanel --junitxml=test_results/nipanel-${{ matrix.os }}-py${{ matrix.python-version }}.xml
- name: Upload test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: test_results_unit_${{ matrix.os }}_py${{ matrix.python-version }}
path: ./test_results/*.xml
if: always()