-
Notifications
You must be signed in to change notification settings - Fork 3
42 lines (41 loc) · 1.54 KB
/
run_unit_tests.yml
File metadata and controls
42 lines (41 loc) · 1.54 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: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
# 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@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
- name: Check Poetry version
run: poetry --version
- name: Install main package dependencies
run: |
python -m pip install --upgrade pip
poetry install --only main
- name: Install dev dependencies
run: poetry install
- name: Run unit tests
run: poetry run pytest -v --junitxml=test_results/unit-${{ matrix.os }}-py${{ matrix.python-version }}.xml
- name: Upload test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test_results_unit_${{ matrix.os }}_py${{ matrix.python-version }}
path: test_results/*.xml
if: always()