git.iko.soy/typeable/postgresql-simple
on master help sign in
Try tests with postgres-14
aa0f427Oleg Grenrus
.github/workflows/haskell-ci.yml+95−29
@@ -8,9 +8,9 @@
8#
8#
9# For more information, see https://github.com/haskell-CI/haskell-ci
9# For more information, see https://github.com/haskell-CI/haskell-ci
10#
10#
11−# version: 0.12
11+# version: 0.15.20221009
12#
12#
13−# REGENDATA ("0.12",["github","cabal.project"])
13+# REGENDATA ("0.15.20221009",["github","cabal.project"])
14#
14#
15name: Haskell-CI
15name: Haskell-CI
16on:
16on:
@@ -23,12 +23,14 @@ on:
23jobs:
23jobs:
24 linux:
24 linux:
25 name: Haskell-CI - Linux - ${{ matrix.compiler }}
25 name: Haskell-CI - Linux - ${{ matrix.compiler }}
26− runs-on: ubuntu-18.04
26+ runs-on: ubuntu-20.04
27+ timeout-minutes:
28+ 60
27 container:
29 container:
28 image: buildpack-deps:bionic
30 image: buildpack-deps:bionic
29 services:
31 services:
30 postgres:
32 postgres:
31− image: postgres:10
33+ image: postgres:14
32 env:
34 env:
33 POSTGRES_PASSWORD: postgres
35 POSTGRES_PASSWORD: postgres
34 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
36 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
@@ -36,59 +38,118 @@ jobs:
36 strategy:
38 strategy:
37 matrix:
39 matrix:
38 include:
40 include:
41+ - compiler: ghc-9.2.1
42+ compilerKind: ghc
43+ compilerVersion: 9.2.1
44+ setup-method: ghcup
45+ allow-failure: false
39 - compiler: ghc-9.0.1
46 - compiler: ghc-9.0.1
47+ compilerKind: ghc
48+ compilerVersion: 9.0.1
49+ setup-method: hvr-ppa
40 allow-failure: false
50 allow-failure: false
41− - compiler: ghc-8.10.4
51+ - compiler: ghc-8.10.7
52+ compilerKind: ghc
53+ compilerVersion: 8.10.7
54+ setup-method: ghcup
42 allow-failure: false
55 allow-failure: false
43 - compiler: ghc-8.8.4
56 - compiler: ghc-8.8.4
57+ compilerKind: ghc
58+ compilerVersion: 8.8.4
59+ setup-method: hvr-ppa
44 allow-failure: false
60 allow-failure: false
45 - compiler: ghc-8.6.5
61 - compiler: ghc-8.6.5
62+ compilerKind: ghc
63+ compilerVersion: 8.6.5
64+ setup-method: hvr-ppa
46 allow-failure: false
65 allow-failure: false
47 - compiler: ghc-8.4.4
66 - compiler: ghc-8.4.4
67+ compilerKind: ghc
68+ compilerVersion: 8.4.4
69+ setup-method: hvr-ppa
48 allow-failure: false
70 allow-failure: false
49 - compiler: ghc-8.2.2
71 - compiler: ghc-8.2.2
72+ compilerKind: ghc
73+ compilerVersion: 8.2.2
74+ setup-method: hvr-ppa
50 allow-failure: false
75 allow-failure: false
51 - compiler: ghc-8.0.2
76 - compiler: ghc-8.0.2
77+ compilerKind: ghc
78+ compilerVersion: 8.0.2
79+ setup-method: hvr-ppa
52 allow-failure: false
80 allow-failure: false
53 - compiler: ghc-7.10.3
81 - compiler: ghc-7.10.3
82+ compilerKind: ghc
83+ compilerVersion: 7.10.3
84+ setup-method: hvr-ppa
54 allow-failure: false
85 allow-failure: false
55 - compiler: ghc-7.8.4
86 - compiler: ghc-7.8.4
87+ compilerKind: ghc
88+ compilerVersion: 7.8.4
89+ setup-method: hvr-ppa
56 allow-failure: false
90 allow-failure: false
57 - compiler: ghc-7.6.3
91 - compiler: ghc-7.6.3
92+ compilerKind: ghc
93+ compilerVersion: 7.6.3
94+ setup-method: hvr-ppa
58 allow-failure: false
95 allow-failure: false
59 fail-fast: false
96 fail-fast: false
60 steps:
97 steps:
61 - name: apt
98 - name: apt
62 run: |
99 run: |
63 apt-get update
100 apt-get update
64− apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common
101+ apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
102+ if [ "${{ matrix.setup-method }}" = ghcup ]; then
103+ mkdir -p "$HOME/.ghcup/bin"
104+ curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
105+ chmod a+x "$HOME/.ghcup/bin/ghcup"
106+ "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
107+ "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
108+ else
65− apt-add-repository -y 'ppa:hvr/ghc'
109+ apt-add-repository -y 'ppa:hvr/ghc'
66− apt-get update
110+ apt-get update
67− apt-get install -y $CC cabal-install-3.4
111+ apt-get install -y "$HCNAME"
112+ mkdir -p "$HOME/.ghcup/bin"
113+ curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
114+ chmod a+x "$HOME/.ghcup/bin/ghcup"
115+ "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
116+ fi
68 env:
117 env:
118+ HCKIND: ${{ matrix.compilerKind }}
69− CC: ${{ matrix.compiler }}
119+ HCNAME: ${{ matrix.compiler }}
120+ HCVER: ${{ matrix.compilerVersion }}
70 - name: Set PATH and environment variables
121 - name: Set PATH and environment variables
71 run: |
122 run: |
72 echo "$HOME/.cabal/bin" >> $GITHUB_PATH
123 echo "$HOME/.cabal/bin" >> $GITHUB_PATH
73− echo "LANG=C.UTF-8" >> $GITHUB_ENV
124+ echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
74− echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV
125+ echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
75− echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV
126+ echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
76− HCDIR=$(echo "/opt/$CC" | sed 's/-/\//')
127+ HCDIR=/opt/$HCKIND/$HCVER
77− HCNAME=ghc
128+ if [ "${{ matrix.setup-method }}" = ghcup ]; then
78− HC=$HCDIR/bin/$HCNAME
129+ HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
79− echo "HC=$HC" >> $GITHUB_ENV
130+ echo "HC=$HC" >> "$GITHUB_ENV"
80− echo "HCPKG=$HCDIR/bin/$HCNAME-pkg" >> $GITHUB_ENV
131+ echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
81− echo "HADDOCK=$HCDIR/bin/haddock" >> $GITHUB_ENV
132+ echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
133+ echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
134+ else
135+ HC=$HCDIR/bin/$HCKIND
136+ echo "HC=$HC" >> "$GITHUB_ENV"
137+ echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
138+ echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
82− echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV
139+ echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
140+ fi
141+
83 HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
142 HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
84− echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV
143+ echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
85− echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV
144+ echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
86− echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV
145+ echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
87− echo "HEADHACKAGE=false" >> $GITHUB_ENV
146+ echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
88− echo "ARG_COMPILER=--$HCNAME --with-compiler=$HC" >> $GITHUB_ENV
147+ echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
89− echo "GHCJSARITH=0" >> $GITHUB_ENV
148+ echo "GHCJSARITH=0" >> "$GITHUB_ENV"
90 env:
149 env:
150+ HCKIND: ${{ matrix.compilerKind }}
91− CC: ${{ matrix.compiler }}
151+ HCNAME: ${{ matrix.compiler }}
152+ HCVER: ${{ matrix.compilerVersion }}
92 - name: env
153 - name: env
93 run: |
154 run: |
94 env
155 env
@@ -111,6 +172,10 @@ jobs:
111 repository hackage.haskell.org
172 repository hackage.haskell.org
112 url: http://hackage.haskell.org/
173 url: http://hackage.haskell.org/
113 EOF
174 EOF
175+ cat >> $CABAL_CONFIG <<EOF
176+ program-default-options
177+ ghc-options: $GHCJOBS +RTS -M3G -RTS
178+ EOF
114 cat $CABAL_CONFIG
179 cat $CABAL_CONFIG
115 - name: versions
180 - name: versions
116 run: |
181 run: |
@@ -149,7 +214,8 @@ jobs:
149 - name: generate cabal.project
214 - name: generate cabal.project
150 run: |
215 run: |
151 PKGDIR_postgresql_simple="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-simple-[0-9.]*')"
216 PKGDIR_postgresql_simple="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-simple-[0-9.]*')"
152− echo "PKGDIR_postgresql_simple=${PKGDIR_postgresql_simple}" >> $GITHUB_ENV
217+ echo "PKGDIR_postgresql_simple=${PKGDIR_postgresql_simple}" >> "$GITHUB_ENV"
218+ rm -f cabal.project cabal.project.local
153 touch cabal.project
219 touch cabal.project
154 touch cabal.project.local
220 touch cabal.project.local
155 echo "packages: ${PKGDIR_postgresql_simple}" >> cabal.project
221 echo "packages: ${PKGDIR_postgresql_simple}" >> cabal.project
@@ -190,7 +256,7 @@ jobs:
190 ${CABAL} -vnormal check
256 ${CABAL} -vnormal check
191 - name: haddock
257 - name: haddock
192 run: |
258 run: |
193− $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
259+ $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
194 - name: unconstrained build
260 - name: unconstrained build
195 run: |
261 run: |
196 rm -f cabal.project.local
262 rm -f cabal.project.local
test/Main.hs+3−2
@@ -137,7 +137,7 @@ testFold TestEnv{..} = do
137 xs <- readIORef ref
137 xs <- readIORef ref
138 writeIORef ref $! (a,b):xs
138 writeIORef ref $! (a,b):xs
139 xs <- readIORef ref
139 xs <- readIORef ref
140− reverse xs @?= [(a,b) | a <- [1..100], b <- [1..50]]
140+ reverse xs @?= [(a,b) | b <- [1..50], a <- [1..100]]
141
141
142 -- Make sure fold propagates our exception.
142 -- Make sure fold propagates our exception.
143 ref <- newIORef []
143 ref <- newIORef []
@@ -472,12 +472,13 @@ testCopyFailures env = testGroup "Copy failures"
472
472
473goldenTest :: TestName -> IO BL.ByteString -> TestTree
473goldenTest :: TestName -> IO BL.ByteString -> TestTree
474goldenTest testName =
474goldenTest testName =
475− goldenVsString testName (resultsDir </> fileName<.>"expected")
475+ goldenVsStringDiff testName diff (resultsDir </> fileName<.>"expected")
476 where
476 where
477 resultsDir = "test" </> "results"
477 resultsDir = "test" </> "results"
478 fileName = map normalize testName
478 fileName = map normalize testName
479 normalize c | not (isAlpha c) = '-'
479 normalize c | not (isAlpha c) = '-'
480 | otherwise = c
480 | otherwise = c
481+ diff ref new = ["diff", "-u", ref, new]
481
482
482-- | Test that we provide a sensible error message on failure
483-- | Test that we provide a sensible error message on failure
483testCopyUniqueConstraintError :: TestEnv -> TestTree
484testCopyUniqueConstraintError :: TestEnv -> TestTree
test/results/malformed-input.expected+1−1
@@ -1,4 +1,4 @@
1user error (Database.PostgreSQL.Simple.Copy.putCopyEnd: failed to parse command status
1user error (Database.PostgreSQL.Simple.Copy.putCopyEnd: failed to parse command status
2−Connection error: ERROR: invalid input syntax for integer: "z"
2+Connection error: ERROR: invalid input syntax for type integer: "z"
3CONTEXT: COPY copy_unique_constraint_error_test, line 3, column x: "z"
3CONTEXT: COPY copy_unique_constraint_error_test, line 3, column x: "z"
4)
4)