Browse Source

build,travis: don't use TRAVIS_PULL_REQUEST

TRAVIS_PULL_REQUEST can be:
- undefined (local usage)
- false (branch build)
- PR number (if in a PR)
it's never set to true

use TRAVIS_PULL_REQUEST_SHA instead, so we can use normal tests (-z/-n)

Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
lilik-openwrt-22.03
Etienne Champetier 7 years ago
parent
commit
743bfbc1f2
1 changed files with 3 additions and 8 deletions
  1. +3
    -8
      .travis_do.sh

+ 3
- 8
.travis_do.sh View File

@ -68,7 +68,7 @@ download_sdk() {
# test_package call make download check for very new/modified package # test_package call make download check for very new/modified package
test_packages2() { test_packages2() {
local commit_range=$TRAVIS_COMMIT_RANGE local commit_range=$TRAVIS_COMMIT_RANGE
if [ "$TRAVIS_PULL_REQUEST" = false ]; then
if [ -z "$TRAVIS_PULL_REQUEST_SHA" ]; then
echo_blue "Using only the latest commit, since we're not in a Pull Request" echo_blue "Using only the latest commit, since we're not in a Pull Request"
commit_range=HEAD~1 commit_range=HEAD~1
fi fi
@ -148,7 +148,7 @@ EOF
test_commits() { test_commits() {
RET=0 RET=0
if [ "$TRAVIS_PULL_REQUEST" = false ]; then
if [ -z "$TRAVIS_PULL_REQUEST_SHA" ]; then
echo_blue "Skipping commits tests (not in a Pull Request)" echo_blue "Skipping commits tests (not in a Pull Request)"
return 0 return 0
fi fi
@ -196,12 +196,7 @@ echo_blue "=== Travis ENV"
env env
echo_blue "=== Travis ENV" echo_blue "=== Travis ENV"
if [ -z "$TRAVIS_COMMIT_RANGE" ] && [ "$TRAVIS_PULL_REQUEST" = true ] ; then
echo_red "TRAVIS_COMMIT_RANGE variable is empty in a Pull Request"
exit 1
fi
if [ "$TRAVIS_PULL_REQUEST" = true ]; then
if [ -n "$TRAVIS_PULL_REQUEST_SHA" ]; then
while true; do while true; do
# if clone depth is too small, git rev-list / diff return incorrect or empty results # if clone depth is too small, git rev-list / diff return incorrect or empty results
C="$(git rev-list ${TRAVIS_COMMIT_RANGE/.../..} | tail -n1)" 2>/dev/null C="$(git rev-list ${TRAVIS_COMMIT_RANGE/.../..} | tail -n1)" 2>/dev/null


Loading…
Cancel
Save