Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghc-api-compat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
ghc-api-compat
Commits
45e2533a
Commit
45e2533a
authored
3 years ago
by
Sylvain Henry
Browse files
Options
Downloads
Patches
Plain Diff
Add test script
parent
b40dc9e7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test.hs
+50
-0
50 additions, 0 deletions
test.hs
with
50 additions
and
0 deletions
test.hs
0 → 100644
+
50
−
0
View file @
45e2533a
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BlockArguments #-}
module
Main
where
import
qualified
Data.List
as
List
import
System.Process
import
Control.Monad
import
Data.Version
import
Text.ParserCombinators.ReadP
main
::
IO
()
main
=
do
callCommand
"ghcup upgrade"
let
toVersion
x
=
fst
$
head
$
filter
(
null
.
snd
)
$
readP_to_S
(
parseVersion
)
x
let
show_versions
=
concatMap
(
\
v
->
"
\n
- "
++
showVersion
v
)
-- get available GHC versions via ghcup
avails
<-
readCreateProcess
(
shell
"ghcup list -r -t ghc"
)
""
let
fix_avail
=
toVersion
.
takeWhile
(
/=
' '
)
.
drop
4
let
avail_ghc_versions
=
fmap
fix_avail
(
lines
avails
)
putStrLn
$
"Available GHC versions: "
++
show_versions
avail_ghc_versions
let
-- only test the recent ones
test_pred
=
(
>=
makeVersion
[
8
,
8
])
prefiltered
=
filter
test_pred
avail_ghc_versions
-- take only the latest version per major release
major
=
take
2
.
versionBranch
same_major
x
y
=
major
x
==
major
y
test_ghc_versions
=
fmap
(
last
.
List
.
sort
)
$
List
.
groupBy
same_major
prefiltered
putStrLn
$
"We will test the following GHC versions: "
++
show_versions
test_ghc_versions
forM_
test_ghc_versions
\
version
->
do
let
v
=
showVersion
version
let
ghc
=
"ghc-"
++
v
putStrLn
"#######################################"
putStrLn
$
"Testing "
++
ghc
putStrLn
"#######################################"
putStrLn
"# Installing GHC..."
callCommand
$
"ghcup install ghc "
++
v
putStrLn
"# Trying to build with cabal-install..."
callCommand
"cabal clean"
callCommand
$
"cabal build -w "
++
ghc
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment