Skip to content

Commit

Permalink
Added new script + travis execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Pierce committed Sep 17, 2019
1 parent c4da348 commit 7ddd84a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .cicd/submodule-regression-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ declare -A BASE_MAP
if ${TRAVIS:-false}; then
BASE_BRANCH=$TRAVIS_BRANCH
CURRENT_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} # We default to TRAVIS_BRANCH if it's not a PR so it passes on non PR runs
[[ ! -z $TRAVIS_PULL_REQUEST_SLUG ]] && CURRENT_BRANCH=$TRAVIS_COMMIT # Support git log & echo output
else
BASE_BRANCH=${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-$BUILDKITE_BRANCH}
CURRENT_BRANCH=$BUILDKITE_BRANCH
fi
[[ $BASE_BRANCH == $CURRENT_BRANCH ]] && echo 'BASE_BRANCH and CURRENT_BRANCH are the same' && exit 0

echo "getting submodule info for $CURRENT_BRANCH"
while read -r a b; do
PR_MAP[$a]=$b
done < <(git submodule --quiet foreach --recursive 'echo $path `git log -1 --format=%ct`')

echo "getting submodule info for $BASE_BRANCH"
git checkout $BASE_BRANCH &> /dev/null
git submodule update --init &> /dev/null
while read -r a b; do
BASE_MAP[$a]=$b
done < <(git submodule --quiet foreach --recursive 'echo $path `git log -1 --format=%ct`')

for k in "${!BASE_MAP[@]}"; do
base_ts=${BASE_MAP[$k]}
pr_ts=${PR_MAP[$k]}
Expand All @@ -28,7 +33,17 @@ for k in "${!BASE_MAP[@]}"; do
echo " timestamp on $BASE_BRANCH: $base_ts"
if (( $pr_ts < $base_ts)); then
echo "$k is older on $CURRENT_BRANCH than $BASE_BRANCH; investigating..."
if for c in `git log $CURRENT_BRANCH ^$BASE_BRANCH --pretty=format:"%H"`; do git show --pretty="" --name-only $c; done | grep -q "^$k$"; then
if [[ $TRAVIS == true && ! -z $TRAVIS_PULL_REQUEST_SLUG ]]; then # IF it's a forked PR, we need to switch back to the PR ref/head so we can git log properly
echo "git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge:"
git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge: &> /dev/null
echo "switching back to $TRAVIS_PULL_REQUEST_SLUG:$TRAVIS_PULL_REQUEST_BRANCH ($TRAVIS_COMMIT)"
echo 'git checkout -qf FETCH_HEAD'
git checkout -qf FETCH_HEAD &> /dev/null
elif [[ $BUILDKITE == true ]]; then
echo "switching back to $CURRENT_BRANCH"
git checkout -f $CURRENT_BRANCH &> /dev/null
fi
if [[ ! -z $(for c in $(git --no-pager log $CURRENT_BRANCH ^$BASE_BRANCH --pretty=format:"%H"); do git show --pretty="" --name-only $c; done | grep "^$k$") ]]; then
echo "ERROR: $k has regressed"
exit 1
else
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ matrix:
- ccache
env:
- PATH="/usr/local/opt/ccache/libexec:$PATH"
script: "ccache --max-size=1G && ./.cicd/build.sh && ./.cicd/test.sh scripts/parallel-test.sh && ./.cicd/test.sh scripts/serial-test.sh"
script: "ccache --max-size=1G && ./.cicd/build.sh && ./.cicd/test.sh scripts/parallel-test.sh && ./.cicd/test.sh scripts/serial-test.sh && [[ $(uname) != 'Darwin' ]] && ./.cicd/submodule-regression-check.sh"
notifications:
webhooks:
secure: gmqODqoFAil2cR7v++ibqRNECBOSD/VJX+2qPa7XptkVWmVMzbII5CNgBQAscjFsp9arHPMXCCzkBi847PCSiHdsnYFQ4T273FLRWr3cDbLjfmR+BJ7dGKvQnlpSi2Ze2TtAPJyRl+iv+cxDj7cWE5zw2c4xbgh1a/cNO+/ayUfFkyMEIfVWRsHkdkra4gOLywou0XRLHr4CX1V60uU7uuqATnIMMi7gQYwiKKtZqjkbf8wcBvZirDhjQ6lDPN5tnZo6L4QHmqjtzNJg/UrD4h+zES53dLVI4uxlXRAwwpw+mJOFA3QE/3FT+bMQjLCffUz4gZaWcdgebPYzrwSWUbJoFdWAOwcTqivQY0FIQzcz/r6uGWcwWTavzkPEbg68BVM2BZId/0110J6feeTkpJ3MPV+UsIoGTvbg50vi/I06icftuZ/cLqDj3+Emifm7Jlr1sRTSdqtYAJj/2ImUfsb46cwgjAVhFOTvc+KuPgJQgvOXV7bZkxEr5qDWo8Al2sV8BWb83j1rMlZ4LfERokImDVqxu2kkcunchzvhtYFTesSpmwegVpwceCtOtO0rEUgATnfTEHzk2rm8nuz4UtidsQnluUKqmKD0QCqHXFfn+3ZRJsDqr+iCYdxv1BAeAVc9q1L7bgrKDMGiJgkxuhZ2v3J2SflWLvjZjFDduuc=

0 comments on commit 7ddd84a

Please sign in to comment.