Merge pull request #433 from nschonni/shellcheck
Add Shellcheck to Travis and fix existing checks
This commit is contained in:
commit
61336a7bb2
|
@ -3,7 +3,15 @@ sudo: required
|
|||
services:
|
||||
- docker
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- debian-sid
|
||||
packages:
|
||||
- shellcheck
|
||||
|
||||
script:
|
||||
- shellcheck *.sh
|
||||
- ./test-build.sh $NODE_VERSION
|
||||
|
||||
env:
|
||||
|
|
|
@ -3,13 +3,17 @@ set -e
|
|||
|
||||
hash git 2>/dev/null || { echo >&2 "git not found, exiting."; }
|
||||
|
||||
# Used dynamically: print "$array_" $1
|
||||
# shellcheck disable=SC2034
|
||||
array_4_8='4 argon';
|
||||
# shellcheck disable=SC2034
|
||||
array_6_11='6 boron';
|
||||
# shellcheck disable=SC2034
|
||||
array_8_1='8 latest';
|
||||
|
||||
cd $(cd ${0%/*} && pwd -P);
|
||||
cd "$(cd "${0%/*}" && pwd -P)";
|
||||
|
||||
self="$(basename "$BASH_SOURCE")"
|
||||
self="$(basename "${BASH_SOURCE[0]}")"
|
||||
|
||||
versions=( */ )
|
||||
versions=( "${versions[@]%/}" )
|
||||
|
@ -40,7 +44,7 @@ for version in "${versions[@]}"; do
|
|||
# Skip "docs" and other non-docker directories
|
||||
[ -f "$version/Dockerfile" ] || continue
|
||||
|
||||
eval stub=$(echo "$version" | awk -F. '{ print "$array_" $1 "_" $2 }');
|
||||
eval stub="$(echo "$version" | awk -F. '{ print "$array_" $1 "_" $2 }')";
|
||||
commit="$(fileCommit "$version")"
|
||||
fullVersion="$(grep -m1 'ENV NODE_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)"
|
||||
|
||||
|
@ -51,7 +55,7 @@ for version in "${versions[@]}"; do
|
|||
echo "Directory: ${version}"
|
||||
echo
|
||||
|
||||
variants=$(echo $version/*/ | xargs -n1 basename)
|
||||
variants=$(echo "$version"/*/ | xargs -n1 basename)
|
||||
for variant in $variants; do
|
||||
# Skip non-docker directories
|
||||
[ -f "$version/$variant/Dockerfile" ] || continue
|
||||
|
|
|
@ -16,7 +16,7 @@ fatal() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
cd $(cd ${0%/*} && pwd -P);
|
||||
cd "$(cd "${0%/*}" && pwd -P)" || exit;
|
||||
|
||||
versions=( "$@" )
|
||||
if [ ${#versions[@]} -eq 0 ]; then
|
||||
|
@ -28,40 +28,38 @@ for version in "${versions[@]}"; do
|
|||
# Skip "docs" and other non-docker directories
|
||||
[ -f "$version/Dockerfile" ] || continue
|
||||
|
||||
tag=$(cat $version/Dockerfile | grep "ENV NODE_VERSION" | cut -d' ' -f3)
|
||||
tag=$(grep "ENV NODE_VERSION" "$version/Dockerfile" | cut -d' ' -f3)
|
||||
|
||||
info "Building $tag..."
|
||||
docker build -t node:$tag $version
|
||||
|
||||
if [[ $? -gt 0 ]]; then
|
||||
if ! docker build -t node:"$tag" "$version"; then
|
||||
fatal "Build of $tag failed!"
|
||||
else
|
||||
info "Build of $tag succeeded."
|
||||
fi
|
||||
|
||||
OUTPUT=$(docker run --rm -it node:$tag node -e "process.stdout.write(process.versions.node)")
|
||||
OUTPUT=$(docker run --rm -it node:"$tag" node -e "process.stdout.write(process.versions.node)")
|
||||
if [ "$OUTPUT" != "$tag" ]; then
|
||||
fatal "Test of $tag failed!"
|
||||
else
|
||||
info "Test of $tag succeeded."
|
||||
fi
|
||||
|
||||
variants=$(echo $version/*/ | xargs -n1 basename)
|
||||
variants=$(echo "$version"/*/ | xargs -n1 basename)
|
||||
|
||||
for variant in $variants; do
|
||||
# Skip non-docker directories
|
||||
[ -f "$version/$variant/Dockerfile" ] || continue
|
||||
|
||||
info "Building $tag-$variant variant..."
|
||||
docker build -t node:$tag-$variant $version/$variant
|
||||
|
||||
if [[ $? -gt 0 ]]; then
|
||||
info "Building $tag-$variant variant..."
|
||||
|
||||
if ! docker build -t node:"$tag-$variant" "$version/$variant"; then
|
||||
fatal "Build of $tag-$variant failed!"
|
||||
else
|
||||
info "Build of $tag-$variant succeeded."
|
||||
fi
|
||||
|
||||
OUTPUT=$(docker run --rm -it node:$tag-$variant node -e "process.stdout.write(process.versions.node)")
|
||||
OUTPUT=$(docker run --rm -it node:"$tag-$variant" node -e "process.stdout.write(process.versions.node)")
|
||||
if [ "$OUTPUT" != "$tag" ]; then
|
||||
fatal "Test of $tag-$variant failed!"
|
||||
else
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd $(cd ${0%/*} && pwd -P);
|
||||
cd "$(cd "${0%/*}" && pwd -P)";
|
||||
|
||||
versions=( "$@" )
|
||||
if [ ${#versions[@]} -eq 0 ]; then
|
||||
|
@ -39,7 +39,7 @@ for version in "${versions[@]}"; do
|
|||
|
||||
update_node_version
|
||||
|
||||
variants=$(echo $version/*/ | xargs -n1 basename)
|
||||
variants=$(echo "$version"/*/ | xargs -n1 basename)
|
||||
|
||||
for variant in $variants; do
|
||||
# Skip non-docker directories
|
||||
|
|
Loading…
Reference in New Issue