Skip to content

Echo run id and matrix info #2

Echo run id and matrix info

Echo run id and matrix info #2

Workflow file for this run

name: Run unit tests
on:
workflow_call:
workflow_dispatch:
env:
POETRY_VERSION: 1.2.2
jobs:
run_unit_tests:
name: Run unit tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: [3.8, 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@v4
- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: ${{ env.POETRY_VERSION }}
# ni-measurementlink-service, no extras
- name: Restore cached virtualenv (ni-measurementlink-service, no extras)
uses: actions/cache/restore@v3
id: restore-nims-no-extras
with:
path: .venv
key: ni-measurementlink-service-no-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install ni-measurementlink-service (no extras)
run: poetry install -v
- name: Save cached virtualenv (ni-measurementlink-service, no extras)
uses: actions/cache/save@v3
if: steps.restore-nims-no-extras.outputs.cache-hit != 'true'
with:
path: .venv
key: ${{ steps.restore-nims-no-extras.outputs.cache-primary-key }}
- name: Run unit tests and code coverage (ni-measurementlink-service, no extras)
run: poetry run pytest ./tests/unit -v --cov=ni_measurementlink_service --junitxml=test_results/nims-${{ matrix.os }}-py${{ matrix.python-version}}-no-extras.xml
# ni-measurementlink-service, all extras
- name: Restore cached virtualenv (ni-measurementlink-service, all extras)
uses: actions/cache/restore@v3
id: restore-nims-all-extras
with:
path: .venv
key: ni-measurementlink-service-all-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install ni-measurementlink-service (all extras)
run: poetry install -v --all-extras
- name: Save cached ni-measurementlink-service virtualenv (all extras)
uses: actions/cache/save@v3
if: steps.restore-nims-all-extras.outputs.cache-hit != 'true'
with:
path: .venv
key: ${{ steps.restore-nims-all-extras.outputs.cache-primary-key }}
- name: Run unit tests and code coverage (ni-measurementlink-service, all extras)
run: poetry run pytest ./tests/unit -v --cov=ni_measurementlink_service --junitxml=test_results/nims-${{ matrix.os }}-py${{ matrix.python-version}}-all-extras.xml
# ni-measurementlink-generator
- name: Restore cached virtualenv (ni-measurementlink-generator)
uses: actions/cache/restore@v3
id: restore-nimg
with:
path: ni_measurementlink_generator/.venv
key: ni-measurementlink-generator-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install ni-measurementlink-generator
run: poetry install -v
working-directory: ./ni_measurementlink_generator
- name: Save cached virtualenv (ni-measurementlink-generator)
uses: actions/cache/save@v3
if: steps.restore-nimg.outputs.cache-hit != 'true'
with:
path: ni_measurementlink_generator/.venv
key: ${{ steps.restore-nimg.outputs.cache-primary-key }}
- name: Run tests and code coverage (ni-measurementlink-generator)
run: poetry run pytest -v --cov=ni_measurementlink_generator --junitxml=test_results/nimg-${{ matrix.os }}-py${{ matrix.python-version}}.xml
working-directory: ./ni_measurementlink_generator
- name: Echo Run ID
run: echo "Run ID: ${{ matrix.os }}-py${{ matrix.python-version }} ${GITHUB_RUN_ID}"

Check failure on line 91 in .github/workflows/run_unit_tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/run_unit_tests.yml

Invalid workflow file

You have an error in your yaml syntax on line 91
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test_results
path: test_results/*.xml
if: always()