Merge branch 'Luizm-master'
This commit is contained in:
commit
fbb571811f
|
@ -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"
|
||||
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 ./*
|
||||
do
|
||||
sha512sum "$file" > "$file.sha512sum"
|
||||
done
|
||||
|
||||
|
|
83
.travis.yml
83
.travis.yml
|
@ -5,74 +5,41 @@ language: sh
|
|||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
||||
- DOCKER_BUILDS=""
|
||||
- TAGS=""
|
||||
- test "$TRAVIS_BRANCH" = master && TAGS="$TAGS latest" || true
|
||||
- test -n "$TRAVIS_TAG" && TAGS="$TAGS stable $TRAVIS_TAG" || true
|
||||
- echo "Tags are $TAGS"
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
before_install: |
|
||||
DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
||||
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:
|
||||
- mkdir deploy
|
||||
# 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
|
||||
- ./.compile_binaries
|
||||
- ./.prepare_deploy
|
||||
|
||||
after_success:
|
||||
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||
- for repo in $DOCKER_BUILDS;
|
||||
do
|
||||
for tag in $TAGS;
|
||||
do
|
||||
after_success: |
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||
for repo in $DOCKER_BUILDS; do
|
||||
for tag in $TAGS; do
|
||||
echo "Deploying $repo:current as $repo:$tag...";
|
||||
docker tag "$repo:current" "$repo:$tag" || exit 1;
|
||||
docker push "$repo:$tag" || exit 1;
|
||||
done;
|
||||
done;
|
||||
fi
|
||||
|
||||
after_failure:
|
||||
- id
|
||||
- pwd
|
||||
- df -h
|
||||
- find . -name '*.log' -type f -exec grep "" /dev/null {} +
|
||||
- find . -ls
|
||||
after_failure: |
|
||||
id
|
||||
pwd
|
||||
df -h
|
||||
find . -name '*.log' -type f -exec grep "" /dev/null {} +
|
||||
find . -ls
|
||||
|
||||
deploy:
|
||||
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.
|
||||
|
||||
brew install cask
|
||||
brew cask install haskell-for-mac
|
||||
cabal install cabal-install
|
||||
$ brew 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/>
|
||||
|
||||
|
@ -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).
|
||||
* 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