From cef324795e212480f86ab98ab80af5354afbc38b Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Sun, 23 May 2021 21:01:13 +0100 Subject: [PATCH] ci: Enable -Werror Related: https://github.com/xmonad/xmonad/commit/14d9fa247ae7e810e15b1cb09454c93bbe4cf946 Related: https://github.com/xmonad/xmonad/commit/5cdf428f5513e14f7e13c707ceeca1ed42207625 --- .github/workflows/haskell-ci.yml | 3 +++ .github/workflows/stack.yml | 3 ++- cabal.haskell-ci | 4 ++++ xmonad-contrib.cabal | 32 ++++++++++++++++++++++---------- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index f42ea097..07497bfc 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -140,6 +140,9 @@ jobs: type: git location: https://github.com/xmonad/xmonad branch: master + + package xmonad-contrib + flags: +pedantic EOF $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(xmonad-contrib)$/; }' >> cabal.project.local cat cabal.project diff --git a/.github/workflows/stack.yml b/.github/workflows/stack.yml index e29ef34c..4bd2144d 100644 --- a/.github/workflows/stack.yml +++ b/.github/workflows/stack.yml @@ -99,4 +99,5 @@ jobs: stack test \ --fast --no-terminal \ --stack-yaml=${{ matrix.yaml }} \ - --resolver=${{ matrix.resolver }} --system-ghc + --resolver=${{ matrix.resolver }} --system-ghc \ + --flag=xmonad-contrib:pedantic diff --git a/cabal.haskell-ci b/cabal.haskell-ci index e3cb39fc..0b0762d8 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -5,3 +5,7 @@ apt: libxinerama-dev libxrandr-dev libxss-dev + +raw-project + package xmonad-contrib + flags: +pedantic diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal index d2e82bfd..f2ecdf37 100644 --- a/xmonad-contrib.cabal +++ b/xmonad-contrib.cabal @@ -41,10 +41,10 @@ source-repository head flag use_xft description: Use Xft to render text -flag testing - description: Testing mode - manual: True - default: False +flag pedantic + description: Be pedantic (-Werror and the like) + default: False + manual: True library build-depends: base >= 4.9 && < 5, @@ -61,19 +61,21 @@ library xmonad >= 0.15 && < 0.16, utf8-string - ghc-options: -fwarn-tabs -Wall -Wno-unused-do-bind -Wno-unused-imports + ghc-options: -Wall -Wno-unused-do-bind + + if flag(pedantic) + ghc-options: -Werror -Wwarn=deprecations -- Keep this in sync with the oldest version in 'tested-with' - if impl(ghc <= 8.4.4) - ghc-options: -Werror=unused-imports + if impl(ghc > 8.4.4) + -- don't treat unused-imports warning as errors, they may be necessary + -- for compatibility with older versions of base (or other deps) + ghc-options: -Wwarn=unused-imports if flag(use_xft) build-depends: X11-xft >= 0.2 cpp-options: -DXFT - if flag(testing) - ghc-options: -fwarn-tabs -Werror - exposed-modules: XMonad.Actions.AfterDrag XMonad.Actions.BluetileCommands XMonad.Actions.Commands @@ -417,3 +419,13 @@ test-suite tests , utf8-string , xmonad >= 0.15 && < 0.16 cpp-options: -DTESTING + ghc-options: -Wall -Wno-unused-do-bind + + if flag(pedantic) + ghc-options: -Werror -Wwarn=deprecations + + -- Keep this in sync with the oldest version in 'tested-with' + if impl(ghc > 8.4.4) + -- don't treat unused-imports warning as errors, they may be necessary + -- for compatibility with older versions of base (or other deps) + ghc-options: -Wwarn=unused-imports