summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHécate <hecate+gitlab@glitchbra.in>2020-09-26 17:15:10 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-09 08:44:26 -0400
commitf7e2fff96975128397e2dab7d57da3c9c6b8c76b (patch)
treec1aaa7d3750531a648787c075b804f242d28e589
parente48cab2a57f2342891f985bcb44817e17e985275 (diff)
downloadhaskell-f7e2fff96975128397e2dab7d57da3c9c6b8c76b.tar.gz
Add linting of `base` to the CI
-rw-r--r--.gitlab-ci.yml83
-rw-r--r--libraries/base/GHC/Event/EPoll.hsc12
-rw-r--r--libraries/base/GHC/Event/KQueue.hsc15
-rw-r--r--libraries/base/GHC/Event/Poll.hsc2
-rw-r--r--libraries/base/GHC/ExecutionStack/Internal.hsc2
-rw-r--r--libraries/base/GHC/IO/Handle/Lock/LinuxOFD.hsc2
-rw-r--r--libraries/base/GHC/IO/Handle/Lock/Windows.hsc2
-rw-r--r--libraries/base/GHC/RTS/Flags.hsc3
-rw-r--r--libraries/base/System/Environment/ExecutablePath.hsc2
-rw-r--r--libraries/base/tests/Concurrent/ThreadDelay001.hs5
10 files changed, 84 insertions, 44 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9243f9e41e..df2608a9d0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
- DOCKER_REV: e1cdfaea745989faa266f09c1d6c4c981aa34dc6
+ DOCKER_REV: 6ceb0cecaeefd4927b26c054e4897724986078c8
# Sequential version number capturing the versions of all tools fetched by
# .gitlab/ci.sh.
@@ -17,13 +17,14 @@ variables:
GIT_SUBMODULE_STRATEGY: "recursive"
stages:
- - lint # Source linting
- - quick-build # A very quick smoke-test to weed out broken commits
- - build # A quick smoke-test to weed out broken commits
- - full-build # Build all the things
- - packaging # Source distribution, etc.
- - testing # head.hackage correctness and compiler performance testing
- - deploy # push documentation
+ - tool-lint # Source linting of the tools
+ - quick-build # A very quick smoke-test to weed out broken commits
+ - lint # Source linting of GHC
+ - build # A quick smoke-test to weed out broken commits
+ - full-build # Build all the things
+ - packaging # Source distribution, etc.
+ - testing # head.hackage correctness and compiler performance testing
+ - deploy # push documentation
# Note [The CI Story]
# ~~~~~~~~~~~~~~~~~~~
@@ -81,11 +82,11 @@ workflow:
############################################################
-# Linting
+# tool linting
############################################################
ghc-linters:
- stage: lint
+ stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
@@ -105,7 +106,7 @@ ghc-linters:
# Run mypy Python typechecker on linter scripts.
lint-linters:
- stage: lint
+ stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- mypy .gitlab/linters/*.py
@@ -115,7 +116,7 @@ lint-linters:
# Check that .T files all parse by listing broken tests.
lint-testsuite:
- stage: lint
+ stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
script:
- make -Ctestsuite list_broken TEST_HC=$GHC
@@ -125,7 +126,7 @@ lint-testsuite:
# Run mypy Python typechecker on testsuite driver
typecheck-testsuite:
- stage: lint
+ stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- mypy testsuite/driver/runtests.py
@@ -137,7 +138,7 @@ typecheck-testsuite:
# accommodate, e.g., haddock changes not yet upstream) but not on `master` or
# Marge jobs.
.lint-submods:
- stage: lint
+ stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
- git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
@@ -169,7 +170,7 @@ lint-submods-branch:
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
.lint-changelogs:
- stage: lint
+ stage: tool-lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
dependencies: []
tags:
@@ -189,7 +190,6 @@ lint-release-changelogs:
rules:
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
-
############################################################
# Validation via Pipelines (hadrian)
############################################################
@@ -235,10 +235,12 @@ lint-release-changelogs:
validate-x86_64-linux-deb9-hadrian:
extends: .validate-linux-hadrian
+ needs: [hadrian-ghc-in-ghci]
stage: build
validate-x86_64-linux-deb9-unreg-hadrian:
extends: .validate-linux-hadrian
+ needs: [validate-x86_64-linux-deb9-hadrian]
stage: full-build
variables:
CONFIGURE_ARGS: --enable-unregisterised
@@ -246,6 +248,7 @@ validate-x86_64-linux-deb9-unreg-hadrian:
hadrian-ghc-in-ghci:
stage: quick-build
+ needs: [ghc-linters, lint-linters, lint-submods]
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
before_script:
# workaround for docker permissions
@@ -274,6 +277,37 @@ hadrian-ghc-in-ghci:
- cabal-cache
############################################################
+# GHC source code linting
+############################################################
+
+.lint-params:
+ stage: lint
+ needs: [ghc-linters, lint-submods]
+ tags:
+ - lint
+ image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
+ before_script:
+ - export PATH="/opt/toolchain/bin:$PATH"
+ # workaround for docker permissions
+ - sudo chown ghc:ghc -R .
+ - git submodule sync --recursive
+ - git submodule update --init --recursive
+ - git checkout .gitmodules
+ - .gitlab/ci.sh setup
+ - cabal update
+ - cd hadrian; cabal new-build -j`../mk/detect-cpu-count.sh` --with-compiler=$GHC --project-file=ci.project; cd ..
+ variables:
+ GHC_FLAGS: -Werror
+
+lint-base:
+ extends: .lint-params
+ script:
+ - hadrian/build -c -j stage1:lib:base
+ - hadrian/build -j lint:base
+ cache:
+ key: lint
+
+############################################################
# Validation via Pipelines (make)
############################################################
@@ -301,7 +335,9 @@ hadrian-ghc-in-ghci:
#################################
.build-x86_64-freebsd:
+ stage: full-build
extends: .validate
+ needs: [validate-x86_64-linux-deb9-hadrian]
tags:
- x86_64-freebsd
allow_failure: true
@@ -331,23 +367,19 @@ hadrian-ghc-in-ghci:
# Conditional due to lack of builder capacity
validate-x86_64-freebsd:
extends: .build-x86_64-freebsd
- stage: full-build
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/'
nightly-x86_64-freebsd:
<<: *nightly
extends: .build-x86_64-freebsd
- stage: full-build
release-x86_64-freebsd:
<<: *release
extends: .build-x86_64-freebsd
- stage: full-build
.build-x86_64-freebsd-hadrian:
extends: .validate-hadrian
- stage: full-build
tags:
- x86_64-freebsd
allow_failure: true
@@ -374,7 +406,6 @@ release-x86_64-freebsd:
# Disabled due to lack of builder capacity
.validate-x86_64-freebsd-hadrian:
extends: .build-x86_64-freebsd-hadrian
- stage: full-build
#################################
# x86_64-darwin
@@ -382,6 +413,7 @@ release-x86_64-freebsd:
validate-x86_64-darwin:
extends: .validate
+ needs: [validate-x86_64-linux-deb9-hadrian]
stage: full-build
tags:
- x86_64-darwin
@@ -411,6 +443,7 @@ validate-x86_64-darwin:
# Disabled because of OS X CI capacity
.validate-x86_64-darwin-hadrian:
stage: full-build
+ needs: [validate-x86_64-linux-deb9-hadrian]
tags:
- x86_64-darwin
variables:
@@ -440,6 +473,7 @@ validate-x86_64-darwin:
.validate-linux:
extends: .validate
+ needs: [validate-x86_64-linux-deb9-hadrian]
tags:
- x86_64-linux
variables:
@@ -809,6 +843,7 @@ validate-x86_64-linux-fedora27:
.build-windows:
# For the reasons given in #17777 this build isn't reliable.
+ needs: [validate-x86_64-linux-deb9-hadrian]
allow_failure: true
before_script:
- git clean -xdf
@@ -929,6 +964,7 @@ release-x86_64-windows-integer-simple:
doc-tarball:
stage: packaging
+ needs: [validate-x86_64-linux-deb9-debug, validate-x86_64-windows-hadrian, validate-x86_64-linux-deb9-unreg-hadrian]
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
@@ -964,6 +1000,7 @@ doc-tarball:
source-tarball:
stage: packaging
+ needs: [validate-x86_64-linux-deb9-unreg-hadrian]
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
@@ -998,6 +1035,7 @@ source-tarball:
.hackage:
stage: testing
+ needs: [doc-tarball]
image: ghcci/x86_64-linux-deb9:0.2
tags:
- x86_64-linux
@@ -1026,6 +1064,7 @@ nightly-hackage:
perf-nofib:
stage: testing
+ needs: [validate-x86_64-linux-deb9-dwarf, doc-tarball]
dependencies:
- validate-x86_64-linux-deb9-dwarf
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
@@ -1062,6 +1101,7 @@ perf-nofib:
perf:
stage: testing
+ needs: [validate-x86_64-linux-deb9-dwarf, doc-tarball]
dependencies:
- validate-x86_64-linux-deb9-dwarf
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
@@ -1097,6 +1137,7 @@ perf:
pages:
stage: deploy
+ needs: [doc-tarball]
dependencies:
- doc-tarball
image: ghcci/x86_64-linux-deb9:0.2
diff --git a/libraries/base/GHC/Event/EPoll.hsc b/libraries/base/GHC/Event/EPoll.hsc
index 14324bc43d..bc3ed623d3 100644
--- a/libraries/base/GHC/Event/EPoll.hsc
+++ b/libraries/base/GHC/Event/EPoll.hsc
@@ -1,8 +1,7 @@
-{-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving
- , NoImplicitPrelude
- , BangPatterns
- #-}
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE Trustworthy #-}
-----------------------------------------------------------------------------
-- |
@@ -50,8 +49,7 @@ import GHC.Base
import GHC.Num (Num(..))
import GHC.Real (fromIntegral, div)
import GHC.Show (Show)
-import System.Posix.Internals (c_close)
-import System.Posix.Internals (setCloseOnExec)
+import System.Posix.Internals (c_close, setCloseOnExec)
import System.Posix.Types (Fd(..))
import qualified GHC.Event.Array as A
diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc
index 05bdd63bae..fe5ba5e221 100644
--- a/libraries/base/GHC/Event/KQueue.hsc
+++ b/libraries/base/GHC/Event/KQueue.hsc
@@ -1,10 +1,11 @@
-{-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CApiFFI
- , GeneralizedNewtypeDeriving
- , NoImplicitPrelude
- , RecordWildCards
- , BangPatterns
- #-}
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CApiFFI #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE Trustworthy #-}
+
+{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
+{-# HLINT ignore "Unused LANGUAGE pragma" #-}
module GHC.Event.KQueue
(
diff --git a/libraries/base/GHC/Event/Poll.hsc b/libraries/base/GHC/Event/Poll.hsc
index 370dd4a365..a9d073be6a 100644
--- a/libraries/base/GHC/Event/Poll.hsc
+++ b/libraries/base/GHC/Event/Poll.hsc
@@ -91,7 +91,7 @@ poll p mtout f = do
c_pollLoop ptr (fromIntegral len) (fromTimeout tout)
Nothing ->
c_poll_unsafe ptr (fromIntegral len) 0
- when (n /= 0) $ do
+ when (n /= 0) $
A.loop a 0 $ \i e -> do
let r = pfdRevents e
if r /= 0
diff --git a/libraries/base/GHC/ExecutionStack/Internal.hsc b/libraries/base/GHC/ExecutionStack/Internal.hsc
index 7db1e86ff7..46deccbd73 100644
--- a/libraries/base/GHC/ExecutionStack/Internal.hsc
+++ b/libraries/base/GHC/ExecutionStack/Internal.hsc
@@ -171,7 +171,7 @@ stackFrames st@(StackTrace fptr) = unsafePerformIO $ withSession $ \sess -> do
frame' = frame `plusPtr` sizeOf (undefined :: Addr)
lookupFrame :: Addr -> IO (Maybe Location)
- lookupFrame pc = withForeignPtr fptr $ const $ do
+ lookupFrame pc = withForeignPtr fptr $ const $
allocaBytes locationSize $ \buf -> do
ret <- withForeignPtr sess $ \sessPtr -> libdw_lookup_location sessPtr buf pc
case ret of
diff --git a/libraries/base/GHC/IO/Handle/Lock/LinuxOFD.hsc b/libraries/base/GHC/IO/Handle/Lock/LinuxOFD.hsc
index 826656c936..86d1545db8 100644
--- a/libraries/base/GHC/IO/Handle/Lock/LinuxOFD.hsc
+++ b/libraries/base/GHC/IO/Handle/Lock/LinuxOFD.hsc
@@ -60,7 +60,7 @@ instance Storable FLock where
#{poke struct flock, l_start} ptr (l_start x)
#{poke struct flock, l_len} ptr (l_len x)
#{poke struct flock, l_pid} ptr (l_pid x)
- peek ptr = do
+ peek ptr =
FLock <$> #{peek struct flock, l_type} ptr
<*> #{peek struct flock, l_whence} ptr
<*> #{peek struct flock, l_start} ptr
diff --git a/libraries/base/GHC/IO/Handle/Lock/Windows.hsc b/libraries/base/GHC/IO/Handle/Lock/Windows.hsc
index f1e54125bb..399807b54b 100644
--- a/libraries/base/GHC/IO/Handle/Lock/Windows.hsc
+++ b/libraries/base/GHC/IO/Handle/Lock/Windows.hsc
@@ -1,7 +1,5 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE InterruptibleFFI #-}
-{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NoImplicitPrelude #-}
-- | File locking for Windows.
diff --git a/libraries/base/GHC/RTS/Flags.hsc b/libraries/base/GHC/RTS/Flags.hsc
index 03cd368723..b23ae34165 100644
--- a/libraries/base/GHC/RTS/Flags.hsc
+++ b/libraries/base/GHC/RTS/Flags.hsc
@@ -1,6 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
-{-# LANGUAGE RecordWildCards #-}
-- | Accessors to GHC RTS flags.
-- Descriptions of flags can be seen in
@@ -392,7 +391,7 @@ data RTSFlags = RTSFlags
foreign import ccall "&RtsFlags" rtsFlagsPtr :: Ptr RTSFlags
getRTSFlags :: IO RTSFlags
-getRTSFlags = do
+getRTSFlags =
RTSFlags <$> getGCFlags
<*> getConcFlags
<*> getMiscFlags
diff --git a/libraries/base/System/Environment/ExecutablePath.hsc b/libraries/base/System/Environment/ExecutablePath.hsc
index 932af67b45..59a3d624e8 100644
--- a/libraries/base/System/Environment/ExecutablePath.hsc
+++ b/libraries/base/System/Environment/ExecutablePath.hsc
@@ -132,7 +132,7 @@ foreign import ccall unsafe "readlink"
-- See readlink(2)
readSymbolicLink :: FilePath -> IO FilePath
readSymbolicLink file =
- allocaArray0 4096 $ \buf -> do
+ allocaArray0 4096 $ \buf ->
withFilePath file $ \s -> do
len <- throwErrnoPathIfMinus1 "readSymbolicLink" file $
c_readlink s buf 4096
diff --git a/libraries/base/tests/Concurrent/ThreadDelay001.hs b/libraries/base/tests/Concurrent/ThreadDelay001.hs
index 21bc1178dc..19659faaf7 100644
--- a/libraries/base/tests/Concurrent/ThreadDelay001.hs
+++ b/libraries/base/tests/Concurrent/ThreadDelay001.hs
@@ -1,5 +1,7 @@
-{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CPP #-}
+{-# HLINT ignore "Unused LANGUAGE pragma" #-}
+
-- Test that threadDelay actually sleeps for (at least) as long as we
-- ask it
@@ -16,6 +18,7 @@ import Data.Time
#if defined(mingw32_HOST_OS)
import GHC.Event.Windows.Clock
#endif
+
main :: IO ()
main = mapM_ delay (0 : take 7 (iterate (*5) 100))