Skip to content

Commit 3256442

Browse files
committed
install ghc
1 parent 3f84112 commit 3256442

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,17 @@ jobs:
8989
- name: Install cabal-install
9090
run: |
9191
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
92-
- name: TODO
92+
- name: Install GHC (hvr-ppa)
93+
if: matrix.setup-method == 'hvr-ppa'
94+
run: |
95+
echo true
96+
env:
97+
HCKIND: ${{ matrix.compilerKind }}
98+
HCNAME: ${{ matrix.compiler }}
99+
HCVER: ${{ matrix.compilerVersion }}
100+
- name: Install GHC (GHCup)
101+
if: matrix.setup-method == 'ghcup'
93102
run: |
94-
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml;
95103
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
96104
env:
97105
HCKIND: ${{ matrix.compilerKind }}

src/HaskellCI/GitHub.hs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
145145
| GHC (C.mkVersion [8,4,4]) `elem` allVersions
146146
, GHC (C.mkVersion [8,4,4]) & isGHCUP
147147
]
148+
148149
sh $ "apt-get install -y --no-install-recommends " ++ unwords corePkgs
149150

151+
-- additional packages
152+
unless (null cfgApt) $ sh $ "apt-get install -y " ++ unwords (S.toList cfgApt)
153+
150154
githubRun "Install GHCup" $ do
151155
let ghcupVer = C.prettyShow cfgGhcupVersion
152156
sh $ "mkdir -p \"$HOME/.ghcup/bin\""
@@ -156,14 +160,11 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
156160
githubRun "Install cabal-install" $ do
157161
sh $ "\"$HOME/.ghcup/bin/ghcup\" install cabal " ++ cabalFullVer ++ " || (cat \"$HOME\"/.ghcup/logs/*.* && false)"
158162

159-
-- TODO: Install cabal-install
160-
-- TODO: Install GHC
161-
githubRun' "TODO" envEnv $ do
162-
let installGhcup :: ShM ()
163-
installGhcup = do
164-
-- if any job uses prereleases, add release channel unconditionally. (HEADHACKAGE variable is set later)
165-
when (anyJobUsesPreviewGHC || previewCabal cfgCabalInstallVersion) $
166-
sh "\"$HOME/.ghcup/bin/ghcup\" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml;"
163+
164+
-- todo: when any job uses hvr-ppa
165+
githubRunIf' "Install GHC (hvr-ppa)" "matrix.setup-method == 'hvr-ppa'" envEnv $ do
166+
sh $ "echo true"
167+
{-
167168
168169
hvrppa <- runSh $ do
169170
sh "apt-add-repository -y 'ppa:hvr/ghc'"
@@ -180,17 +181,17 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
180181
then if_then_else RangeGHCJS ghcjsInstall baseInstall
181182
else sh baseInstall
182183
183-
installGhcup
184+
-}
184185

185-
ghcup <- runSh $ do
186-
installGhcup
186+
-- todo: when any job uses ghcup
187+
githubRunIf' "Install GHC (GHCup)" "matrix.setup-method == 'ghcup'" envEnv $ do
188+
-- when (anyJobUsesPreviewGHC || previewCabal cfgCabalInstallVersion) $
189+
-- sh "\"$HOME/.ghcup/bin/ghcup\" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml;"
187190

188-
sh $ "\"$HOME/.ghcup/bin/ghcup\" install ghc \"$HCVER\" || (cat \"$HOME\"/.ghcup/logs/*.* && false)"
189-
unless (null cfgApt) $ do
190-
sh "apt-get update"
191-
sh $ "apt-get install -y " ++ unwords (S.toList cfgApt)
191+
sh $ "\"$HOME/.ghcup/bin/ghcup\" install ghc \"$HCVER\" || (cat \"$HOME\"/.ghcup/logs/*.* && false)"
192192

193-
setup hvrppa ghcup
193+
-- TODO: "GHCup vanilla"
194+
-- TODO: "GHCup prerelease"
194195

195196
githubRun' "Set PATH and environment variables" envEnv $ do
196197
echo_to "$GITHUB_PATH" "$HOME/.cabal/bin"
@@ -660,10 +661,10 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
660661
githubRun :: String -> ShM () -> ListBuilder (Either HsCiError GitHubStep) ()
661662
githubRun name = githubRun' name mempty
662663

663-
githubRunIf :: String -> String -> ShM () -> ListBuilder (Either HsCiError GitHubStep) ()
664-
githubRunIf name if_ action = undefined name if_ action
665-
666-
_unused = githubRunIf -- TODO
664+
githubRunIf' :: String -> String -> Map.Map String String -> ShM () -> ListBuilder (Either HsCiError GitHubStep) ()
665+
githubRunIf' name if_ env shm = item $ do
666+
shs <- runSh shm
667+
return $ GitHubStep name (Just if_) $ Left $ GitHubRun shs env
667668

668669
githubUses :: String -> String -> [(String, String)] -> ListBuilder (Either HsCiError GitHubStep) ()
669670
githubUses name action with = item $ return $

0 commit comments

Comments
 (0)