Skip to content

Commit e7737e3

Browse files
committed
github: Add another workflow to run tests with the oldest compatible dependency versions
1 parent 9a02aab commit e7737e3

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ jobs:
1919
name: Run unit tests
2020
uses: ./.github/workflows/run_unit_tests.yml
2121
needs: [check_nitypes]
22+
run_unit_tests:
23+
name: Run unit tests (oldest deps)
24+
uses: ./.github/workflows/run_unit_tests_oldest_deps.yml
25+
needs: [check_nitypes]
2226
report_test_results:
2327
name: Report test results
2428
uses: ./.github/workflows/report_test_results.yml
25-
needs: [run_unit_tests]
29+
needs: [run_unit_tests, run_unit_tests_oldest_deps]
2630
if: always()

.github/workflows/run_unit_tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
3333
- name: Install nitypes
3434
run: poetry install -v
35+
- name: Display installed dependency versions
36+
run: poetry run pip list
3537
- name: Run unit tests and code coverage
3638
run: poetry run pytest ./tests/unit -v --cov=nitypes --junitxml=test_results/nitypes-${{ matrix.os }}-py${{ matrix.python-version }}.xml
3739
- name: Upload test results
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Run unit tests (oldest deps)
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
run_unit_tests_oldest_deps:
9+
name: Run unit tests (oldest deps)
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [windows-latest, ubuntu-latest]
14+
python-version: [3.9]
15+
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
16+
# incomplete JUnit XML results.
17+
fail-fast: false
18+
steps:
19+
- name: Check out repo
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
- name: Set up Python
22+
uses: ni/python-actions/setup-python@e8f25e9a64426bd431ac124b83df11b76cdf60d5 # v0.1.0
23+
id: setup-python
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Set up Poetry
27+
uses: ni/python-actions/setup-poetry@e8f25e9a64426bd431ac124b83df11b76cdf60d5 # v0.1.0
28+
- name: Cache virtualenv
29+
id: cache-virtualenv
30+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
31+
with:
32+
path: .venv
33+
key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
34+
- name: Install nitypes (latest deps)
35+
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
36+
run: poetry install -v
37+
- name: Pin oldest compatible dependencies
38+
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
39+
run: |
40+
poetry run python scripts/pin_oldest_deps.py pyproject.toml
41+
poetry lock --no-update
42+
- name: Install nitypes (oldest deps)
43+
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
44+
run: poetry install -v
45+
- name: Display installed dependency versions
46+
run: poetry run pip list
47+
- name: Run unit tests and code coverage
48+
run: poetry run pytest ./tests/unit -v --cov=nitypes --junitxml=test_results/nitypes-oldest-deps-${{ matrix.os }}-py${{ matrix.python-version }}.xml
49+
- name: Upload test results
50+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
51+
with:
52+
name: test_results_unit_oldest_deps_${{ matrix.os }}_py${{ matrix.python-version }}
53+
path: ./test_results/*.xml
54+
if: always()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pytest-cov = ">=4.0"
2929
pytest-mock = ">=3.0"
3030
# Use an unreleased version of hightime for testing.
3131
hightime = { git = "https://github.com/ni/hightime.git" }
32+
tomlkit = ">=0.11.0"
3233

3334
[tool.poetry.group.docs]
3435
optional = true

0 commit comments

Comments
 (0)