Skip to content

Commit 5faa232

Browse files
committed
Resolve #665: ghc-head works with GHA
1 parent 210d305 commit 5faa232

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed

.github/workflows/haskell-ci.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ jobs:
7070
compilerVersion: 8.2.2
7171
setup-method: ghcup
7272
allow-failure: false
73+
- compiler: ghc-head
74+
compilerKind: ghc
75+
compilerVersion: latest-nightly
76+
setup-method: ghcup
77+
allow-failure: true
7378
fail-fast: false
7479
steps:
7580
- name: apt
@@ -79,6 +84,8 @@ jobs:
7984
mkdir -p "$HOME/.ghcup/bin"
8085
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
8186
chmod a+x "$HOME/.ghcup/bin/ghcup"
87+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
88+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml;
8289
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
8390
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
8491
env:
@@ -103,7 +110,7 @@ jobs:
103110
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
104111
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
105112
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
106-
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
113+
if [ $((HCNUMVER > 90405)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
107114
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
108115
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
109116
env:
@@ -132,6 +139,18 @@ jobs:
132139
repository hackage.haskell.org
133140
url: http://hackage.haskell.org/
134141
EOF
142+
if $HEADHACKAGE; then
143+
cat >> $CABAL_CONFIG <<EOF
144+
repository head.hackage.ghc.haskell.org
145+
url: https://ghc.gitlab.haskell.org/head.hackage/
146+
secure: True
147+
root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
148+
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
149+
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
150+
key-threshold: 3
151+
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override
152+
EOF
153+
fi
135154
cat >> $CABAL_CONFIG <<EOF
136155
jobs: 2
137156
EOF
@@ -227,6 +246,9 @@ jobs:
227246
package bytestring
228247
tests: False
229248
EOF
249+
if $HEADHACKAGE; then
250+
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
251+
fi
230252
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(Cabal|Cabal-syntax|cabal-install-parsers|haskell-ci|parsec)$/; }' >> cabal.project.local
231253
cat cabal.project
232254
cat cabal.project.local

cabal.haskell-ci

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs: 2:2
1515
-- linux-jobs: >=8.10
1616

1717
-- Add GHC head job
18-
ghc-head: False
18+
-- https://www.haskell.org/ghcup/guide/#nightlies
19+
ghc-head: True
1920

2021
-- travis Caching
2122
-- cache: True

fixtures/empty-line.github

+7
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ jobs:
183183
compilerVersion: 7.8.1
184184
setup-method: hvr-ppa
185185
allow-failure: false
186+
- compiler: ghc-head
187+
compilerKind: ghc
188+
compilerVersion: latest-nightly
189+
setup-method: ghcup
190+
allow-failure: true
186191
fail-fast: false
187192
steps:
188193
- name: apt
@@ -194,6 +199,7 @@ jobs:
194199
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
195200
chmod a+x "$HOME/.ghcup/bin/ghcup"
196201
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
202+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml;
197203
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
198204
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
199205
else
@@ -204,6 +210,7 @@ jobs:
204210
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
205211
chmod a+x "$HOME/.ghcup/bin/ghcup"
206212
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
213+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml;
207214
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
208215
fi
209216
env:

fixtures/messy.github

+7
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ jobs:
183183
compilerVersion: 7.8.1
184184
setup-method: hvr-ppa
185185
allow-failure: false
186+
- compiler: ghc-head
187+
compilerKind: ghc
188+
compilerVersion: latest-nightly
189+
setup-method: ghcup
190+
allow-failure: true
186191
fail-fast: false
187192
steps:
188193
- name: apt
@@ -194,6 +199,7 @@ jobs:
194199
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
195200
chmod a+x "$HOME/.ghcup/bin/ghcup"
196201
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
202+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml;
197203
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
198204
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
199205
apt-get update
@@ -206,6 +212,7 @@ jobs:
206212
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
207213
chmod a+x "$HOME/.ghcup/bin/ghcup"
208214
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
215+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml;
209216
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
210217
fi
211218
env:

src/HaskellCI/Compiler.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ compilerKind (GHC _) = "ghc"
6969
compilerKind (GHCJS _) = "ghcjs"
7070

7171
compilerVersion :: CompilerVersion -> String
72-
compilerVersion GHCHead = "head"
72+
compilerVersion GHCHead = "latest-nightly" -- https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml
7373
compilerVersion (GHC v) = C.prettyShow v
7474
compilerVersion (GHCJS v) = C.prettyShow v
7575

src/HaskellCI/GitHub.hs

+3-4
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
155155
sh $ "chmod a+x \"$HOME/.ghcup/bin/ghcup\""
156156

157157
-- if any job uses prereleases, add release channel unconditionally. (HEADHACKAGE variable is set later)
158-
when (anyJobUsesHeadHackage || previewCabal cfgCabalInstallVersion) $
158+
when (anyJobUsesHeadHackage || previewCabal cfgCabalInstallVersion) $ do
159159
sh "\"$HOME/.ghcup/bin/ghcup\" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;"
160-
160+
sh "\"$HOME/.ghcup/bin/ghcup\" config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml;"
161+
161162
installGhcupCabal :: ShM ()
162163
installGhcupCabal =
163164
sh $ "\"$HOME/.ghcup/bin/ghcup\" install cabal " ++ cabalFullVer ++ " || (cat \"$HOME\"/.ghcup/logs/*.* && false)"
@@ -643,8 +644,6 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
643644
, ghmeSetupMethod = if isGHCUP compiler then GHCUP else HVRPPA
644645
}
645646
| compiler <- reverse $ toList linuxVersions
646-
, compiler /= GHCHead -- TODO: Make this work
647-
-- https://github.com/haskell-CI/haskell-ci/issues/458
648647
]
649648
})
650649
unless (null cfgIrcChannels) $

0 commit comments

Comments
 (0)