aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci/update-stack-resolvers.sh
blob: 4a20c14ee4905113c3186fe8e4a0c5382d935130 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# Example:
#     $ scripts/ci/update-stack-resolvers.sh | tee tests/stack-resolvers

mkdir -p /tmp/stack-resolvers/

wget -q https://s3.amazonaws.com/haddock.stackage.org/snapshots.json \
     -O /tmp/stack-resolvers/snapshots.json

resolvers=$(cat /tmp/stack-resolvers/snapshots.json \
                    | jq -r '.[]' | grep ^lts- | sort -V -r | uniq)

for res in $resolvers; do
        wget -q --continue \
             -O /tmp/stack-resolvers/$res.yaml \
             https://raw.githubusercontent.com/commercialhaskell/lts-haskell/master/$res.yaml

        ghc=$(cat /tmp/stack-resolvers/$res.yaml \
                      | grep ghc-version | awk '{ print $2 }' | tr -cd '0-9.')

        [ -z "$ghc" ] && continue
        printf '%-10s %s\n' "$ghc" "$res"
done