Skip to content

Commit

Permalink
Add shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomorain committed Aug 3, 2018
1 parent 2163fdf commit 90b63c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,23 @@ jobs:
- save_cache:
key: v2-goreleaser-{{ checksum "~/goreleaser_amd64.deb" }}
paths: [~/goreleaser_amd64.deb]
shellcheck:
docker:
- image: nlknguyen/alpine-shellcheck:v0.4.6
steps:
- checkout
- run:
name: Check Scripts
command: |
find . -type f -name '*.sh' -not -path './vendor/*' > /tmp/files.txt
echo "Checking $(cat /tmp/files.txt | wc -l ) files"
cat /tmp/files.txt | xargs -t shellcheck --external-sources
workflows:
version: 2
ci:
jobs:
- shellcheck
- test
- coverage
- lint
Expand All @@ -86,6 +98,7 @@ workflows:
- test
- coverage
- lint
- shellcheck
filters:
branches:
only: master
9 changes: 4 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ set -o nounset
set -o pipefail

RELEASE_URL="https://api.github.com/repos/CircleCI-Public/circleci-cli/releases/latest"
CURL_OPTS="--retry 3 --fail --location"
DEST="/usr/local/bin/circleci"

# Run the script in a temporary directory that we know is empty.
SCRATCH=$(mktemp -d)
cd $SCRATCH
cd "$SCRATCH"

function finish {
# Delete the working directory when the install was successful.
rm -r $SCRATCH
rm -r "$SCRATCH"
}

function error {
Expand All @@ -25,15 +24,15 @@ trap finish EXIT
trap error ERR

echo "Finding latest release."
curl $CURL_OPTS --silent --output release.json "$RELEASE_URL"
curl --retry 3 --fail --location --silent --output release.json "$RELEASE_URL"

STRIP_JSON_STRING='s/.*"([^"]+)".*/\1/'

echo -n 'Downloading CircleCI '
grep tag_name release.json | sed -E "$STRIP_JSON_STRING"

grep browser_download_url release.json | sed -E "$STRIP_JSON_STRING" > tarball_urls.txt
grep -i `uname` tarball_urls.txt | xargs curl $CURL_OPTS --output circleci.tgz
grep -i "$(uname)" tarball_urls.txt | xargs curl --retry 3 --fail --location --output circleci.tgz

tar zxvf circleci.tgz --strip 1

Expand Down

0 comments on commit 90b63c0

Please sign in to comment.