diff --git a/.circleci/config.yml b/.circleci/config.yml index 9f24757..e90dffd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,12 +59,24 @@ jobs: executor: ubuntu steps: - checkout - - install_stack - - with_stack_cache: - install_deps: - - run: - name: Build linters - command: stack build hlint stylish-haskell + - run: + name: Install hlint + command: | + HLINT_ARCHIVE="hlint-${HLINT_VERSION}-x86_64-linux.tar.gz" + curl -sSLO "https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/${HLINT_ARCHIVE}" + mkdir -p ~/.local/bin/ + tar xzf "${HLINT_ARCHIVE}" -C ~/.local/bin/ --strip-components=1 "hlint-${HLINT_VERSION}/hlint" + environment: + HLINT_VERSION: 3.1.6 + - run: + name: Install stylish-haskell + command: | + STYLISH_ARCHIVE="stylish-haskell-v${STYLISH_VERSION}-linux-x86_64.tar.gz" + curl -sSLO "https://github.com/jaspervdj/stylish-haskell/releases/download/v${STYLISH_VERSION}/${STYLISH_ARCHIVE}" + mkdir -p ~/.local/bin/ + tar xzf "${STYLISH_ARCHIVE}" -C ~/.local/bin/ --strip-components=1 "stylish-haskell-v${STYLISH_VERSION}-linux-x86_64/stylish-haskell" + environment: + STYLISH_VERSION: 0.12.2.0 - run: name: Install Python command: sudo apt-get install -y python diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a75225d..1f30ef4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,9 +12,9 @@ repos: name: hlint language: system files: '\.hs$' - entry: stack exec -- hlint + entry: scripts/exec.sh hlint - id: stylish-haskell name: stylish-haskell language: system files: '\.hs$' - entry: stack exec -- stylish-haskell -i + entry: scripts/exec.sh stylish-haskell -i diff --git a/scripts/exec.sh b/scripts/exec.sh new file mode 100755 index 0000000..425d10b --- /dev/null +++ b/scripts/exec.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -eux -o pipefail + +if type stack &> /dev/null; then + export PATH="$(stack exec -- bash -c 'echo $PATH'):${PATH}" +fi + +exec "$@"