From fc731d021dccee20155b55b6981f7c597d55390b Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 21:30:07 -0500 Subject: [PATCH 01/17] GitHub workflows: Try using setup-python's Poetry caching --- .github/workflows/Publish_NIMS.yml | 6 +----- .github/workflows/check_examples.yml | 6 +----- .github/workflows/check_nimg.yml | 6 +----- .github/workflows/check_nims.yml | 6 +----- .github/workflows/run_unit_tests.yml | 6 +----- 5 files changed, 5 insertions(+), 25 deletions(-) diff --git a/.github/workflows/Publish_NIMS.yml b/.github/workflows/Publish_NIMS.yml index 22fa5a6ac..f1939f7a6 100644 --- a/.github/workflows/Publish_NIMS.yml +++ b/.github/workflows/Publish_NIMS.yml @@ -29,6 +29,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + cache: 'poetry' - uses: Gr1N/setup-poetry@v8 with: poetry-version: ${{ env.POETRY_VERSION }} @@ -36,11 +37,6 @@ jobs: - name: Check for lock changes run: poetry lock --check - - uses: actions/cache@v3 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} - # If the tag is 0.1.0, this will set the version of NIMS package to 0.1.0 - name: Store version from Tag id: vars diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index aa898aa58..f3c5a162a 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -19,15 +19,11 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + cache: 'poetry' - name: Set up Poetry uses: Gr1N/setup-poetry@v8 with: poetry-version: ${{ env.POETRY_VERSION }} - - name: Cache Poetry virtualenv - uses: actions/cache@v3 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} # Install each example's dependencies so mypy can see their types. - name: Install examples run: | diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index 6490015c5..d18aa1b50 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -23,17 +23,13 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + cache: 'poetry' - name: Set up Poetry uses: Gr1N/setup-poetry@v8 with: poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes (ni-measurementlink-generator) run: poetry lock --check - - name: Cache Poetry virtualenv - uses: actions/cache@v3 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator run: poetry install -v - name: Lint ni-measurementlink-generator diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 2559d72db..77f588d1f 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -19,17 +19,13 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + cache: 'poetry' - name: Set up Poetry uses: Gr1N/setup-poetry@v8 with: poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes (ni-measurementlink-service) run: poetry lock --check - - name: Cache Poetry virtualenv - uses: actions/cache@v3 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (all extras) run: poetry install -v --all-extras - name: Lint ni-measurementlink-service diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 0e20ec937..c88923a86 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -25,15 +25,11 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + cache: 'poetry' - name: Set up Poetry uses: Gr1N/setup-poetry@v8 with: poetry-version: ${{ env.POETRY_VERSION }} - - name: Cache Poetry virtualenv - uses: actions/cache@v3 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (no extras) run: poetry install -v - name: Run unit tests and code coverage (ni-measurementlink-service, no extras) From 6b7620d2b5be042a3a1801dbaf671227cf03e7c9 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 21:40:29 -0500 Subject: [PATCH 02/17] GitHub workflows: Use pipx to install Poetry --- .github/workflows/Publish_NIMS.yml | 5 ++--- .github/workflows/check_examples.yml | 6 ++---- .github/workflows/check_nimg.yml | 6 ++---- .github/workflows/check_nims.yml | 6 ++---- .github/workflows/run_unit_tests.yml | 6 ++---- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/Publish_NIMS.yml b/.github/workflows/Publish_NIMS.yml index f1939f7a6..6e8b8c4da 100644 --- a/.github/workflows/Publish_NIMS.yml +++ b/.github/workflows/Publish_NIMS.yml @@ -26,13 +26,12 @@ jobs: runs-on : ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Set up Poetry + run: pipx install poetry==${{ env.POETRY_VERSION }} - uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'poetry' - - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes run: poetry lock --check diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index f3c5a162a..1bc6dd19b 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -15,15 +15,13 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 + - name: Set up Poetry + run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'poetry' - - name: Set up Poetry - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: ${{ env.POETRY_VERSION }} # Install each example's dependencies so mypy can see their types. - name: Install examples run: | diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index d18aa1b50..50b822193 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -19,15 +19,13 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 + - name: Set up Poetry + run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'poetry' - - name: Set up Poetry - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes (ni-measurementlink-generator) run: poetry lock --check - name: Install ni-measurementlink-generator diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 77f588d1f..e5053cb9d 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -15,15 +15,13 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 + - name: Set up Poetry + run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'poetry' - - name: Set up Poetry - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes (ni-measurementlink-service) run: poetry lock --check - name: Install ni-measurementlink-service (all extras) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index c88923a86..a9622bc0d 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -21,15 +21,13 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 + - name: Set up Poetry + run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: 'poetry' - - name: Set up Poetry - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: ${{ env.POETRY_VERSION }} - name: Install ni-measurementlink-service (no extras) run: poetry install -v - name: Run unit tests and code coverage (ni-measurementlink-service, no extras) From 4f18277bdd559f96dbd5eb5ebf6c9bdd78a35591 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 21:52:27 -0500 Subject: [PATCH 03/17] GitHub workflows: Don't bother with cache for Publish_NIMS.yml --- .github/workflows/Publish_NIMS.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/Publish_NIMS.yml b/.github/workflows/Publish_NIMS.yml index 6e8b8c4da..737fdea18 100644 --- a/.github/workflows/Publish_NIMS.yml +++ b/.github/workflows/Publish_NIMS.yml @@ -31,7 +31,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - cache: 'poetry' - name: Check for lock changes run: poetry lock --check From 67dc3d8b33e0d50284bb54d2e7a34a0e952e4a93 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 21:54:40 -0500 Subject: [PATCH 04/17] GitHub workflows: Set cache-dependency-path --- .github/workflows/check_nimg.yml | 1 + .github/workflows/check_nims.yml | 1 + .github/workflows/run_unit_tests.yml | 3 +++ 3 files changed, 5 insertions(+) diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index 50b822193..725feb5be 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -26,6 +26,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} cache: 'poetry' + cache-dependency-path: ni_measurementlink_generator/poetry.lock - name: Check for lock changes (ni-measurementlink-generator) run: poetry lock --check - name: Install ni-measurementlink-generator diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index e5053cb9d..f556fc3c4 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -22,6 +22,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} cache: 'poetry' + cache-dependency-path: poetry.lock - name: Check for lock changes (ni-measurementlink-service) run: poetry lock --check - name: Install ni-measurementlink-service (all extras) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index a9622bc0d..e6a0092dc 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -28,6 +28,9 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'poetry' + cache-dependency-path: | + poetry.lock + ni_measurementlink_generator/poetry.lock - name: Install ni-measurementlink-service (no extras) run: poetry install -v - name: Run unit tests and code coverage (ni-measurementlink-service, no extras) From 6de71e6b54d061065c7a04d9168424049884a2e1 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 22:30:41 -0500 Subject: [PATCH 05/17] GitHub workflows: redo caching --- .github/workflows/check_nimg.yml | 7 +++-- .github/workflows/check_nims.yml | 26 +++++++++++++++++- .github/workflows/run_unit_tests.yml | 41 +++++++++++++++++++++++++--- 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index 725feb5be..395f2bbf0 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -25,10 +25,13 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - cache: 'poetry' - cache-dependency-path: ni_measurementlink_generator/poetry.lock - name: Check for lock changes (ni-measurementlink-generator) run: poetry lock --check + - name: Cache virtualenv (ni-measurementlink-generator) + uses: actions/cache@v3 + with: + path: ni_measurementlink_generator/.venv + key: ni-measurementlink-generator-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator run: poetry install -v - name: Lint ni-measurementlink-generator diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index f556fc3c4..239f7f4bc 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -25,8 +25,20 @@ jobs: cache-dependency-path: poetry.lock - name: Check for lock changes (ni-measurementlink-service) run: poetry lock --check + + # ni-measurementlink-service, all extras + - name: Restore cached virtualenv (ni-measurementlink-service, all extras) + uses: actions/cache/restore@v3 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras - name: Install ni-measurementlink-service (all extras) run: poetry install -v --all-extras + - name: Save cached virtualenv (ni-measurementlink-service, all extras) + uses: actions/cache/save@v3 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras - name: Lint ni-measurementlink-service run: poetry run ni-python-styleguide lint - name: Mypy static analysis (ni-measurementlink-service, Linux) @@ -37,12 +49,24 @@ jobs: run: poetry run mypy tests - name: Mypy static analysis (tests, Windows) run: poetry run mypy tests --platform win32 + + # ni-measurementlink-service, all extras, docs + - name: Restore cached virtualenv (ni-measurementlink-service, all extras, docs) + uses: actions/cache/restore@v3 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs - name: Install ni-measurementlink-service (all extras, docs) run: poetry install -v --all-extras --with docs + - name: Save cached virtualenv (ni-measurementlink-service, all extras, docs) + uses: actions/cache/restore@v3 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs - name: Build docs and check for errors/warnings run: | rm -rf docs mkdir -p docs poetry run sphinx-build _docs_source docs -b html -W --keep-going - name: Revert docs - run: git clean -dfx docs/ && git restore docs/ \ No newline at end of file + run: git clean -dfx docs/ && git restore docs/ diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index e6a0092dc..3a5128787 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -27,24 +27,57 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - cache: 'poetry' - cache-dependency-path: | - poetry.lock - ni_measurementlink_generator/poetry.lock + + # ni-measurementlink-service, no extras + - name: Restore cached virtualenv (ni-measurementlink-service, no extras) + uses: actions/cache/restore@v3 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-no-extras - 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 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-no-extras - 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 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-all-extras - 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 + with: + path: .venv + key: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-all-extras - 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 + with: + path: ni_measurementlink_generator/.venv + key: ni-measurementlink-generator-${{ runner.os }}-${{ matrix.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 + with: + path: ni_measurementlink_generator/.venv + key: ni-measurementlink-generator-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - 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: Upload test results uses: actions/upload-artifact@v3 with: From d9e1f4e844b6b91b66ffb5eba3daa8c3be0b8800 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 22:42:44 -0500 Subject: [PATCH 06/17] GitHub workflow: Cache example virtualenvs --- .github/workflows/check_examples.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index 1bc6dd19b..472ce94a8 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -21,8 +21,20 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - cache: 'poetry' - # Install each example's dependencies so mypy can see their types. + - name: Lock examples + run: | + for example in examples/*/; do + echo "::group::$example" + pushd $example + poetry lock + popd + echo "::endgroup::" + done + - name: Cache virtualenvs + uses: actions/cache@v3 + with: + path: 'examples/**/.venv' + key: examples-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/poetry.lock') }} - name: Install examples run: | for example in examples/*/; do From bf6c502d3102f8305608825a10216655b25be172 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 22:45:51 -0500 Subject: [PATCH 07/17] GitHub workflows: Cache Tox virtualenvs --- .github/workflows/run_system_tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/run_system_tests.yml b/.github/workflows/run_system_tests.yml index b0758adea..cde8e6328 100644 --- a/.github/workflows/run_system_tests.yml +++ b/.github/workflows/run_system_tests.yml @@ -22,6 +22,13 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 + - name: Cache virtualenvs + uses: actions/cache@v3 + with: + path: | + .venv + .tox + key: run-system-tests-${{ runner.os }}-${{ matrix.configuration }}-${{ hashFiles('poetry.lock') }} - name: Install dependencies run: poetry install - name: Run system tests From 69e26657ed56ed5c757dcd7a3304f3a2be9ac374 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 22:51:26 -0500 Subject: [PATCH 08/17] GitHub workflows: Fix a restore/save mixup --- .github/workflows/check_nims.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 239f7f4bc..81709dd92 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -59,7 +59,7 @@ jobs: - name: Install ni-measurementlink-service (all extras, docs) run: poetry install -v --all-extras --with docs - name: Save cached virtualenv (ni-measurementlink-service, all extras, docs) - uses: actions/cache/restore@v3 + uses: actions/cache/save@v3 with: path: .venv key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs From 8827662ac5e0465659882d8ff1495c080d7df23c Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 23:05:43 -0500 Subject: [PATCH 09/17] GitHub workflows: Add ids to cache steps --- .github/workflows/check_examples.yml | 2 ++ .github/workflows/check_nimg.yml | 2 ++ .github/workflows/check_nims.yml | 10 ++++++++-- .github/workflows/run_system_tests.yml | 2 ++ .github/workflows/run_unit_tests.yml | 15 ++++++++++++--- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index 472ce94a8..15bfc7a76 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -32,10 +32,12 @@ jobs: done - name: Cache virtualenvs uses: actions/cache@v3 + id: cache with: path: 'examples/**/.venv' key: examples-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/poetry.lock') }} - name: Install examples + if: steps.cache.outputs.cache-hit != 'true' run: | for example in examples/*/; do echo "::group::$example" diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index 395f2bbf0..fe0224f9d 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -29,10 +29,12 @@ jobs: run: poetry lock --check - name: Cache virtualenv (ni-measurementlink-generator) uses: actions/cache@v3 + id: cache with: path: ni_measurementlink_generator/.venv key: ni-measurementlink-generator-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator + if: steps.cache.outputs.cache-hit != 'true' run: poetry install -v - name: Lint ni-measurementlink-generator run: poetry run ni-python-styleguide lint diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 81709dd92..1d92f6e3e 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -29,16 +29,19 @@ jobs: # 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-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras - name: Install ni-measurementlink-service (all extras) + if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' run: poetry install -v --all-extras - name: Save cached virtualenv (ni-measurementlink-service, all extras) uses: actions/cache/save@v3 + if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras + key: ${{ steps.restore-nims-all-extras.outputs.cache-primary-key }} - name: Lint ni-measurementlink-service run: poetry run ni-python-styleguide lint - name: Mypy static analysis (ni-measurementlink-service, Linux) @@ -53,16 +56,19 @@ jobs: # ni-measurementlink-service, all extras, docs - name: Restore cached virtualenv (ni-measurementlink-service, all extras, docs) uses: actions/cache/restore@v3 + id: restore-nims-all-extras-docs with: path: .venv key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs - name: Install ni-measurementlink-service (all extras, docs) + if: steps.restore-nims-all-extras-docs.outputs.cache-hit != 'true' run: poetry install -v --all-extras --with docs - name: Save cached virtualenv (ni-measurementlink-service, all extras, docs) uses: actions/cache/save@v3 + if: steps.restore-nims-all-extras-docs.outputs.cache-hit != 'true' with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs + key: ${{ steps.restore-nims-all-extras-docs.outputs.cache-primary-key }} - name: Build docs and check for errors/warnings run: | rm -rf docs diff --git a/.github/workflows/run_system_tests.yml b/.github/workflows/run_system_tests.yml index cde8e6328..e2e45146c 100644 --- a/.github/workflows/run_system_tests.yml +++ b/.github/workflows/run_system_tests.yml @@ -24,12 +24,14 @@ jobs: uses: actions/checkout@v4 - name: Cache virtualenvs uses: actions/cache@v3 + id: cache with: path: | .venv .tox key: run-system-tests-${{ runner.os }}-${{ matrix.configuration }}-${{ hashFiles('poetry.lock') }} - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' run: poetry install - name: Run system tests run: poetry run tox diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 3a5128787..ba78d7f06 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -31,49 +31,58 @@ jobs: # 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-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-no-extras - name: Install ni-measurementlink-service (no extras) + if: steps.restore-nims-no-extras.outputs.cache-hit != 'true' 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: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-no-extras + 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-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-all-extras - name: Install ni-measurementlink-service (all extras) + if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' 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: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-all-extras + 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 }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator + if: steps.restore-nimg.outputs.cache-hit != 'true' 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: ni-measurementlink-generator-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} + 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 From c5599540cc9907d323e2de4baebb12b3ad17653c Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Fri, 27 Oct 2023 23:33:59 -0500 Subject: [PATCH 10/17] GitHub workflows: Stop testing on macOS --- .github/workflows/run_unit_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index ba78d7f06..9f0113da8 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, windows-latest, ubuntu-latest] + 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. From 03648a9af15b848e17249f2d6d62d15000a483b3 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 28 Oct 2023 00:26:38 -0500 Subject: [PATCH 11/17] GitHub workflows: Cache example poetry.lock files --- .github/workflows/check_examples.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index 15bfc7a76..666a49fb8 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -21,7 +21,16 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + # Updating poetry.lock for all of the examples takes over 6 minutes, so it's worth caching. + - name: Cache poetry.lock + uses: actions/cache@v3 + id: cache-poetry-lock + with: + path: 'examples/**/poetry.lock' + # Include the main project's poetry.lock in the hash to detect upstream dependency updates. + key: examples-poetry-lock-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/pyproject.toml', 'poetry.lock') }} - name: Lock examples + if: steps.cache-poetry-lock.outputs.cache-hit != 'true' run: | for example in examples/*/; do echo "::group::$example" @@ -32,12 +41,12 @@ jobs: done - name: Cache virtualenvs uses: actions/cache@v3 - id: cache + id: cache-venv with: path: 'examples/**/.venv' - key: examples-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/poetry.lock') }} + key: examples-venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/poetry.lock') }} - name: Install examples - if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache-venv.outputs.cache-hit != 'true' run: | for example in examples/*/; do echo "::group::$example" From aa89cc75db6e1de187be1c6be4d2d82f470a6d34 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 28 Oct 2023 01:39:56 -0500 Subject: [PATCH 12/17] GitHub workflows: Add gzip to the path --- .github/workflows/run_system_tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run_system_tests.yml b/.github/workflows/run_system_tests.yml index e2e45146c..afa93bd93 100644 --- a/.github/workflows/run_system_tests.yml +++ b/.github/workflows/run_system_tests.yml @@ -22,6 +22,8 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 + - name: Add gzip to path so cache can use tar -z + run: echo "C:\Program Files\Git\usr\bin" >> $GITHUB_PATH - name: Cache virtualenvs uses: actions/cache@v3 id: cache From d74105e327ad2a62f1aa549f90a85f2d47d15c10 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 28 Oct 2023 12:07:02 -0500 Subject: [PATCH 13/17] GitHub workflows: Revert PATH hack I updated the AMI build to add UNIX tools to the path and install zstandard, so actions/cache should work without this hack (which didn't work anyway). --- .github/workflows/run_system_tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/run_system_tests.yml b/.github/workflows/run_system_tests.yml index afa93bd93..8c3e4a6d5 100644 --- a/.github/workflows/run_system_tests.yml +++ b/.github/workflows/run_system_tests.yml @@ -22,8 +22,6 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Add gzip to path so cache can use tar -z - run: echo "C:\Program Files\Git\usr\bin" >> $GITHUB_PATH - name: Cache virtualenvs uses: actions/cache@v3 id: cache @@ -42,4 +40,4 @@ jobs: with: name: test_results path: test_results/*.xml - if: always() \ No newline at end of file + if: always() From 4cab108d6e3a3b4bfcb2904192ca3a463217520c Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 28 Oct 2023 12:40:09 -0500 Subject: [PATCH 14/17] GitHub workflows: Revert to Gr1N/setup-poetry to ensure we use the correct Python versions for testing --- .github/workflows/Publish_NIMS.yml | 12 ++++++++---- .github/workflows/check_examples.yml | 6 ++++-- .github/workflows/check_nimg.yml | 6 ++++-- .github/workflows/check_nims.yml | 8 ++++---- .github/workflows/run_unit_tests.yml | 6 ++++-- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/Publish_NIMS.yml b/.github/workflows/Publish_NIMS.yml index 737fdea18..d8708eda8 100644 --- a/.github/workflows/Publish_NIMS.yml +++ b/.github/workflows/Publish_NIMS.yml @@ -25,12 +25,16 @@ jobs: name: Update API reference docs and Publish NIMS Package to PyPI runs-on : ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} - - uses: actions/setup-python@v4 + - name: Check out repo + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Set up Poetry + uses: Gr1N/setup-poetry@v8 + with: + poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes run: poetry lock --check diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index 666a49fb8..884226d80 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -15,12 +15,14 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Set up Poetry + uses: Gr1N/setup-poetry@v8 + with: + poetry-version: ${{ env.POETRY_VERSION }} # Updating poetry.lock for all of the examples takes over 6 minutes, so it's worth caching. - name: Cache poetry.lock uses: actions/cache@v3 diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index fe0224f9d..ad3af3944 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -19,12 +19,14 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Set up Poetry + uses: Gr1N/setup-poetry@v8 + with: + poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes (ni-measurementlink-generator) run: poetry lock --check - name: Cache virtualenv (ni-measurementlink-generator) diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 1d92f6e3e..4f5a5b827 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -15,14 +15,14 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - cache: 'poetry' - cache-dependency-path: poetry.lock + - name: Set up Poetry + uses: Gr1N/setup-poetry@v8 + with: + poetry-version: ${{ env.POETRY_VERSION }} - name: Check for lock changes (ni-measurementlink-service) run: poetry lock --check diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 9f0113da8..7dc63ee67 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -21,12 +21,14 @@ jobs: steps: - name: Check out repo uses: actions/checkout@v4 - - name: Set up Poetry - run: pipx install poetry==${{ env.POETRY_VERSION }} - name: Set up Python uses: actions/setup-python@v4 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) From 8bf7ef747970bdddc4614f7bd7a0a79b1bcd12f3 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 28 Oct 2023 13:16:24 -0500 Subject: [PATCH 15/17] GitHub workflows: Change cache key to use "py3.9" instead of just "3.9" --- .github/workflows/check_examples.yml | 4 ++-- .github/workflows/check_nimg.yml | 2 +- .github/workflows/check_nims.yml | 4 ++-- .github/workflows/run_unit_tests.yml | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index 884226d80..d187d5d8a 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -30,7 +30,7 @@ jobs: with: path: 'examples/**/poetry.lock' # Include the main project's poetry.lock in the hash to detect upstream dependency updates. - key: examples-poetry-lock-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/pyproject.toml', 'poetry.lock') }} + key: examples-poetry-lock-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/pyproject.toml', 'poetry.lock') }} - name: Lock examples if: steps.cache-poetry-lock.outputs.cache-hit != 'true' run: | @@ -46,7 +46,7 @@ jobs: id: cache-venv with: path: 'examples/**/.venv' - key: examples-venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/poetry.lock') }} + key: examples-venv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/poetry.lock') }} - name: Install examples if: steps.cache-venv.outputs.cache-hit != 'true' run: | diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index ad3af3944..cb7e6abd0 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -34,7 +34,7 @@ jobs: id: cache with: path: ni_measurementlink_generator/.venv - key: ni-measurementlink-generator-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} + key: ni-measurementlink-generator-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator if: steps.cache.outputs.cache-hit != 'true' run: poetry install -v diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 4f5a5b827..0c6d75deb 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -32,7 +32,7 @@ jobs: id: restore-nims-all-extras with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras + key: ni-measurementlink-service-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras - name: Install ni-measurementlink-service (all extras) if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' run: poetry install -v --all-extras @@ -59,7 +59,7 @@ jobs: id: restore-nims-all-extras-docs with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs + key: ni-measurementlink-service-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs - name: Install ni-measurementlink-service (all extras, docs) if: steps.restore-nims-all-extras-docs.outputs.cache-hit != 'true' run: poetry install -v --all-extras --with docs diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 7dc63ee67..6528bfdc8 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -36,7 +36,7 @@ jobs: id: restore-nims-no-extras with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-no-extras + key: ni-measurementlink-service-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-no-extras - name: Install ni-measurementlink-service (no extras) if: steps.restore-nims-no-extras.outputs.cache-hit != 'true' run: poetry install -v @@ -55,7 +55,7 @@ jobs: id: restore-nims-all-extras with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-all-extras + key: ni-measurementlink-service-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-all-extras - name: Install ni-measurementlink-service (all extras) if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' run: poetry install -v --all-extras @@ -74,7 +74,7 @@ jobs: id: restore-nimg with: path: ni_measurementlink_generator/.venv - key: ni-measurementlink-generator-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} + key: ni-measurementlink-generator-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator if: steps.restore-nimg.outputs.cache-hit != 'true' run: poetry install -v From e33ddbad420ace6e7aa1d61825905bee723c0c2d Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 28 Oct 2023 13:23:54 -0500 Subject: [PATCH 16/17] GitHub workflows: Move all/no-extras next to package name in cache key --- .github/workflows/check_nims.yml | 4 ++-- .github/workflows/run_unit_tests.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 0c6d75deb..69ef9d4f4 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -32,7 +32,7 @@ jobs: id: restore-nims-all-extras with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras + key: ni-measurementlink-service-all-extras-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (all extras) if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' run: poetry install -v --all-extras @@ -59,7 +59,7 @@ jobs: id: restore-nims-all-extras-docs with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}-all-extras-docs + key: ni-measurementlink-service-all-extras-docs-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (all extras, docs) if: steps.restore-nims-all-extras-docs.outputs.cache-hit != 'true' run: poetry install -v --all-extras --with docs diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 6528bfdc8..3e1611518 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -36,7 +36,7 @@ jobs: id: restore-nims-no-extras with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-no-extras + key: ni-measurementlink-service-no-extras-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (no extras) if: steps.restore-nims-no-extras.outputs.cache-hit != 'true' run: poetry install -v @@ -55,7 +55,7 @@ jobs: id: restore-nims-all-extras with: path: .venv - key: ni-measurementlink-service-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-all-extras + key: ni-measurementlink-service-all-extras-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (all extras) if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' run: poetry install -v --all-extras From af161a16d97b12e9d5c30a744ee11e45541e3ef8 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Sat, 28 Oct 2023 13:58:25 -0500 Subject: [PATCH 17/17] GitHub workflows: Don't skip poetry install on cache hit `poetry install` is fast when the dependencies are already installed. Also, if the venv was relocated to a different path, it may fix the venv. --- .github/workflows/check_examples.yml | 1 - .github/workflows/check_nimg.yml | 1 - .github/workflows/check_nims.yml | 2 -- .github/workflows/run_system_tests.yml | 3 +-- .github/workflows/run_unit_tests.yml | 3 --- 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/check_examples.yml b/.github/workflows/check_examples.yml index d187d5d8a..e6972f16d 100644 --- a/.github/workflows/check_examples.yml +++ b/.github/workflows/check_examples.yml @@ -48,7 +48,6 @@ jobs: path: 'examples/**/.venv' key: examples-venv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('examples/**/poetry.lock') }} - name: Install examples - if: steps.cache-venv.outputs.cache-hit != 'true' run: | for example in examples/*/; do echo "::group::$example" diff --git a/.github/workflows/check_nimg.yml b/.github/workflows/check_nimg.yml index cb7e6abd0..8f0c198b8 100644 --- a/.github/workflows/check_nimg.yml +++ b/.github/workflows/check_nimg.yml @@ -36,7 +36,6 @@ jobs: path: ni_measurementlink_generator/.venv key: ni-measurementlink-generator-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator - if: steps.cache.outputs.cache-hit != 'true' run: poetry install -v - name: Lint ni-measurementlink-generator run: poetry run ni-python-styleguide lint diff --git a/.github/workflows/check_nims.yml b/.github/workflows/check_nims.yml index 69ef9d4f4..52fd5e464 100644 --- a/.github/workflows/check_nims.yml +++ b/.github/workflows/check_nims.yml @@ -34,7 +34,6 @@ jobs: path: .venv key: ni-measurementlink-service-all-extras-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (all extras) - if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' run: poetry install -v --all-extras - name: Save cached virtualenv (ni-measurementlink-service, all extras) uses: actions/cache/save@v3 @@ -61,7 +60,6 @@ jobs: path: .venv key: ni-measurementlink-service-all-extras-docs-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (all extras, docs) - if: steps.restore-nims-all-extras-docs.outputs.cache-hit != 'true' run: poetry install -v --all-extras --with docs - name: Save cached virtualenv (ni-measurementlink-service, all extras, docs) uses: actions/cache/save@v3 diff --git a/.github/workflows/run_system_tests.yml b/.github/workflows/run_system_tests.yml index 8c3e4a6d5..f953752af 100644 --- a/.github/workflows/run_system_tests.yml +++ b/.github/workflows/run_system_tests.yml @@ -31,8 +31,7 @@ jobs: .tox key: run-system-tests-${{ runner.os }}-${{ matrix.configuration }}-${{ hashFiles('poetry.lock') }} - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: poetry install + run: poetry install -v - name: Run system tests run: poetry run tox - name: Upload test results diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 3e1611518..8e1177e73 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -38,7 +38,6 @@ jobs: path: .venv key: ni-measurementlink-service-no-extras-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (no extras) - if: steps.restore-nims-no-extras.outputs.cache-hit != 'true' run: poetry install -v - name: Save cached virtualenv (ni-measurementlink-service, no extras) uses: actions/cache/save@v3 @@ -57,7 +56,6 @@ jobs: path: .venv key: ni-measurementlink-service-all-extras-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-service (all extras) - if: steps.restore-nims-all-extras.outputs.cache-hit != 'true' run: poetry install -v --all-extras - name: Save cached ni-measurementlink-service virtualenv (all extras) uses: actions/cache/save@v3 @@ -76,7 +74,6 @@ jobs: path: ni_measurementlink_generator/.venv key: ni-measurementlink-generator-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Install ni-measurementlink-generator - if: steps.restore-nimg.outputs.cache-hit != 'true' run: poetry install -v working-directory: ./ni_measurementlink_generator - name: Save cached virtualenv (ni-measurementlink-generator)