mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-03-12 12:35:25 -07:00
* Adds a shell script with functions to install multi-architecture docker support, as well as build, deploy, and test the shellcheck docker images for the same set of architectures for which binaries were already built and deployed as tarballs. * Hooks up the multi-architecture docker build, deploy, and test to the existing Travis CI/CD pipeline. It is organized as a separate stage which only runs if all previous steps in the already existing test stage succeed.
74 lines
1.7 KiB
Bash
Executable File
74 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
build_linux() {
|
|
# Linux Docker image
|
|
name="$DOCKER_BASE"
|
|
DOCKER_BUILDS="$DOCKER_BUILDS $name"
|
|
docker build -t "$name:current" .
|
|
docker run "$name:current" --version
|
|
printf '%s\n' "#!/bin/sh" "echo 'hello world'" > myscript
|
|
docker run -v "$PWD:/mnt" "$name:current" myscript
|
|
|
|
# Copy static executable from docker image
|
|
id=$(docker create "$name:current")
|
|
docker cp "$id:/bin/shellcheck" "shellcheck"
|
|
docker rm "$id"
|
|
ls -l shellcheck
|
|
./shellcheck myscript
|
|
for tag in $TAGS
|
|
do
|
|
cp "shellcheck" "deploy/shellcheck-$tag.linux-x86_64";
|
|
done
|
|
}
|
|
|
|
build_aarch64() {
|
|
# Linux aarch64 static executable
|
|
docker run -v "$PWD:/mnt" koalaman/aarch64-builder 'buildsc'
|
|
for tag in $TAGS
|
|
do
|
|
cp "shellcheck" "deploy/shellcheck-$tag.linux-aarch64"
|
|
done
|
|
}
|
|
|
|
|
|
build_armv6hf() {
|
|
# Linux armv6hf static executable
|
|
docker run -v "$PWD:/mnt" koalaman/armv6hf-builder -c 'compile-shellcheck'
|
|
for tag in $TAGS
|
|
do
|
|
cp "shellcheck" "deploy/shellcheck-$tag.linux-armv6hf";
|
|
done
|
|
}
|
|
|
|
build_windows() {
|
|
# Windows .exe
|
|
docker run -v "$PWD:/appdata" koalaman/winghc cuib
|
|
for tag in $TAGS
|
|
do
|
|
cp "dist/build/ShellCheck/shellcheck.exe" "deploy/shellcheck-$tag.exe";
|
|
done
|
|
}
|
|
|
|
build_osx() {
|
|
# Darwin x86_64 executable
|
|
brew update
|
|
brew install cabal-install pandoc gnu-tar
|
|
sudo ln -sf /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
|
|
sudo ln -sf /usr/local/bin/gtar /usr/local/bin/tar
|
|
export PATH="/usr/local/bin:$PATH"
|
|
|
|
cabal update
|
|
cabal install --dependencies-only
|
|
cabal build shellcheck
|
|
|
|
# Cabal 3 no longer has a predictable output path
|
|
path="$(find . -name 'shellcheck' -type f -perm +111)"
|
|
[[ -e "$path" ]]
|
|
|
|
for tag in $TAGS
|
|
do
|
|
cp "$path" "deploy/shellcheck-$tag.darwin-x86_64";
|
|
done
|
|
}
|
|
|