mirror of
https://github.com/nextcloud/docker.git
synced 2024-11-18 02:56:42 +01:00
Merge pull request #111 from tilosp-docker/travis-build-stages
Use travis build stages
This commit is contained in:
commit
a0ad7ac1c7
2 changed files with 44 additions and 25 deletions
49
.travis.yml
49
.travis.yml
|
@ -1,13 +1,9 @@
|
||||||
language: bash
|
dist: trusty
|
||||||
|
sudo: required
|
||||||
|
|
||||||
services: docker
|
services: docker
|
||||||
|
|
||||||
env:
|
language: bash
|
||||||
- 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
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- git clone https://github.com/docker-library/official-images.git ~/official-images
|
- git clone https://github.com/docker-library/official-images.git ~/official-images
|
||||||
|
@ -15,19 +11,38 @@ install:
|
||||||
before_script:
|
before_script:
|
||||||
- env | sort
|
- env | sort
|
||||||
- image="nextcloud:${VERSION}${VARIANT:+-$VARIANT}"
|
- image="nextcloud:${VERSION}${VARIANT:+-$VARIANT}"
|
||||||
- hash_before=$(git write-tree)
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Test Image
|
|
||||||
- travis_retry docker build -t "$image" "${VERSION}/${VARIANT}"
|
- travis_retry docker build -t "$image" "${VERSION}/${VARIANT}"
|
||||||
- ~/official-images/test/run.sh "$image"
|
- ~/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:
|
after_script:
|
||||||
- docker images
|
- 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| \
|
latests=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \
|
||||||
grep -oE 'nextcloud-[[:digit:]]+(.[[:digit:]]+)+' | \
|
grep -oE 'nextcloud-[[:digit:]]+(.[[:digit:]]+)+' | \
|
||||||
grep -oE '[[: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=
|
travisEnv=
|
||||||
for latest in "${latests[@]}"; do
|
for latest in "${latests[@]}"; do
|
||||||
version=$(echo "$latest" | cut -d. -f1-2)
|
version=$(echo "$latest" | cut -d. -f1-2)
|
||||||
|
|
||||||
|
if [ -d "$version" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# Only add versions >= 10
|
# Only add versions >= 10
|
||||||
if version_greater_or_equal "$version" "10.0"; then
|
if version_greater_or_equal "$version" "10.0"; then
|
||||||
|
|
||||||
|
@ -55,14 +59,14 @@ for latest in "${latests[@]}"; do
|
||||||
# Copy apps.config.php
|
# Copy apps.config.php
|
||||||
cp apps.config.php "$version/$variant/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
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# update .travis.yml
|
# replace the fist '-' with ' '
|
||||||
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
|
travisEnv="$(echo "$travisEnv" | sed '0,/-/{s/-/ /}')"
|
||||||
echo "$travis" > .travis.yml
|
|
||||||
|
|
||||||
# remove duplicate entries
|
# update .travis.yml
|
||||||
echo "$(awk '!NF || !seen[$0]++' .travis.yml)" > .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 a new issue