Skip to content

Commit

Permalink
GHC 9.8: bump versions, satisfy x-partial warning (#1025)
Browse files Browse the repository at this point in the history
* CI: bump versions, satisfy actionlint (shellcheck)

* Replace `head` by match to satisfy -Wx-partial (GHC 9.8)

* Allow containers-0.7, QuickCheck-2.15, time-1.14
  • Loading branch information
andreasabel authored May 28, 2024
1 parent 704192c commit a5b7ec4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04, macOS-12, windows-2022]
cabal: ["3.8.1.0"]
cabal: ["3.10.3.0"]
ghc:
- "8.6.5"
- "8.8.4"
- "8.10.7"
- "9.0.2"
- "9.2.8"
- "9.4.8"
- "9.6.3"
- "9.6.5"
- "9.8.2"
exclude:
# fails to build: "can't load framework: Cocoa (not found)"
- os: macOS-12
Expand All @@ -31,10 +32,10 @@ jobs:
ghc: "8.8.4"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
Expand All @@ -55,7 +56,7 @@ jobs:
# avoid invalidating cache too often.
sed '/^index-state: /d' cabal.project.freeze > dependencies-versions
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Cache ~/.cabal/store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
Expand All @@ -75,20 +76,20 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
stack: ["2.9.3"]
ghc: ["9.4.5"] # We want this to match the Stackage snapshot in stack.yaml
stack: ["2.15.5"]
ghc: ["9.4.8"] # We want this to match the Stackage snapshot in stack.yaml

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Cache ~/.stack
with:
path: ~/.stack
Expand All @@ -111,10 +112,10 @@ jobs:
ghc: ["9.2.8"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
Expand All @@ -128,7 +129,7 @@ jobs:
# avoid invalidating cache too often.
sed '/^index-state: /d' cabal.project.freeze > dependencies-versions
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Cache ~/.cabal/store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
Expand All @@ -141,8 +142,8 @@ jobs:
- name: Unpack Cabal package
run: |
cd dist-newstyle/sdist
tar xvf *.tar.gz
rm -f *.tar.gz
tar xvf ./*.tar.gz
rm -f ./*.tar.gz
- name: Build
run: |
Expand Down
8 changes: 4 additions & 4 deletions hakyll.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Library
blaze-html >= 0.5 && < 0.10,
blaze-markup >= 0.5.1 && < 0.9,
bytestring >= 0.9 && < 0.13,
containers >= 0.3 && < 0.7,
containers >= 0.3 && < 0.8,
data-default >= 0.4 && < 0.8,
deepseq >= 1.3 && < 1.6,
directory >= 1.2.7.0 && < 1.4,
Expand All @@ -212,7 +212,7 @@ Library
tagsoup >= 0.13.1 && < 0.15,
template-haskell >= 2.14 && < 2.22,
text >= 0.11 && < 1.3 || >= 2.0 && < 2.2,
time >= 1.8 && < 1.13,
time >= 1.8 && < 1.15,
time-locale-compat >= 0.1 && < 0.2,
unordered-containers >= 0.2 && < 0.3,
vector >= 0.11 && < 0.14,
Expand Down Expand Up @@ -286,7 +286,7 @@ Test-suite hakyll-tests

Build-Depends:
hakyll,
QuickCheck >= 2.8 && < 2.15,
QuickCheck >= 2.8 && < 2.16,
tasty >= 0.11 && < 1.6,
tasty-golden >= 2.3 && < 2.4,
tasty-hunit >= 0.9 && < 0.11,
Expand All @@ -295,7 +295,7 @@ Test-suite hakyll-tests
aeson >= 1.0 && < 1.6 || >= 2.0 && < 2.3,
base >= 4.12 && < 5,
bytestring >= 0.9 && < 0.13,
containers >= 0.3 && < 0.7,
containers >= 0.3 && < 0.8,
filepath >= 1.0 && < 1.6,
tagsoup >= 0.13.1 && < 0.15,
text >= 0.11 && < 1.3 || >= 2.0 && < 2.2,
Expand Down
4 changes: 3 additions & 1 deletion lib/Hakyll/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ checkExternalUrl url = do
-- Convert exception to a concise form
showException e = case cast e of
Just (Http.HttpExceptionRequest _ e') -> show e'
_ -> head $ words $ show e
_ -> case words $ show e of
w:_ -> w
[] -> error "Hakyll.Check.checkExternalUrl: impossible"

requestExternalUrl :: URL -> Checker (Either SomeException Bool)
requestExternalUrl url = liftIO $ try $ do
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: 'lts-21.6' # If you change this, please update GHC version "stack / ghc" job in .github/workflows/main.yaml
resolver: 'lts-21.25' # If you change this, please update GHC version "stack / ghc" job in .github/workflows/main.yaml
save-hackage-creds: false
system-ghc: true
skip-ghc-check: true
Expand Down
6 changes: 5 additions & 1 deletion tests/Hakyll/Core/Runtime/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,18 @@ case01 = do
lines example @?= ["<p>This is an example.</p>"]

bodies <- readFile $ destinationDirectory testConfiguration </> "bodies.txt"
head (lines bodies) @?= "This is an example."
head' (lines bodies) @?= "This is an example."

partial <- readFile $ providerDirectory testConfiguration </> "partial.html.out"
partial' <- readFile $ destinationDirectory testConfiguration </> "partial.html.out"
partial @?= partial'

cleanTestEnv

where
head' (x:_) = x
head' [] = error "Hakyll.Core.Runtime.Tests.case01: impossible"


--------------------------------------------------------------------------------
case02 :: Assertion
Expand Down

0 comments on commit a5b7ec4

Please sign in to comment.