Merge branch 'master' of https://github.com/Luizm/shellcheck into Luizm-master
This commit is contained in:
commit
f4deac6e43
|
@ -0,0 +1,78 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# This script compile shellcheck binaries
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# Remove all tests to reduce binary size
|
||||||
|
./striptests
|
||||||
|
|
||||||
|
mkdir -p deploy
|
||||||
|
|
||||||
|
_cleanup(){
|
||||||
|
rm -rf dist shellcheck || true
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$TRAVIS_OS_NAME" = 'linux' ]
|
||||||
|
then
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Linux Alpine based Docker image
|
||||||
|
name="$DOCKER_BASE-alpine"
|
||||||
|
DOCKER_BUILDS="$DOCKER_BUILDS $name"
|
||||||
|
sed -e '/DELETE-MARKER/,$d' Dockerfile > Dockerfile.alpine
|
||||||
|
docker build -f Dockerfile.alpine -t "$name:current" .
|
||||||
|
docker run "$name:current" sh -c 'shellcheck --version'
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
_cleanup
|
||||||
|
|
||||||
|
# Windows .exe
|
||||||
|
docker run --user="$UID" -v "$PWD:/appdata" koalaman/winghc cuib
|
||||||
|
for tag in $TAGS
|
||||||
|
do
|
||||||
|
cp "dist/build/ShellCheck/shellcheck.exe" "deploy/shellcheck-$tag.exe";
|
||||||
|
done
|
||||||
|
_cleanup
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$TRAVIS_OS_NAME" = 'osx' ];
|
||||||
|
then
|
||||||
|
# Darwin x86_64 static executable
|
||||||
|
sudo ln -s /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
|
||||||
|
brew install cabal-install pandoc
|
||||||
|
cabal update
|
||||||
|
cabal new-build shellcheck
|
||||||
|
for tag in $TAGS
|
||||||
|
do
|
||||||
|
cp "$HOME/.cabal/dist/build/shellcheck/shellcheck" "deploy/shellcheck-$tag.darwin-x86_64";
|
||||||
|
done
|
||||||
|
_cleanup
|
||||||
|
fi
|
|
@ -51,8 +51,19 @@ do
|
||||||
rm "shellcheck"
|
rm "shellcheck"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$TRAVIS_OS_NAME" = 'osx' ];
|
||||||
|
then
|
||||||
|
brew install gnu-tar
|
||||||
|
for file in *.darwin-x86_64
|
||||||
|
do
|
||||||
|
base="${file%.*}"
|
||||||
|
cp "$file" "shellcheck"
|
||||||
|
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
|
||||||
sha512sum "$file" > "$file.sha512sum"
|
sha512sum "$file" > "$file.sha512sum"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
83
.travis.yml
83
.travis.yml
|
@ -5,74 +5,41 @@ language: sh
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
before_install:
|
os:
|
||||||
- DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
- linux
|
||||||
- DOCKER_BUILDS=""
|
- osx
|
||||||
- TAGS=""
|
|
||||||
- test "$TRAVIS_BRANCH" = master && TAGS="$TAGS latest" || true
|
before_install: |
|
||||||
- test -n "$TRAVIS_TAG" && TAGS="$TAGS stable $TRAVIS_TAG" || true
|
DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
||||||
- echo "Tags are $TAGS"
|
DOCKER_BUILDS=""
|
||||||
|
TAGS=""
|
||||||
|
tes
|
||||||
|
t "$TRAVIS_BRANCH" = master && TAGS="$TAGS latest" || true
|
||||||
|
test -n "$TRAVIS_TAG" && TAGS="$TAGS stable $TRAVIS_TAG" || true
|
||||||
|
echo "Tags are $TAGS"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- mkdir deploy
|
- ./.compile_binaries
|
||||||
# Remove all tests to reduce binary size
|
|
||||||
- ./striptests
|
|
||||||
# Start fetching the aarch64 image since it's a multi-GB beast
|
|
||||||
- docker pull koalaman/aarch64-builder >> aarch64pull.log 2>&1 &
|
|
||||||
# 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
|
|
||||||
# Linux Alpine based Docker image
|
|
||||||
- name="$DOCKER_BASE-alpine"
|
|
||||||
- DOCKER_BUILDS="$DOCKER_BUILDS $name"
|
|
||||||
- sed -e '/DELETE-MARKER/,$d' Dockerfile > Dockerfile.alpine
|
|
||||||
- docker build -f Dockerfile.alpine -t "$name:current" .
|
|
||||||
- docker run "$name:current" sh -c 'shellcheck --version'
|
|
||||||
# Linux aarch64 static executable
|
|
||||||
- wait
|
|
||||||
- docker run -v "$PWD:/mnt" koalaman/aarch64-builder 'buildsc'
|
|
||||||
- for tag in $TAGS; do cp "shellcheck" "deploy/shellcheck-$tag.linux-aarch64"; done
|
|
||||||
- rm -f shellcheck || true
|
|
||||||
# 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
|
|
||||||
- rm -f shellcheck || true
|
|
||||||
# Windows .exe
|
|
||||||
- docker run --user="$UID" -v "$PWD:/appdata" koalaman/winghc cuib
|
|
||||||
- for tag in $TAGS; do cp "dist/build/ShellCheck/shellcheck.exe" "deploy/shellcheck-$tag.exe"; done
|
|
||||||
- rm -rf dist shellcheck || true
|
|
||||||
# Misc packaging
|
|
||||||
- ./.prepare_deploy
|
- ./.prepare_deploy
|
||||||
|
|
||||||
after_success:
|
after_success: |
|
||||||
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||||
- for repo in $DOCKER_BUILDS;
|
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||||
do
|
for repo in $DOCKER_BUILDS; do
|
||||||
for tag in $TAGS;
|
for tag in $TAGS; do
|
||||||
do
|
|
||||||
echo "Deploying $repo:current as $repo:$tag...";
|
echo "Deploying $repo:current as $repo:$tag...";
|
||||||
docker tag "$repo:current" "$repo:$tag" || exit 1;
|
docker tag "$repo:current" "$repo:$tag" || exit 1;
|
||||||
docker push "$repo:$tag" || exit 1;
|
docker push "$repo:$tag" || exit 1;
|
||||||
done;
|
done;
|
||||||
done;
|
done;
|
||||||
|
fi
|
||||||
|
|
||||||
after_failure:
|
after_failure: |
|
||||||
- id
|
id
|
||||||
- pwd
|
pwd
|
||||||
- df -h
|
df -h
|
||||||
- find . -name '*.log' -type f -exec grep "" /dev/null {} +
|
find . -name '*.log' -type f -exec grep "" /dev/null {} +
|
||||||
- find . -ls
|
find . -ls
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: gcs
|
provider: gcs
|
||||||
|
|
|
@ -257,9 +257,7 @@ ShellCheck is built and packaged using Cabal. Install the package `cabal-install
|
||||||
|
|
||||||
On MacOS (OS X), you can do a fast install of Cabal using brew, which takes a couple of minutes instead of more than 30 minutes if you try to compile it from source.
|
On MacOS (OS X), you can do a fast install of Cabal using brew, which takes a couple of minutes instead of more than 30 minutes if you try to compile it from source.
|
||||||
|
|
||||||
brew install cask
|
$ brew install cabal-install
|
||||||
brew cask install haskell-for-mac
|
|
||||||
cabal install cabal-install
|
|
||||||
|
|
||||||
On MacPorts, the package is instead called `hs-cabal-install`, while native Windows users should install the latest version of the Haskell platform from <https://www.haskell.org/platform/>
|
On MacPorts, the package is instead called `hs-cabal-install`, while native Windows users should install the latest version of the Haskell platform from <https://www.haskell.org/platform/>
|
||||||
|
|
||||||
|
@ -512,3 +510,4 @@ Happy ShellChecking!
|
||||||
|
|
||||||
* The wiki has [long form descriptions](https://github.com/koalaman/shellcheck/wiki/Checks) for each warning, e.g. [SC2221](https://github.com/koalaman/shellcheck/wiki/SC2221).
|
* The wiki has [long form descriptions](https://github.com/koalaman/shellcheck/wiki/Checks) for each warning, e.g. [SC2221](https://github.com/koalaman/shellcheck/wiki/SC2221).
|
||||||
* ShellCheck does not attempt to enforce any kind of formatting or indenting style, so also check out [shfmt](https://github.com/mvdan/sh)!
|
* ShellCheck does not attempt to enforce any kind of formatting or indenting style, so also check out [shfmt](https://github.com/mvdan/sh)!
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue