Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run notebook tests automatically if any notebooks have changed #615

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pstjohn
Copy link
Collaborator

@pstjohn pstjohn commented Jan 16, 2025

Description

Check and run notebook tests automatically if any *.ipynb files have changed.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor
  • Documentation update
  • Other (please describe):

CI Pipeline Configuration

Configure CI behavior by applying the relevant labels:

Note

By default, the notebooks validation tests are skipped unless explicitly enabled.

Usage

TODO: Add code snippet

Pre-submit Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly
  • I have added/updated tests as needed
  • All existing tests pass successfully

@pstjohn pstjohn force-pushed the pstjohn/run-notebook-tests-by-default branch from e086b1d to 17d2218 Compare January 16, 2025 21:16
Copy link
Collaborator

@jstjohn jstjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One clarifying question though.

- name: Check for notebook changes
id: check_notebooks
run: |
if git diff --quiet main HEAD -- '*.ipynb'; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment what this if line is doing? Based on the variable getting set on the next line it's the opposite of what I would expect (looking for a match).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm not sure it's working yet 🤣

Signed-off-by: Peter St. John <pstjohn@nvidia.com>
@pstjohn pstjohn force-pushed the pstjohn/run-notebook-tests-by-default branch from 17d2218 to 361b106 Compare January 17, 2025 02:25
@pstjohn pstjohn requested a review from trvachov as a code owner January 17, 2025 02:25
if: ${{ contains(github.event.pull_request.labels.*.name, 'INCLUDE_NOTEBOOKS_TESTS') }}
if: |
${{ env.STATE_check_notebooks == '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/
Copy link
Collaborator

@dorotat-nv dorotat-nv Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cant we use here

run: ./ci/scripts/run_pytest.sh --skip-slow
instead of
pytest --nbval-lax -p no:python docs/ sub-packages/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there's no option in run_pytest to only run the notebook tests, right? This is currently only running the notebook tests in this step, since the previous step ran all the pytests.

It just seemed more complicated to try to conditionally add that flag than to conditionally run another step

@@ -113,13 +113,19 @@ jobs:
with:
path: ${{ github.run_id }}

- name: Check for notebook changes
id: check_notebooks
run: check_notebooks=$(git diff --quiet main HEAD -- '*.ipynb' && echo false || echo true) >> $GITHUB_ENV
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be correct

check_notebooks=$(git diff --quiet main HEAD -- '*.ipynb' && echo false || echo true)
echo "check_notebooks=$check_notebooks" >> $GITHUB_ENV

Signed-off-by: Peter St. John <peterc.stjohn@gmail.com>
Signed-off-by: Peter St. John <peterc.stjohn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants