travis.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. set -e
  3. cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
  4. repos=( --all )
  5. upstreamRepo='docker-library/official-images'
  6. upstreamBranch='master'
  7. if [ "$TRAVIS_PULL_REQUEST" -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
  8. upstreamRepo="$TRAVIS_REPO_SLUG"
  9. upstreamBranch="$TRAVIS_BRANCH"
  10. fi
  11. HEAD="$(git rev-parse --verify HEAD)"
  12. git fetch -q "https://github.com/$upstreamRepo.git" "refs/heads/$upstreamBranch"
  13. UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
  14. if [ "$(git diff --numstat "$UPSTREAM...$HEAD" -- . | wc -l)" -ne 0 ]; then
  15. # changes in bashbrew/ -- keep "--all" so we test the bashbrew script changes appropriately
  16. echo >&2 'Changes in bashbrew/ detected!'
  17. else
  18. repos=( $(git diff --numstat "$UPSTREAM...$HEAD" -- ../library | awk -F '/' '{ print $2 }') )
  19. fi
  20. if [ "${#repos[@]}" -eq 0 ]; then
  21. echo >&2 'Skipping test builds: no changes to library/ or bashbrew/ in PR'
  22. exit
  23. fi
  24. # --no-build because we has no Docker in Travis :)
  25. # TODO that will change eventually!
  26. set -x
  27. ./bashbrew.sh list --namespaces='_' "${repos[@]}"
  28. ./bashbrew.sh build --no-build "${repos[@]}"
  29. ./bashbrew.sh push --no-push "${repos[@]}"