From 896005612c50fff0b409608900ee3e2c53c8ef95 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Thu, 14 Nov 2024 13:54:55 +0200 Subject: [PATCH] WIP --- fixtures/doctest-version.github | 4 ++-- fixtures/doctest.github | 4 ++-- src/HaskellCI/Config/History.hs | 4 ++-- src/HaskellCI/SetupMethod.hs | 39 +++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/HaskellCI/SetupMethod.hs diff --git a/fixtures/doctest-version.github b/fixtures/doctest-version.github index af753ce9..4e3bed88 100644 --- a/fixtures/doctest-version.github +++ b/fixtures/doctest-version.github @@ -417,7 +417,7 @@ jobs: - name: cache (tools) uses: actions/cache/restore@v4 with: - key: ${{ runner.os }}-${{ matrix.compiler }}-tools-af17a32a + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-58bfb495 path: ~/.haskell-ci-tools - name: install cabal-plan run: | @@ -436,7 +436,7 @@ jobs: if: always() uses: actions/cache/save@v4 with: - key: ${{ runner.os }}-${{ matrix.compiler }}-tools-af17a32a + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-58bfb495 path: ~/.haskell-ci-tools - name: checkout uses: actions/checkout@v4 diff --git a/fixtures/doctest.github b/fixtures/doctest.github index bde1dd81..274809d0 100644 --- a/fixtures/doctest.github +++ b/fixtures/doctest.github @@ -417,7 +417,7 @@ jobs: - name: cache (tools) uses: actions/cache/restore@v4 with: - key: ${{ runner.os }}-${{ matrix.compiler }}-tools-761cb1ae + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-ae4cd18b path: ~/.haskell-ci-tools - name: install cabal-plan run: | @@ -436,7 +436,7 @@ jobs: if: always() uses: actions/cache/save@v4 with: - key: ${{ runner.os }}-${{ matrix.compiler }}-tools-761cb1ae + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-ae4cd18b path: ~/.haskell-ci-tools - name: checkout uses: actions/checkout@v4 diff --git a/src/HaskellCI/Config/History.hs b/src/HaskellCI/Config/History.hs index fdbe1f64..e2e027b7 100644 --- a/src/HaskellCI/Config/History.hs +++ b/src/HaskellCI/Config/History.hs @@ -41,9 +41,9 @@ configHistory = , ver 0 19 2024114 := \cfg -> cfg & field @"cfgSetupMethods" .~ PerSetupMethod { hvrPpa = C.noVersion - , ghcup = invertVersionRange (C.withinVersion (C.mkVersion [9,8,3])) /\ C.earlierVersion (C.mkVersion [9,12,0]) + , ghcup = invertVersionRange (C.withinVersion (C.mkVersion [9,8,3])) /\ C.earlierVersion (C.mkVersion [9,12]) , ghcupVanilla = C.withinVersion (C.mkVersion [9,8,3]) - , ghcupPrerelease = C.orLaterVersion (C.mkVersion [9,12,0]) + , ghcupPrerelease = C.orLaterVersion (C.mkVersion [9,12]) } ] where diff --git a/src/HaskellCI/SetupMethod.hs b/src/HaskellCI/SetupMethod.hs new file mode 100644 index 00000000..e3c69fcf --- /dev/null +++ b/src/HaskellCI/SetupMethod.hs @@ -0,0 +1,39 @@ +{-# LANGUAGE OverloadedStrings #-} +module HaskellCI.SetupMethod where + +import HaskellCI.Prelude +import HaskellCI.YamlSyntax + +data SetupMethod + = HVRPPA + | GHCUP + | GHCUPvanilla + | GHCUPprerelease + deriving (Eq, Ord, Show, Enum, Bounded) + +instance ToYaml SetupMethod where + toYaml HVRPPA = "hvrppa" + toYaml GHCUP = "ghcup" + toYaml GHCUPvanilla = "ghcup-vanilla" + toYaml GHCUPprerelease = "ghcup-prerelease" + +data PerSetupMethod a = PerSetupMethod + { hvrPpa :: a + , ghcup :: a + , ghcupVanilla :: a + , ghcupPrerelease :: a + } + deriving (Show, Generic, Binary, Functor, Foldable, Traversable) + +instance Representable SetupMethod PerSetupMethod where + index f HVRPPA = hvrPpa f + index f GHCUP = ghcup f + index f GHCUPvanilla = ghcupVanilla f + index f GHCUPprerelease = ghcupPrerelease f + + tabulate f = PerSetupMethod + { hvrPpa = f HVRPPA + , ghcup = f GHCUP + , ghcupVanilla = f GHCUPvanilla + , ghcupPrerelease = f GHCUPprerelease + }