From ef163f7f4cf2bac10659c940894c785b57284a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Thu, 21 Mar 2024 16:11:33 +0100 Subject: [PATCH] Bump to lts-22.13 (ghc 9.6.4) --- .github/workflows/haskell-ci.yml | 98 +++++++++++++++++++++----------- fundeps.cabal | 4 +- src/FunDeps/Graphviz.hs | 4 +- src/FunDeps/Server.hs | 11 ++-- src/TUI/Commands.hs | 2 +- src/TUI/Settings/Editor.hs | 7 +-- stack.yaml | 2 +- stack.yaml.lock | 8 +-- 8 files changed, 83 insertions(+), 53 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 83d5fe0..63d30e2 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.11.20201230 +# version: 0.18.1 # -# REGENDATA ("0.11.20201230",["github","fundeps.cabal"]) +# REGENDATA ("0.18.1",["github","fundeps.cabal"]) # name: Haskell-CI on: @@ -18,46 +18,61 @@ on: - pull_request jobs: linux: - name: Haskell-CI Linux - GHC ${{ matrix.ghc }} - runs-on: ubuntu-18.04 + name: Haskell-CI - Linux - ${{ matrix.compiler }} + runs-on: ubuntu-20.04 + timeout-minutes: + 60 container: image: buildpack-deps:bionic continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - ghc: 8.10.3 + - compiler: ghc-9.6.4 + compilerKind: ghc + compilerVersion: 9.6.4 + setup-method: ghcup allow-failure: false fail-fast: false steps: - name: apt run: | apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common - apt-add-repository -y 'ppa:hvr/ghc' - apt-get update - apt-get install -y ghc-$GHC_VERSION cabal-install-3.2 + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: - GHC_VERSION: ${{ matrix.ghc }} + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: Set PATH and environment variables run: | echo "$HOME/.cabal/bin" >> $GITHUB_PATH - echo "LANG=C.UTF-8" >> $GITHUB_ENV - echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV - echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV - HC=/opt/ghc/$GHC_VERSION/bin/ghc - echo "HC=$HC" >> $GITHUB_ENV - echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV - echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV - echo "CABAL=/opt/cabal/3.2/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" + HCDIR=/opt/$HCKIND/$HCVER + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') - echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV - echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV - echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV - echo "ARG_COMPILER=--ghc --with-compiler=/opt/ghc/$GHC_VERSION/bin/ghc" >> $GITHUB_ENV - echo "GHCJSARITH=0" >> $GITHUB_ENV + echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" + echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" + echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: - GHC_VERSION: ${{ matrix.ghc }} + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: env run: | env @@ -80,6 +95,10 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + cat >> $CABAL_CONFIG < cabal-plan.xz - echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz + echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan rm -f cabal-plan.xz chmod a+x $HOME/.cabal/bin/cabal-plan cabal-plan --version - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: source + - name: initial cabal.project for sdist + run: | + touch cabal.project + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project + cat cabal.project - name: sdist run: | mkdir -p sdist - cd source || false $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist - name: unpack run: | @@ -114,7 +137,8 @@ jobs: - name: generate cabal.project run: | PKGDIR_fundeps="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/fundeps-[0-9.]*')" - echo "PKGDIR_fundeps=${PKGDIR_fundeps}" >> $GITHUB_ENV + echo "PKGDIR_fundeps=${PKGDIR_fundeps}" >> "$GITHUB_ENV" + rm -f cabal.project cabal.project.local touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_fundeps}" >> cabal.project @@ -129,12 +153,12 @@ jobs: run: | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - - name: cache - uses: actions/cache@v2 + - name: restore cache + uses: actions/cache/restore@v3 with: - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store - restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- - name: install dependencies run: | $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all @@ -154,8 +178,14 @@ jobs: ${CABAL} -vnormal check - name: haddock run: | - $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all - name: unconstrained build run: | rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: save cache + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store diff --git a/fundeps.cabal b/fundeps.cabal index 8f80837..385b22c 100644 --- a/fundeps.cabal +++ b/fundeps.cabal @@ -17,7 +17,7 @@ description: category: Web build-type: Simple extra-source-files: README.md -tested-with: GHC ==9.2.8 +tested-with: GHC ==9.6.4 source-repository head type: git @@ -87,6 +87,7 @@ library , turtle , vector , vty + , vty-unix , wai , warp @@ -117,4 +118,3 @@ test-suite fundeps-test , fundeps , graphviz , hspec - , hspec-expectations diff --git a/src/FunDeps/Graphviz.hs b/src/FunDeps/Graphviz.hs index 2e26551..1e92281 100644 --- a/src/FunDeps/Graphviz.hs +++ b/src/FunDeps/Graphviz.hs @@ -30,7 +30,7 @@ import Data.Monoid (Endo (..)) import Data.Text.Lazy qualified as LText import Settings (DependencyMode (..), Settings (..)) import TUI.Ansi (cliWarn) -import Turtle (FilePath, d, encodeString, fp, printf, (%)) +import Turtle (FilePath, d, fp, printf, (%)) import Prelude hiding (FilePath) @@ -48,7 +48,7 @@ executeGraphAction gvCommand graph action = case action of gvCommand graph gvOutput - (Turtle.encodeString file) + file -- TODO rename this as it's not always doing DFS diff --git a/src/FunDeps/Server.hs b/src/FunDeps/Server.hs index 9913a3e..2feb2b5 100644 --- a/src/FunDeps/Server.hs +++ b/src/FunDeps/Server.hs @@ -8,6 +8,7 @@ {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeOperators #-} + #ifdef WithJS {-# LANGUAGE TemplateHaskell #-} #endif @@ -38,7 +39,7 @@ import Servant.HTML.Lucid (HTML) import Servant.Server (Handler, Server, serve) import Servant.Server.StaticFiles (serveDirectoryWebApp) import Settings (Settings) -import Turtle (encodeString, fp, (%), (<.>), ()) +import Turtle (fp, (%), (<.>), ()) import Turtle qualified @@ -80,8 +81,8 @@ data RenderGraphRequest = RenderGraphRequest instance FromJSON RenderGraphRequest where parseJSON = withObject "RenderGraphRequest" $ \o -> RenderGraphRequest - <$> o .: "settings" - <*> o .: "nodes" + <$> (o .: "settings") + <*> (o .: "nodes") type DeclMap = Map PackageName (Map ModuleName (Map FunctionName G.Node)) @@ -120,7 +121,7 @@ funDepsHandlers port depGraph = :<|> elmApp :<|> pure decls :<|> renderGraphHandler depGraph - :<|> serveDirectoryWebApp (encodeString imageDir) + :<|> serveDirectoryWebApp imageDir where decls = toAllDecls $ declToNode depGraph @@ -128,7 +129,7 @@ funDepsHandlers port depGraph = renderGraphHandler :: DepGraph -> RenderGraphRequest -> Handler Text renderGraphHandler depGraph RenderGraphRequest{rgrSettings, rgrNodes} = do utcTime <- Turtle.date - let graphFileName = (Turtle.decodeString . intercalate "_" . take 2 . words $ show utcTime) <.> "svg" + let graphFileName = (intercalate "_" . take 2 . words $ show utcTime) <.> "svg" graphAction = GV.ExportToFile (imageDir graphFileName) Graphviz.Svg liftIO $ GV.showDfsSubgraph graphAction depGraph rgrSettings rgrNodes pure $ Turtle.format ("static/" % fp) graphFileName diff --git a/src/TUI/Commands.hs b/src/TUI/Commands.hs index a3589fb..98906cd 100644 --- a/src/TUI/Commands.hs +++ b/src/TUI/Commands.hs @@ -92,7 +92,7 @@ exportCommand = do exportFile :: Parser FilePath -exportFile = Turtle.decodeString <$> P.many1 (P.satisfy (not . isSpace)) <* P.spaces +exportFile = P.many1 (P.satisfy (not . isSpace)) <* P.spaces queryItems :: Parser [QueryItem] diff --git a/src/TUI/Settings/Editor.hs b/src/TUI/Settings/Editor.hs index 9bd2c54..2a46ab4 100644 --- a/src/TUI/Settings/Editor.hs +++ b/src/TUI/Settings/Editor.hs @@ -42,15 +42,14 @@ import Brick.Util (on) import Brick.Widgets.Border (border, borderWithLabel) import Brick.Widgets.Center (center) import Brick.Widgets.Edit (editAttr, editFocusedAttr) -import Data.Declaration - ( NodeFormat (Function, ModuleFunction, PackageModuleFunction) - ) +import Data.Declaration (NodeFormat (Function, ModuleFunction, PackageModuleFunction)) import Data.GraphViz.Attributes.Complete (RankDir (..)) import Data.GraphViz.Commands (GraphvizCommand (Circo, Dot, Neato, TwoPi)) import Data.Text (Text) import Data.Void (Void) import Graphics.Vty qualified as V import Graphics.Vty.Attributes (black, blue, defAttr, red, white, yellow) +import Graphics.Vty.Platform.Unix qualified as V import Lens.Micro (Lens') import Settings (Settings) import Settings qualified as S @@ -182,7 +181,7 @@ handleEvent event = case event of editSettings :: Settings -> IO Settings editSettings settings = do let buildVty = do - v <- V.mkVty =<< V.standardIOConfig + v <- V.mkVty V.defaultConfig V.setMode (V.outputIface v) V.Mouse True return v form0 = mkForm settings diff --git a/stack.yaml b/stack.yaml index 696136d..5a24066 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,3 +1,3 @@ -resolver: lts-20.26 +resolver: lts-22.13 packages: - . diff --git a/stack.yaml.lock b/stack.yaml.lock index ea5a850..fcf6d2a 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -6,7 +6,7 @@ packages: [] snapshots: - completed: - sha256: 5a59b2a405b3aba3c00188453be172b85893cab8ebc352b1ef58b0eae5d248a2 - size: 650475 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/26.yaml - original: lts-20.26 + sha256: 6f0bea3ba5b07360f25bc886e8cff8d847767557a492a6f7f6dcb06e3cc79ee9 + size: 712905 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/13.yaml + original: lts-22.13