Skip to content

Commit

Permalink
Merge pull request #3037 from BytesGalore/travis_compile_on_demand
Browse files Browse the repository at this point in the history
travis: enable travis compile tests on set github label `Ready for Travis build`
  • Loading branch information
kaspar030 committed May 26, 2015
2 parents 9e273be + 7df0d9b commit 794d838
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 28 deletions.
32 changes: 32 additions & 0 deletions dist/tools/pr_check/check_labels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#! /bin/bash
#
# Copyright (C) 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#

# The following script part has been moved here from:
# ./dist/tools/pr_check/pr_check.sh

GITHUB_API_HOST="https://api.github.com"
GITHUB_REPO="RIOT-OS/RIOT"

if which wget &> /dev/null; then
GET="wget -O -"
elif which curl &> /dev/null; then
GET="curl"
else
echo "Script needs wget or curl" >&2
exit 2
fi

LABELS_JSON=$(${GET} "${GITHUB_API_HOST}/repos/${GITHUB_REPO}/issues/${TRAVIS_PULL_REQUEST}/labels" 2> /dev/null)

check_gh_label() {
LABEL="${1}"

echo "${LABELS_JSON}" | grep -q "${LABEL}"
return $?
}
21 changes: 1 addition & 20 deletions dist/tools/pr_check/pr_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,7 @@
#

EXIT_CODE=0
GITHUB_API_HOST="https://api.github.com"
GITHUB_REPO="RIOT-OS/RIOT"

if which wget &> /dev/null; then
GET="wget -O -"
elif which curl &> /dev/null; then
GET="curl"
else
echo "Script needs wget or curl" >&2
exit 2
fi

LABELS_JSON=$(${GET} "${GITHUB_API_HOST}/repos/${GITHUB_REPO}/issues/${TRAVIS_PULL_REQUEST}/labels" 2> /dev/null)
source ./dist/tools/pr_check/check_labels.sh

if tput colors &> /dev/null && [ $(tput colors) -ge 8 ]; then
CERROR="\e[1;31m"
Expand All @@ -30,13 +18,6 @@ else
CRESET=
fi

check_gh_label() {
LABEL="${1}"

echo "${LABELS_JSON}" | grep -q "${LABEL}"
return $?
}

if [[ ${#} -eq 1 ]]; then
RIOT_MASTER="${1}"
else
Expand Down
25 changes: 17 additions & 8 deletions dist/tools/travis-scripts/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set_result() {

if [[ $BUILDTEST_MCU_GROUP ]]
then

if [ "$BUILDTEST_MCU_GROUP" == "static-tests" ]
then
RESULT=0
Expand Down Expand Up @@ -60,14 +61,22 @@ then

exit $RESULT
fi
if [ "$BUILDTEST_MCU_GROUP" == "x86" ]
then

make -C ./tests/unittests all test BOARD=native || exit
# TODO:
# Reenable once https://github.com/RIOT-OS/RIOT/issues/2300 is
# resolved:
# - make -C ./tests/unittests all test BOARD=qemu-i386 || exit
source ./dist/tools/pr_check/check_labels.sh

if check_gh_label "Ready for CI build"; then
if [ "$BUILDTEST_MCU_GROUP" == "x86" ]
then
make -C ./tests/unittests all test BOARD=native || exit
# TODO:
# Reenable once https://github.com/RIOT-OS/RIOT/issues/2300 is
# resolved:
# - make -C ./tests/unittests all test BOARD=qemu-i386 || exit
fi
echo -e "\e[0;32mCompile tests will be performed for this pull request\e[0m"
./dist/tools/compile_test/compile_test.py riot/master
else
echo -e "\e[33;40mCompile tests will be skipped for this pull request\e[0m"
exit 1
fi
./dist/tools/compile_test/compile_test.py riot/master
fi

0 comments on commit 794d838

Please sign in to comment.