-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WIP] chore(bigframes): add specific build script for doctest to restrict execution #16711
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
596ce5c
397fdd8
0b369bc
4f1854c
4c593a8
7d63adb
b94c5bb
c23c949
637b4af
b60e703
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||
| # `-e` enables the script to automatically fail when a command fails | ||||||||||||||||||||||||||
| # `-o pipefail` sets the exit code to non-zero if any command fails, | ||||||||||||||||||||||||||
| # or zero if all commands in the pipeline exit successfully. | ||||||||||||||||||||||||||
| set -eo pipefail | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Disable buffering, so that the logs stream through. | ||||||||||||||||||||||||||
| export PYTHONUNBUFFERED=1 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Assume we are running from the repo root or we need to find it. | ||||||||||||||||||||||||||
| # If this script is in packages/bigframes/scripts/run_doctest.sh, | ||||||||||||||||||||||||||
| # then repo root is 3 levels up. | ||||||||||||||||||||||||||
| export PROJECT_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/../../..) | ||||||||||||||||||||||||||
| cd "$PROJECT_ROOT" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # This is needed in order for `git diff` to succeed | ||||||||||||||||||||||||||
| git config --global --add safe.directory $(realpath .) | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| package_name="bigframes" | ||||||||||||||||||||||||||
| package_path="packages/${package_name}" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Determine if we should skip based on git diff | ||||||||||||||||||||||||||
| files_to_check="${package_path}" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "checking changes with 'git diff ${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT} -- ${files_to_check}'" | ||||||||||||||||||||||||||
| set +e | ||||||||||||||||||||||||||
| package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- ${files_to_check} | wc -l) | ||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [[ "${package_modified}" -gt 0 || "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]]; then | ||||||||||||||||||||||||||
| echo "------------------------------------------------------------" | ||||||||||||||||||||||||||
| echo "Running doctest for: ${package_name}" | ||||||||||||||||||||||||||
| echo "------------------------------------------------------------" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export GOOGLE_CLOUD_PROJECT="bigframes-testing" | ||||||||||||||||||||||||||
| export NOX_SESSION="cleanup doctest" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| cd "${package_path}" | ||||||||||||||||||||||||||
| python3 -m nox -s "${NOX_SESSION}" | ||||||||||||||||||||||||||
|
chalmerlowe marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "No changes in ${package_name} and not a continuous build, skipping." | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument to
realpathshould be quoted to correctly handle directory paths that may contain spaces.