-
Notifications
You must be signed in to change notification settings - Fork 190
75 lines (74 loc) · 3.23 KB
/
run_unit_tests.yml
File metadata and controls
75 lines (74 loc) · 3.23 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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", "pypy3.10", "pypy3.11"]
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
# incomplete JUnit XML results.
fail-fast: false
env:
install-opts: ${{ !startsWith(matrix.python-version, 'pypy') && '--extras grpc' || '' }}
pytest-opts: ${{ startsWith(matrix.python-version, 'pypy') && '-k "not grpc"' || '' }}
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python ${{ matrix.python-version }}
uses: ni/python-actions/setup-python@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1
- name: Cache virtualenv (with test dependencies)
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: .venv
key: nidaqmx-with-test-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install test dependencies
run: poetry install --only main,test ${{ env.install-opts }}
- 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 ${{ env.pytest-opts }}
- 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()
test_installdriver:
name: Test installdriver
runs-on:
- ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.13", "pypy3.11"]
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python ${{ matrix.python-version }}
uses: ni/python-actions/setup-python@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1
- name: Cache virtualenv (main only)
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: cache-nidaqmx-main-only
with:
path: .venv
key: nidaqmx-main-only-${{ runner.os }}-py${{ steps.setup-python.outputs.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