Use travis build stages
This commit is contained in:
parent
2ed2ea4a28
commit
e5d81338d9
49
.travis.yml
49
.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
|
||||
|
20
update.sh
20
update.sh
@ -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
|
||||
|
||||
# update .travis.yml
|
||||
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
|
||||
echo "$travis" > .travis.yml
|
||||
# replace the fist '-' with ' '
|
||||
travisEnv="$(echo "$travisEnv" | sed '0,/-/{s/-/ /}')"
|
||||
|
||||
# remove duplicate entries
|
||||
echo "$(awk '!NF || !seen[$0]++' .travis.yml)" > .travis.yml
|
||||
# update .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
|
||||
|
Loading…
Reference in New Issue
Block a user