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

Improve file filtering in CI #734

Merged
merged 4 commits into from
Jan 31, 2024
Merged

Conversation

frankharkins
Copy link
Member

The transpiler-stages notebook is broken, but will be tested in CI any time someone edits it (even if just changing copy etc.). This breaks PRs that are perfectly fine.

This PR ignores excluded files completely. I also took the opportunity to:

  • improve the code readability somewhat (i.e. less path for path in paths if path),
  • print a message when notebooks are skipped, otherwise someone running tox locally might believe their notebook was fine even though it never ran.

@@ -35,6 +35,36 @@
]


def filter_paths(paths: list[Path], submit_jobs: bool) -> list[Path]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nicer is to return Iterator[Path]. Every time you want to return a path, you will yield path. No need to have good_paths as a collection - remove that. No return statement.

documentation/start

Lines 21 to 29 in ff3500a

def translation_volume_mounts() -> Iterator[str]:
"""Return the CLI args to mount each language in the translations/ folder.
Unlike the root `Dockerfile`, we cannot use `-v $PWD/translations:/home/node/app/docs` because
Docker complains that the volume is already mounted when we mount the `/docs` folder. So, instead
we need to be more specific to mount each language's folder.
"""
for folder in PWD.glob("translations/*"):
yield from ["-v", f"{folder}:/home/node/app/docs/{folder.name}"]

Copy link
Member Author

Choose a reason for hiding this comment

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

Much nicer, thanks!

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
@frankharkins frankharkins marked this pull request as ready for review January 31, 2024 19:22
Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Nice!

scripts/nb-tester/test-notebook.py Outdated Show resolved Hide resolved
scripts/nb-tester/test-notebook.py Outdated Show resolved Hide resolved
scripts/nb-tester/test-notebook.py Outdated Show resolved Hide resolved
frankharkins and others added 2 commits January 31, 2024 20:30
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
@frankharkins frankharkins added this pull request to the merge queue Jan 31, 2024
Merged via the queue into main with commit e8e0f98 Jan 31, 2024
2 checks passed
@frankharkins frankharkins deleted the FH/improve-notebook-filtering branch January 31, 2024 21:08
frankharkins added a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
The `transpiler-stages` notebook is broken, but will be tested in CI any
time someone edits it (even if just changing copy etc.). This breaks PRs
that are perfectly fine.

This PR ignores excluded files completely. I also took the opportunity
to:
- improve the code readability somewhat (i.e. less `path for path in
paths if path`),
- print a message when notebooks are skipped, otherwise someone running
`tox` locally might believe their notebook was fine even though it never
ran.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants