summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVidar Holen <spam@vidarholen.net>2019-07-24 21:16:14 -0700
committerVidar Holen <spam@vidarholen.net>2019-07-24 21:20:27 -0700
commit0eaef95db85a0a47733c52e677eab8576d98adaa (patch)
tree8db51521255ea893a18b418ac29a15dcf4002d97
parent49aa600c85bf4f03464a4cd149a77725151d58c1 (diff)
THIS COMMIT WILL BE FORCE PUSHED AWAY (Help I'm not good with computers)
-rwxr-xr-x.compile_binaries78
-rwxr-xr-x.prepare_deploy13
-rw-r--r--.travis.yml82
-rw-r--r--README.md5
4 files changed, 116 insertions, 62 deletions
diff --git a/.compile_binaries b/.compile_binaries
new file mode 100755
index 0000000..8fa645c
--- /dev/null
+++ b/.compile_binaries
@@ -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
diff --git a/.prepare_deploy b/.prepare_deploy
index fd11fb1..030c3fa 100755
--- a/.prepare_deploy
+++ b/.prepare_deploy
@@ -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
-
diff --git a/.travis.yml b/.travis.yml
index e921a5f..25ebbeb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,74 +5,40 @@ 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=""
+ test "$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
diff --git a/README.md b/README.md
index 3baca68..4c9e9ae 100644
--- a/README.md
+++ b/README.md
@@ -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)!
+