Skip to content

Commit 613dcf9

Browse files
author
Gaël Deest
committed
Basic GitHub actions-based CI
- Setup a basic CI based on GitHub actions, with a somewhat limited build matrix. - Disable cookbook/testing, because servant-quickcheck doesn't build anymore. - Disable servant-docs on Cabal build, because of some test failures - The order of some JSON fields seems to be reversed in the output, need investigation. - Fix test failures in servant-http-streams when `localhost` points to an IPv6 address rather than 127.0.0.1.
1 parent f1b5a64 commit 613dcf9

File tree

3 files changed

+100
-3
lines changed

3 files changed

+100
-3
lines changed

.github/workflows/main.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: CI
2+
3+
# Trigger the workflow on push or pull request, but only for the main branch
4+
on:
5+
pull_request:
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
cabal:
11+
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macOS-latest]
16+
cabal: ["3.2"]
17+
ghc:
18+
- "8.8.4"
19+
- "8.10.2"
20+
# exclude:
21+
# - os: macOS-latest
22+
# ghc: 8.8.4
23+
# - os: macOS-latest
24+
# ghc: 8.6.5
25+
# - os: windows-latest
26+
# ghc: 8.10.2
27+
# - os: windows-latest
28+
# ghc: 8.6.5
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
33+
- uses: actions/[email protected]
34+
id: setup-haskell-cabal
35+
name: Setup Haskell
36+
with:
37+
ghc-version: ${{ matrix.ghc }}
38+
cabal-version: ${{ matrix.cabal }}
39+
40+
- name: Configure
41+
run: |
42+
cabal configure --enable-tests --enable-benchmarks --test-show-details=direct
43+
44+
- name: Freeze
45+
run: |
46+
cabal freeze
47+
48+
- uses: actions/[email protected]
49+
name: Cache ~/.cabal/store
50+
with:
51+
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
52+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
53+
54+
- name: Build
55+
run: |
56+
cabal build all
57+
58+
- name: Test
59+
run: |
60+
cabal test all
61+
62+
stack:
63+
name: stack / ghc ${{ matrix.ghc }}
64+
runs-on: ubuntu-latest
65+
strategy:
66+
matrix:
67+
stack: ["2.3.1"]
68+
ghc: ["8.8.4"]
69+
70+
steps:
71+
- uses: actions/checkout@v2
72+
73+
- uses: actions/[email protected]
74+
name: Setup Haskell Stack
75+
with:
76+
ghc-version: ${{ matrix.ghc }}
77+
stack-version: ${{ matrix.stack }}
78+
79+
- uses: actions/[email protected]
80+
name: Cache ~/.stack
81+
with:
82+
path: ~/.stack
83+
key: ${{ runner.os }}-${{ matrix.ghc }}-stack
84+
85+
- name: Install dependencies
86+
run: |
87+
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --only-dependencies
88+
89+
- name: Build
90+
run: |
91+
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks
92+
93+
- name: Test
94+
run: |
95+
stack test --system-ghc

cabal.project

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ packages:
33
servant-client/
44
servant-client-core/
55
servant-http-streams/
6-
servant-docs/
6+
-- Tests failing with Cabal (TODO: investigate)
7+
-- servant-docs/
78
servant-foreign/
89
servant-server/
910
doc/tutorial/
@@ -33,7 +34,8 @@ packages:
3334
-- doc/cookbook/jwt-and-basic-auth/
3435
doc/cookbook/pagination
3536
-- doc/cookbook/sentry
36-
doc/cookbook/testing
37+
-- Commented out because servant-quickcheck currently doesn't build.
38+
-- doc/cookbook/testing
3739
doc/cookbook/uverb
3840
doc/cookbook/structuring-apis
3941
doc/cookbook/using-custom-monad

servant-http-streams/test/Servant/ClientSpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ startWaiApp app = do
482482
(port, socket) <- openTestSocket
483483
let settings = setPort port $ defaultSettings
484484
thread <- forkIO $ runSettingsSocket settings socket app
485-
return (thread, BaseUrl Http "localhost" port "")
485+
return (thread, BaseUrl Http "127.0.0.1" port "")
486486

487487

488488
endWaiApp :: (ThreadId, BaseUrl) -> IO ()

0 commit comments

Comments
 (0)