From 17d2218feb8d827590ace3e8e5a7be496678bd9f Mon Sep 17 00:00:00 2001 From: "Peter St. John" Date: Thu, 16 Jan 2025 11:42:17 -0800 Subject: [PATCH] run notebook tests automatically if any notebooks have changed Signed-off-by: Peter St. John --- .github/workflows/unit-tests.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 4dd05f965..6f22edf8e 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -113,13 +113,24 @@ jobs: with: path: ${{ github.run_id }} + - name: Check for notebook changes + id: check_notebooks + run: | + if git diff --quiet main HEAD -- '*.ipynb'; then + echo "::set-output name=changed::false" + else + echo "::set-output name=changed::true" + fi + - name: Run tests env: BIONEMO_DATA_SOURCE: ngc run: ./ci/scripts/run_pytest.sh --no-nbval --skip-slow - name: Run notebook tests - if: ${{ contains(github.event.pull_request.labels.*.name, 'INCLUDE_NOTEBOOKS_TESTS') }} + if: | + ${{ steps.check_notebooks.outputs.changed == 'true' || + contains(github.event.pull_request.labels.*.name, 'INCLUDE_NOTEBOOKS_TESTS') }} env: BIONEMO_DATA_SOURCE: ngc run: pytest --nbval-lax -p no:python docs/ sub-packages/ @@ -146,6 +157,5 @@ jobs: steps: - name: clean up image run: docker rmi nemoci.azurecr.io/bionemo:${{ github.run_id }} - # TODO: exclude tests from base image; run tests from github workspace mounted in the image. # TODO: figure out way of cleaning up working directory (requires sudo or for us to fix file ownership from release container)