diff --git a/test/distrotest b/test/distrotest index 0465c3a..5024054 100755 --- a/test/distrotest +++ b/test/distrotest @@ -16,10 +16,14 @@ and is still highly experimental. Make sure you're plugged in and have screen/tmux in place, then re-run with $0 --run to continue. + +Also note that 'dist' will be deleted. EOF exit 0 } +echo "Deleting 'dist'..." +rm -rf dist log=$(mktemp) || die "Can't create temp file" date >> "$log" || die "Can't write to log" @@ -63,7 +67,8 @@ opensuse:latest zypper install -y cabal-install ghc ubuntu:18.04 apt-get update && apt-get install -y cabal-install ubuntu:17.10 apt-get update && apt-get install -y cabal-install -# Misc +# Misc Haskell including current and latest Stack build +ubuntu:18.10 set -e; apt-get update && apt-get install -y curl && curl -sSL https://get.haskellstack.org/ | sh -s - -f && cd /mnt && exec test/stacktest haskell:latest true # Known to currently fail diff --git a/test/stacktest b/test/stacktest new file mode 100755 index 0000000..dc0113f --- /dev/null +++ b/test/stacktest @@ -0,0 +1,27 @@ +#!/bin/bash +# This script builds ShellCheck through `stack` using +# various resolvers. It's run via distrotest. + +resolvers=( + nightly-"$(date -d "3 days ago" +"%Y-%m-%d")" +) + +die() { echo "$*" >&2; exit 1; } + +[ -e "ShellCheck.cabal" ] || + die "ShellCheck.cabal not in current dir" +[ -e "stack.yaml" ] || + die "stack.yaml not in current dir" +command -v stack || + die "stack is missing" + +stack setup || die "Failed to setup with default resolver" +stack build --test || die "Failed to build/test with default resolver" + +for resolver in "${resolvers[@]}" +do + stack --resolver="$resolver" setup || die "Failed to setup $resolver" + stack --resolver="$resolver" build --test || die "Failed build/test with $resolver!" +done + +echo "Success"