Skip to content

Commit 5962377

Browse files
authored
build: set up flakybot for continuous builds (#58)
Fixes #57 See #59 and #60 for example issues confirming this is set up correctly.
1 parent 36aba74 commit 5962377

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

packages/grafeas/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ docs.metadata
5050

5151
# Virtual environment
5252
env/
53+
54+
# Test logs
5355
coverage.xml
54-
sponge_log.xml
56+
*sponge_log.xml
5557

5658
# System test environment variables.
5759
system_tests/local_test_setup

packages/grafeas/.kokoro/build.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,20 @@ python3.6 -m pip uninstall --yes --quiet nox-automation
3636
python3.6 -m pip install --upgrade --quiet nox
3737
python3.6 -m nox --version
3838

39+
# If this is a continuous build, send the test log to the FlakyBot.
40+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
41+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
42+
cleanup() {
43+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
44+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
45+
}
46+
trap cleanup EXIT HUP
47+
fi
48+
3949
# If NOX_SESSION is set, it only runs the specified session,
4050
# otherwise run all the sessions.
4151
if [[ -n "${NOX_SESSION:-}" ]]; then
4252
python3.6 -m nox -s "${NOX_SESSION:-}"
4353
else
4454
python3.6 -m nox
45-
fi
55+
fi

packages/grafeas/noxfile.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def default(session):
7979
session.run(
8080
"py.test",
8181
"--quiet",
82+
f"--junitxml=unit_{session.python}_sponge_log.xml",
8283
"--cov=grafeas",
8384
"--cov=tests.unit",
8485
"--cov-append",
@@ -127,9 +128,21 @@ def system(session):
127128

128129
# Run py.test against the system tests.
129130
if system_test_exists:
130-
session.run("py.test", "--quiet", system_test_path, *session.posargs)
131+
session.run(
132+
"py.test",
133+
"--quiet",
134+
f"--junitxml=system_{session.python}_sponge_log.xml",
135+
system_test_path,
136+
*session.posargs,
137+
)
131138
if system_test_folder_exists:
132-
session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)
139+
session.run(
140+
"py.test",
141+
"--quiet",
142+
f"--junitxml=system_{session.python}_sponge_log.xml",
143+
system_test_folder_path,
144+
*session.posargs,
145+
)
133146

134147

135148
@nox.session(python=DEFAULT_PYTHON_VERSION)

0 commit comments

Comments
 (0)