Browse Source

dist: build_and_test.sh: don't hard-code base branch

pr/spi.typo
Kaspar Schleiser 7 years ago
parent
commit
f048475bec
  1. 34
      dist/tools/travis-scripts/build_and_test.sh

34
dist/tools/travis-scripts/build_and_test.sh vendored

@ -7,6 +7,8 @@
# directory for more details.
#
CI_BASE_BRANCH=${CI_BASE_BRANCH:-master}
if [[ $BUILDTEST_MCU_GROUP ]]
then
@ -15,14 +17,14 @@ then
RESULT=0
RECALL="$1"
if git diff master HEAD -- .travis.yml &> /dev/null; then
if git diff ${CI_BASE_BRANCH} HEAD -- .travis.yml &> /dev/null; then
# check if .travis.yml was changed in the current PR and skip if so
if ! git diff --name-only $(git merge-base HEAD master)..HEAD -- \
if ! git diff --name-only $(git merge-base HEAD ${CI_BASE_BRANCH})..HEAD -- \
.travis.yml &> 1; then
echo "==============================================================" >&2
echo -e "\033[1;31m.travis.yml differs in upstream.\033[0m"
echo -e "\033[1;31mPlease rebase your PR to current upstream or expect errors!!!!\033[0m" >&2
echo " git fetch https://github.com/RIOT-OS/RIOT master" >&2
echo " git fetch https://github.com/RIOT-OS/RIOT ${CI_BASE_BRANCH}" >&2
echo " git rebase FETCH_HEAD" >&2
echo " git push -f origin $(git rev-parse --abbrev-ref HEAD)" >&2
echo "==============================================================" >&2
@ -31,8 +33,8 @@ then
fi
if [ "$RECALL" != "recall" ]; then
if git diff master HEAD -- "$0" &> /dev/null; then
git rebase master || git rebase --abort
if git diff ${CI_BASE_BRANCH} HEAD -- "$0" &> /dev/null; then
git rebase ${CI_BASE_BRANCH} || git rebase --abort
"$0" "recall"
exit $?
@ -41,30 +43,30 @@ then
trap "RESULT=1" ERR
git rebase master || git rebase --abort
git rebase ${CI_BASE_BRANCH} || git rebase --abort
if [ $RESULT -ne 0 ]; then
exit $RESULT
fi
./dist/tools/whitespacecheck/check.sh master
./dist/tools/whitespacecheck/check.sh ${CI_BASE_BRANCH}
./dist/tools/licenses/check.sh master --diff-filter=MR --error-exitcode=0
./dist/tools/licenses/check.sh ${CI_BASE_BRANCH} --diff-filter=MR --error-exitcode=0
./dist/tools/licenses/check.sh master --diff-filter=AC
./dist/tools/licenses/check.sh ${CI_BASE_BRANCH} --diff-filter=AC
./dist/tools/doccheck/check.sh master
./dist/tools/doccheck/check.sh ${CI_BASE_BRANCH}
./dist/tools/externc/check.sh master
./dist/tools/externc/check.sh ${CI_BASE_BRANCH}
# TODO:
# Remove all but `master` parameters to cppcheck (and remove second
# Remove all but `${CI_BASE_BRANCH}` parameters to cppcheck (and remove second
# invocation) once all warnings of cppcheck have been taken care of
# in master.
./dist/tools/cppcheck/check.sh master --diff-filter=MR --error-exitcode=0
# in ${CI_BASE_BRANCH}.
./dist/tools/cppcheck/check.sh ${CI_BASE_BRANCH} --diff-filter=MR --error-exitcode=0
./dist/tools/cppcheck/check.sh master --diff-filter=AC
./dist/tools/cppcheck/check.sh ${CI_BASE_BRANCH} --diff-filter=AC
./dist/tools/pr_check/pr_check.sh master
./dist/tools/pr_check/pr_check.sh ${CI_BASE_BRANCH}
exit $RESULT
fi

Loading…
Cancel
Save