-
Notifications
You must be signed in to change notification settings - Fork 190
59 lines (58 loc) · 2.36 KB
/
run_unit_tests.yml
File metadata and controls
59 lines (58 loc) · 2.36 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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", "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@v4
- name: Set up Python ${{ matrix.python-version }}
uses: ni/python-actions/setup-python@v0.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@v0.1.0
- name: Restore cached virtualenv (main only)
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: restore-nidaqmx-main-only
with:
path: .venv
key: nidaqmx-main-only-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install main package dependencies
run: |
python -m pip install --upgrade pip
poetry install --only main
- name: check installdriver subcommand can be invoked
run: poetry run nidaqmx installdriver --help
- name: Save cached virtualenv (main only)
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
if: steps.restore-nidaqmx-main-only.outputs.cache-hit != 'true'
with:
path: .venv
key: ${{ steps.restore-nidaqmx-main-only.outputs.cache-primary-key }}
- name: Cache virtualenv (with dev dependencies)
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: .venv
key: nidaqmx-with-dev-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install dev dependencies
run: poetry install
- name: Run unit tests
run: poetry run pytest -v --cov=generated/nidaqmx --junitxml=test_results/unit-${{ matrix.os }}-py${{ matrix.python-version }}.xml tests/unit
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test_results_unit_${{ matrix.os }}_py${{ matrix.python-version }}
path: test_results/*.xml
if: always()