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

[DO NOT MERGE] Testing travis - break a test #382

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ after_success:
branches:
only:
- master
- travis-run-changed
42 changes: 41 additions & 1 deletion travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,46 @@ SKIP_TESTS=false
if [ -z "$GOOGLE_APPLICATION_CREDENTIALS" ] ; then
SKIP_TESTS=true
fi

# Finds the closest parent dir that encompasses all changed files, and has a
# pom.xml
travis_changed_files_parent() {
[ -z "$TRAVIS_PULL_REQUEST" ] && return 0 # If we're not in a PR, forget it

(
set +e

changed="$(git diff --name-only "$TRAVIS_COMMIT" "$TRAVIS_BRANCH")"
if [ $? -ne 0 ]; then
# Fall back to git head
changed="$(git diff --name-only "$(git rev-parse HEAD)" "$TRAVIS_BRANCH")"
[ $? -ne 0 ] && return 0 # Give up. Just run everything.
fi

# Find the common prefix
prefix="$(echo "$changed" | sed -e 'N;s/^\(.*\).*\n\1.*$/\1\n\1/;D')"

while [ ! -z "$prefix" ] && [ ! -r "$prefix/pom.xml" ] && [ "${prefix%/*}" != "$prefix" ]; do
prefix="${prefix%/*}"
done

[ -r "$prefix/pom.xml" ] || return 0

echo "$prefix"
)
}

git branch -r
exit 1
travis_changed_files_parent
common_travis_dir="$(travis_changed_files_parent)"

[ -z "$common_travis_dir" ] || pushd "$common_travis_dir"

mvn --batch-mode clean verify -DskipTests=$SKIP_TESTS | egrep -v "(^\[INFO\] Download|^\[INFO\].*skipping)"

[ -z "$common_travis_dir" ] || popd

# Check that all shell scripts in this repo (including this one) pass the
# Shell Check linter.
shellcheck ./**/*.sh
Expand All @@ -44,7 +82,9 @@ test_localhost() {
appengine/datastore/indexes-perfect
)
for testdir in "${devserver_tests[@]}" ; do
./java-repo-tools/scripts/test-localhost.sh appengine "${testdir}"
if [ -z "$common_travis_dir" ] || [[ $testdir = $common_travis_dir* ]]; then
./java-repo-tools/scripts/test-localhost.sh appengine "${testdir}"
fi
done

# newplugin_std_tests=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class FaceDetectAppTest {
// Assert
assertThat(img.getRGB(10, 5) & 0x00ff00)
.named("img face #1 vertex (10, 5) green channel")
.isEqualTo(0x00ff00);
.isEqualTo(0x0fff00);
assertThat(img.getRGB(20, 5) & 0x00ff00)
.named("img face #1 vertex (20, 5) green channel")
.isEqualTo(0x00ff00);
Expand Down