Skip to content

Commit 34e1864

Browse files
committed
WIP
1 parent 174f699 commit 34e1864

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

.github/actions/check-release-builds/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ inputs:
1010
hackage-index-state:
1111
required: true
1212
description: "Timestamp for Hackage index"
13-
cabal-files:
13+
cli-args:
1414
required: true
15-
description: "Cabal files of the libraries that should be checked"
15+
description: "Command-line arguments for the check-release-builds script"
1616
runs:
1717
using: composite
1818
steps:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ jobs:
360360
hackage-index-state: "2025-06-16T00:00:00Z"
361361
# Run without supplying any cabal files just to verify whether the
362362
# script runs without problems.
363-
cabal-files: ""
363+
cabal-files: "Default"
364364

365365
################################################################################
366366
# Publish documentation

scripts/check-release-builds.hs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,26 @@ import Text.Printf
2929

3030
main :: IO ()
3131
main = do
32-
cabalFiles <- getArgs
33-
printf "Checking release builds for %s...\n" (show cabalFiles)
34-
35-
forM_ allGhcVersions findGhcExecutable
36-
37-
withTempProjectFile cabalFiles $ \projectFile ->
38-
forM_ cabalFiles $ \cabalFile -> do
39-
let component = (dropExtension $ takeFileName cabalFile)
40-
forM_ allGhcVersions $ buildComponentWith projectFile component
41-
42-
printf "All release builds successful for GHC versions: %s" (unwords $ fmap ghcVersionExecutableName allGhcVersions)
32+
args <- getArgs
33+
case args of
34+
ghcVersions : cabalFiles
35+
| Just vs <- case ghcVersions of
36+
"Default" -> Just [Default]
37+
"All" -> Just allGhcVersions
38+
_ -> Nothing
39+
-> do
40+
printf "Checking release builds for %s with ghc versions %s...\n" (show cabalFiles) (show $ fmap ghcVersionExecutableName vs)
41+
42+
forM_ vs findGhcExecutable
43+
44+
withTempProjectFile cabalFiles $ \projectFile ->
45+
forM_ cabalFiles $ \cabalFile -> do
46+
let component = (dropExtension $ takeFileName cabalFile)
47+
forM_ vs $ buildComponentWith projectFile component
48+
49+
printf "All release builds successful for GHC versions: %s" (unwords $ fmap ghcVersionExecutableName vs)
50+
_ -> do
51+
putStrLn "Usage: [Default|All] FILES"
4352

4453
-- TODO: I wanted to use the --ignore-project cabal option, which should be
4554
-- a globally configurable value according to the cabal user guide, but for
@@ -58,14 +67,15 @@ withTempProjectFile cabalFiles k = do
5867
(\_ -> removeFile tempProjectFilePath)
5968
k
6069

61-
data GhcVersion = Ghc9_2 | Ghc9_4 | Ghc9_6 | Ghc9_8 | Ghc9_10 | Ghc9_12
70+
data GhcVersion = Default | Ghc9_2 | Ghc9_4 | Ghc9_6 | Ghc9_8 | Ghc9_10 | Ghc9_12
6271
deriving stock (Enum, Bounded)
6372

6473
allGhcVersions :: [GhcVersion]
65-
allGhcVersions = [minBound .. maxBound]
74+
allGhcVersions = [Ghc9_2 .. maxBound]
6675

6776
ghcVersionExecutableName :: GhcVersion -> String
6877
ghcVersionExecutableName = \case
78+
Default -> "ghc"
6979
Ghc9_2 -> "ghc-9.2"
7080
Ghc9_4 -> "ghc-9.4"
7181
Ghc9_6 -> "ghc-9.6"

0 commit comments

Comments
 (0)