diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-06-17 23:17:06 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-06-19 01:11:43 +0200 |
commit | 127840e0a237e332b1f4ab88eb63a28f810b9b6b (patch) | |
tree | cca556fb3ed9033782c8c32a8692ad43f8ef8485 | |
parent | 2e8e3d076647f8426d08cfacb283b43fa0e7ffb1 (diff) |
ci: Move stack resolver table to a file
-rw-r--r-- | .gitlab-ci.yml | 7 | ||||
-rw-r--r-- | cabal-helper.cabal | 1 | ||||
-rwxr-xr-x | scripts/ci/update-stack-resolvers.sh | 22 | ||||
-rw-r--r-- | tests/GhcSession.hs | 17 | ||||
-rw-r--r-- | tests/stack-resolvers | 14 |
5 files changed, 45 insertions, 16 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 21d1628..2b895d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,9 +32,8 @@ job-ghc7.10: script: "$CI_PROJECT_DIR/scripts/ci/build.sh" job-check-upd: - image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install2.4.1.0-stack2.1.1 + image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install2.4.1.0-stack2.1.0.1 stage: build script: - - cd "$CI_PROJECT_DIR"/scripts/ci - - ./update-stack-resolvers.sh | tee stack-resolvers.new - - git diff --exit-code -- stack-resolvers stack-resolvers.new + - "$CI_PROJECT_DIR"/scripts/ci/update-stack-resolvers.sh | tee tests/stack-resolvers.new + - git diff --exit-code -- tests/stack-resolvers tests/stack-resolvers.new diff --git a/cabal-helper.cabal b/cabal-helper.cabal index 03702e7..c065779 100644 --- a/cabal-helper.cabal +++ b/cabal-helper.cabal @@ -35,6 +35,7 @@ extra-source-files: README.md src/CabalHelper/Runtime/*.hs tests/*.hs + tests/stack-resolvers tests/exelib/*.hs tests/exelib/*.cabal diff --git a/scripts/ci/update-stack-resolvers.sh b/scripts/ci/update-stack-resolvers.sh new file mode 100755 index 0000000..d0dacd1 --- /dev/null +++ b/scripts/ci/update-stack-resolvers.sh @@ -0,0 +1,22 @@ +#!/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/fpco/lts-haskell/master/$res.yaml + + ghc=$(cat /tmp/stack-resolvers/$res.yaml \ + | grep ghc-version | awk '{ print $2 }' | tr -cd '0-9.') + + printf '%-10s %s\n' "$ghc" "$res" +done diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs index 91e30aa..b555f47 100644 --- a/tests/GhcSession.hs +++ b/tests/GhcSession.hs @@ -17,7 +17,6 @@ import qualified Control.Exception as E import Control.Monad import Control.Monad.IO.Class import Data.List -import Data.Tuple import Data.Version import Data.Bifunctor import qualified Data.Map as Map @@ -26,6 +25,7 @@ import System.Exit import System.FilePath ((</>), (<.>), makeRelative, takeDirectory) import System.Directory import System.IO +import System.IO.Unsafe (unsafePerformIO) import System.IO.Temp import Text.Printf (printf) -- import Text.Show.Pretty (pPrint) @@ -409,17 +409,10 @@ lookupStackResolver ghcVer = maybe (Left msg) Right $ msg = SkipReason $ "missing stack_resolver_table entry for "++ showVersion ghcVer -stack_resolver_table :: [(Version, String)] -stack_resolver_table = map (swap . second parseVer) - [ ("lts-13.5", "8.6.3") - , ("lts-12.26", "8.4.4") - , ("lts-12.14", "8.4.3") - , ("lts-11.22", "8.2.2") - , ("lts-9.21", "8.0.2") - , ("lts-7.24", "8.0.1") - , ("lts-6.35", "7.10.3") - , ("lts-3.22", "7.10.2") - ] +stack_resolver_table :: [(Version, String)] -- ^ (ghc version, stack resolver) +stack_resolver_table = unsafePerformIO $ + map (\(words -> [g, l]) -> (parseVer g, l)) . lines + <$> readFile "tests/stack-resolvers" copyStackYamls :: FilePath -> FilePath -> IO () copyStackYamls srcdir destdir = do diff --git a/tests/stack-resolvers b/tests/stack-resolvers new file mode 100644 index 0000000..7d70a27 --- /dev/null +++ b/tests/stack-resolvers @@ -0,0 +1,14 @@ +8.6.5 lts-13.23 +8.4.4 lts-12.26 +8.2.2 lts-11.22 +8.2.2 lts-10.10 +8.0.2 lts-9.21 +8.0.2 lts-8.24 +8.0.1 lts-7.24 +7.10.3 lts-6.35 +7.10.3 lts-5.18 +7.10.3 lts-4.2 +7.10.2 lts-3.22 +7.8.4 lts-2.22 +7.8.4 lts-1.15 +7.8.3 lts-0.7 |