|
| 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() |
0 commit comments