diff options
author | Tilo Spannagel <development@tilosp.de> | 2017-06-23 16:12:44 +0200 |
---|---|---|
committer | Tilo Spannagel <development@tilosp.de> | 2017-06-23 18:59:00 +0200 |
commit | e5d81338d9fa82d5c7399c58f741acb47f69d8fa (patch) | |
tree | 587083dee040de2c0fd7a7c45e5ab487863db1df | |
parent | 2ed2ea4a28d5b292a3b3af5f577e6f73d3eaeec1 (diff) |
Use travis build stages
-rw-r--r-- | .travis.yml | 49 | ||||
-rwxr-xr-x | update.sh | 18 |
2 files changed, 43 insertions, 24 deletions
diff --git a/.travis.yml b/.travis.yml index 14d4ea14..5165ceb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,9 @@ -language: bash +dist: trusty +sudo: required + services: docker -env: - - VERSION=12.0 VARIANT=fpm - - VERSION=12.0 VARIANT=apache - - VERSION=11.0 VARIANT=fpm - - VERSION=11.0 VARIANT=apache - - VERSION=10.0 VARIANT=fpm - - VERSION=10.0 VARIANT=apache +language: bash install: - git clone https://github.com/docker-library/official-images.git ~/official-images @@ -15,19 +11,38 @@ install: before_script: - env | sort - image="nextcloud:${VERSION}${VARIANT:+-$VARIANT}" - - hash_before=$(git write-tree) script: - # Test Image - travis_retry docker build -t "$image" "${VERSION}/${VARIANT}" - ~/official-images/test/run.sh "$image" - # Test generate-stackbrew-library.sh - - ./generate-stackbrew-library.sh - - # Test update.sh - - ./update.sh - - bash -c "[[ $hash_before = $(git add -A && git write-tree) ]]" - after_script: - docker images + +jobs: + include: + - &test-scripts + stage: test scripts + env: SCRIPT=update.sh + sudo: false + services: [] + install: skip + before_script: skip + script: + - hash_before=$(git write-tree) + - ./update.sh + - bash -c "[[ $hash_before = $(git add -A && git write-tree) ]]" + after_script: skip + + - <<: *test-scripts + env: SCRIPT=generate-stackbrew-library.sh + script: + - ./generate-stackbrew-library.sh + + - stage: test images + env: VERSION=10.0 VARIANT=fpm + - env: VERSION=10.0 VARIANT=apache + - env: VERSION=11.0 VARIANT=fpm + - env: VERSION=11.0 VARIANT=apache + - env: VERSION=12.0 VARIANT=fpm + - env: VERSION=12.0 VARIANT=apache @@ -14,14 +14,18 @@ function version_greater_or_equal() { latests=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \ grep -oE 'nextcloud-[[:digit:]]+(.[[:digit:]]+)+' | \ grep -oE '[[:digit:]]+(.[[:digit:]]+)+' | \ - sort -uV ) ) + sort -urV ) ) -find -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+' -exec rm -r '{}' \; +find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+' -exec rm -r '{}' \; travisEnv= for latest in "${latests[@]}"; do version=$(echo "$latest" | cut -d. -f1-2) + if [ -d "$version" ]; then + continue + fi + # Only add versions >= 10 if version_greater_or_equal "$version" "10.0"; then @@ -55,14 +59,14 @@ for latest in "${latests[@]}"; do # Copy apps.config.php cp apps.config.php "$version/$variant/apps.config.php" - travisEnv='\n - VERSION='"$version"' VARIANT='"$variant$travisEnv" + travisEnv='\n - env: VERSION='"$version"' VARIANT='"$variant$travisEnv" done fi done +# replace the fist '-' with ' ' +travisEnv="$(echo "$travisEnv" | sed '0,/-/{s/-/ /}')" + # update .travis.yml -travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)" +travis="$(awk -v 'RS=\n\n' '$1 == "-" && $2 == "stage:" && $3 == "test" && $4 == "images" { $0 = " - stage: test images'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)" echo "$travis" > .travis.yml - -# remove duplicate entries -echo "$(awk '!NF || !seen[$0]++' .travis.yml)" > .travis.yml |