Skip to content

Commit

Permalink
build: set up flakybot for continuous builds (#58)
Browse files Browse the repository at this point in the history
Fixes #57 

See #59 and #60 for example issues confirming this is set up correctly.
  • Loading branch information
busunkim96 authored Feb 18, 2021
1 parent 36aba74 commit 5962377
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/grafeas/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ docs.metadata

# Virtual environment
env/

# Test logs
coverage.xml
sponge_log.xml
*sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
Expand Down
12 changes: 11 additions & 1 deletion packages/grafeas/.kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,20 @@ python3.6 -m pip uninstall --yes --quiet nox-automation
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version

# If this is a continuous build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
else
python3.6 -m nox
fi
fi
17 changes: 15 additions & 2 deletions packages/grafeas/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def default(session):
session.run(
"py.test",
"--quiet",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=grafeas",
"--cov=tests.unit",
"--cov-append",
Expand Down Expand Up @@ -127,9 +128,21 @@ def system(session):

# Run py.test against the system tests.
if system_test_exists:
session.run("py.test", "--quiet", system_test_path, *session.posargs)
session.run(
"py.test",
"--quiet",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
)
if system_test_folder_exists:
session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)
session.run(
"py.test",
"--quiet",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down

0 comments on commit 5962377

Please sign in to comment.