Set up Travis build matrix
This commit is contained in:
parent
bfb2d79e54
commit
f9c8a255be
|
@ -1,18 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
# This script compile shellcheck binaries
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# Remove all tests to reduce binary size
|
|
||||||
./striptests
|
|
||||||
|
|
||||||
mkdir -p deploy
|
|
||||||
|
|
||||||
_cleanup(){
|
_cleanup(){
|
||||||
rm -rf dist shellcheck || true
|
rm -rf dist shellcheck || true
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" = 'linux' ]
|
build_linux() {
|
||||||
then
|
|
||||||
# Linux Docker image
|
# Linux Docker image
|
||||||
name="$DOCKER_BASE"
|
name="$DOCKER_BASE"
|
||||||
DOCKER_BUILDS="$DOCKER_BUILDS $name"
|
DOCKER_BUILDS="$DOCKER_BUILDS $name"
|
||||||
|
@ -38,14 +30,20 @@ then
|
||||||
sed -e '/DELETE-MARKER/,$d' Dockerfile > Dockerfile.alpine
|
sed -e '/DELETE-MARKER/,$d' Dockerfile > Dockerfile.alpine
|
||||||
docker build -f Dockerfile.alpine -t "$name:current" .
|
docker build -f Dockerfile.alpine -t "$name:current" .
|
||||||
docker run "$name:current" sh -c 'shellcheck --version'
|
docker run "$name:current" sh -c 'shellcheck --version'
|
||||||
|
_cleanup
|
||||||
|
}
|
||||||
|
|
||||||
|
build_aarch64() {
|
||||||
# Linux aarch64 static executable
|
# Linux aarch64 static executable
|
||||||
docker run -v "$PWD:/mnt" koalaman/aarch64-builder 'buildsc'
|
docker run -v "$PWD:/mnt" koalaman/aarch64-builder 'buildsc'
|
||||||
for tag in $TAGS
|
for tag in $TAGS
|
||||||
do
|
do
|
||||||
cp "shellcheck" "deploy/shellcheck-$tag.linux-aarch64"
|
cp "shellcheck" "deploy/shellcheck-$tag.linux-aarch64"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
build_armv6hf() {
|
||||||
# Linux armv6hf static executable
|
# Linux armv6hf static executable
|
||||||
docker run -v "$PWD:/mnt" koalaman/armv6hf-builder -c 'compile-shellcheck'
|
docker run -v "$PWD:/mnt" koalaman/armv6hf-builder -c 'compile-shellcheck'
|
||||||
for tag in $TAGS
|
for tag in $TAGS
|
||||||
|
@ -53,7 +51,9 @@ then
|
||||||
cp "shellcheck" "deploy/shellcheck-$tag.linux-armv6hf";
|
cp "shellcheck" "deploy/shellcheck-$tag.linux-armv6hf";
|
||||||
done
|
done
|
||||||
_cleanup
|
_cleanup
|
||||||
|
}
|
||||||
|
|
||||||
|
build_windows() {
|
||||||
# Windows .exe
|
# Windows .exe
|
||||||
docker run --user="$UID" -v "$PWD:/appdata" koalaman/winghc cuib
|
docker run --user="$UID" -v "$PWD:/appdata" koalaman/winghc cuib
|
||||||
for tag in $TAGS
|
for tag in $TAGS
|
||||||
|
@ -61,18 +61,22 @@ then
|
||||||
cp "dist/build/ShellCheck/shellcheck.exe" "deploy/shellcheck-$tag.exe";
|
cp "dist/build/ShellCheck/shellcheck.exe" "deploy/shellcheck-$tag.exe";
|
||||||
done
|
done
|
||||||
_cleanup
|
_cleanup
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" = 'osx' ];
|
build_osx() {
|
||||||
then
|
|
||||||
# Darwin x86_64 static executable
|
# Darwin x86_64 static executable
|
||||||
|
brew install cabal-install pandoc gnu-tar
|
||||||
sudo ln -s /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
|
sudo ln -s /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
|
||||||
brew install cabal-install pandoc
|
sudo ln -s /usr/local/bin/gtar /usr/local/bin/tar
|
||||||
|
export PATH="/usr/local/bin:$PATH"
|
||||||
|
|
||||||
cabal update
|
cabal update
|
||||||
cabal new-build shellcheck
|
cabal install --dependencies-only
|
||||||
|
cabal build shellcheck
|
||||||
for tag in $TAGS
|
for tag in $TAGS
|
||||||
do
|
do
|
||||||
cp "$HOME/.cabal/dist/build/shellcheck/shellcheck" "deploy/shellcheck-$tag.darwin-x86_64";
|
cp "dist/build/shellcheck/shellcheck" "deploy/shellcheck-$tag.darwin-x86_64";
|
||||||
done
|
done
|
||||||
_cleanup
|
_cleanup
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,17 +51,13 @@ do
|
||||||
rm "shellcheck"
|
rm "shellcheck"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" = 'osx' ];
|
for file in *.darwin-x86_64
|
||||||
then
|
do
|
||||||
brew install gnu-tar
|
base="${file%.*}"
|
||||||
for file in *.darwin-x86_64
|
cp "$file" "shellcheck"
|
||||||
do
|
tar -cJf "$base.darwin.x86_64.tar.xz" --transform="s:^:$base/:" README.txt LICENSE.txt shellcheck
|
||||||
base="${file%.*}"
|
rm "shellcheck"
|
||||||
cp "$file" "shellcheck"
|
done
|
||||||
gtar -cJf "$base.darwin.x86_64.tar.xz" --transform="s:^:$base/:" README.txt LICENSE.txt shellcheck
|
|
||||||
rm "shellcheck"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
for file in ./*
|
for file in ./*
|
||||||
do
|
do
|
||||||
|
|
23
.travis.yml
23
.travis.yml
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: sh
|
language: sh
|
||||||
|
@ -5,9 +6,18 @@ language: sh
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
os:
|
matrix:
|
||||||
- linux
|
include:
|
||||||
- osx
|
- os: linux
|
||||||
|
env: BUILD=linux
|
||||||
|
- os: linux
|
||||||
|
env: BUILD=windows
|
||||||
|
- os: linux
|
||||||
|
env: BUILD=armv6hf
|
||||||
|
- os: linux
|
||||||
|
env: BUILD=aarch64
|
||||||
|
- os: osx
|
||||||
|
env: BUILD=osx
|
||||||
|
|
||||||
before_install: |
|
before_install: |
|
||||||
DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
||||||
|
@ -18,11 +28,14 @@ before_install: |
|
||||||
echo "Tags are $TAGS"
|
echo "Tags are $TAGS"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./.compile_binaries
|
- mkdir -p deploy
|
||||||
|
- source ./.compile_binaries
|
||||||
|
- ./striptests
|
||||||
|
- set -x; build_"$BUILD"; set +x;
|
||||||
- ./.prepare_deploy
|
- ./.prepare_deploy
|
||||||
|
|
||||||
after_success: |
|
after_success: |
|
||||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
if [ "$BUILD" = "linux" ]; then
|
||||||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||||
for repo in $DOCKER_BUILDS; do
|
for repo in $DOCKER_BUILDS; do
|
||||||
for tag in $TAGS; do
|
for tag in $TAGS; do
|
||||||
|
|
Loading…
Reference in New Issue