git.iko.soy/typeable/postgresql-simple
on master help sign in
Try tests with postgres-14
commitaa0f427d0f1aeba4d9ad7dd4b05ff7ce96fba9d8 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 9 Oct 2022, 21:04 (4 years ago) parent5f58b8e
3 files changed+99−32
.github/workflows/haskell-ci.yml+95−29 test/Main.hs+3−2 test/results/malformed-input.expected+1−1
.github/workflows/haskell-ci.yml+95−29
@@ -8,9 +8,9 @@
88#
99# For more information, see https://github.com/haskell-CI/haskell-ci
1010#
11−# version: 0.12
11+# version: 0.15.20221009
1212#
13−# REGENDATA ("0.12",["github","cabal.project"])
13+# REGENDATA ("0.15.20221009",["github","cabal.project"])
1414#
1515name: Haskell-CI
1616on:
@@ -23,12 +23,14 @@ on:
2323jobs:
2424 linux:
2525 name: Haskell-CI - Linux - ${{ matrix.compiler }}
26− runs-on: ubuntu-18.04
26+ runs-on: ubuntu-20.04
27+ timeout-minutes:
28+ 60
2729 container:
2830 image: buildpack-deps:bionic
2931 services:
3032 postgres:
31− image: postgres:10
33+ image: postgres:14
3234 env:
3335 POSTGRES_PASSWORD: postgres
3436 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
@@ -36,59 +38,118 @@ jobs:
3638 strategy:
3739 matrix:
3840 include:
41+ - compiler: ghc-9.2.1
42+ compilerKind: ghc
43+ compilerVersion: 9.2.1
44+ setup-method: ghcup
45+ allow-failure: false
3946 - compiler: ghc-9.0.1
47+ compilerKind: ghc
48+ compilerVersion: 9.0.1
49+ setup-method: hvr-ppa
4050 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
4255 allow-failure: false
4356 - compiler: ghc-8.8.4
57+ compilerKind: ghc
58+ compilerVersion: 8.8.4
59+ setup-method: hvr-ppa
4460 allow-failure: false
4561 - compiler: ghc-8.6.5
62+ compilerKind: ghc
63+ compilerVersion: 8.6.5
64+ setup-method: hvr-ppa
4665 allow-failure: false
4766 - compiler: ghc-8.4.4
67+ compilerKind: ghc
68+ compilerVersion: 8.4.4
69+ setup-method: hvr-ppa
4870 allow-failure: false
4971 - compiler: ghc-8.2.2
72+ compilerKind: ghc
73+ compilerVersion: 8.2.2
74+ setup-method: hvr-ppa
5075 allow-failure: false
5176 - compiler: ghc-8.0.2
77+ compilerKind: ghc
78+ compilerVersion: 8.0.2
79+ setup-method: hvr-ppa
5280 allow-failure: false
5381 - compiler: ghc-7.10.3
82+ compilerKind: ghc
83+ compilerVersion: 7.10.3
84+ setup-method: hvr-ppa
5485 allow-failure: false
5586 - compiler: ghc-7.8.4
87+ compilerKind: ghc
88+ compilerVersion: 7.8.4
89+ setup-method: hvr-ppa
5690 allow-failure: false
5791 - compiler: ghc-7.6.3
92+ compilerKind: ghc
93+ compilerVersion: 7.6.3
94+ setup-method: hvr-ppa
5895 allow-failure: false
5996 fail-fast: false
6097 steps:
6198 - name: apt
6299 run: |
63100 apt-get update
64− apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common
65− apt-add-repository -y 'ppa:hvr/ghc'
66− apt-get update
67− apt-get install -y $CC cabal-install-3.4
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
109+ apt-add-repository -y 'ppa:hvr/ghc'
110+ apt-get update
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
68117 env:
69− CC: ${{ matrix.compiler }}
118+ HCKIND: ${{ matrix.compilerKind }}
119+ HCNAME: ${{ matrix.compiler }}
120+ HCVER: ${{ matrix.compilerVersion }}
70121 - name: Set PATH and environment variables
71122 run: |
72123 echo "$HOME/.cabal/bin" >> $GITHUB_PATH
73− echo "LANG=C.UTF-8" >> $GITHUB_ENV
74− echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV
75− echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV
76− HCDIR=$(echo "/opt/$CC" | sed 's/-/\//')
77− HCNAME=ghc
78− HC=$HCDIR/bin/$HCNAME
79− echo "HC=$HC" >> $GITHUB_ENV
80− echo "HCPKG=$HCDIR/bin/$HCNAME-pkg" >> $GITHUB_ENV
81− echo "HADDOCK=$HCDIR/bin/haddock" >> $GITHUB_ENV
82− echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV
124+ echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
125+ echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
126+ echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
127+ HCDIR=/opt/$HCKIND/$HCVER
128+ if [ "${{ matrix.setup-method }}" = ghcup ]; then
129+ HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
130+ echo "HC=$HC" >> "$GITHUB_ENV"
131+ echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$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"
139+ echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
140+ fi
141+
83142 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
85− echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV
86− echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV
87− echo "HEADHACKAGE=false" >> $GITHUB_ENV
88− echo "ARG_COMPILER=--$HCNAME --with-compiler=$HC" >> $GITHUB_ENV
89− echo "GHCJSARITH=0" >> $GITHUB_ENV
143+ echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
144+ echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
145+ echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
146+ echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
147+ echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
148+ echo "GHCJSARITH=0" >> "$GITHUB_ENV"
90149 env:
91− CC: ${{ matrix.compiler }}
150+ HCKIND: ${{ matrix.compilerKind }}
151+ HCNAME: ${{ matrix.compiler }}
152+ HCVER: ${{ matrix.compilerVersion }}
92153 - name: env
93154 run: |
94155 env
@@ -111,6 +172,10 @@ jobs:
111172 repository hackage.haskell.org
112173 url: http://hackage.haskell.org/
113174 EOF
175+ cat >> $CABAL_CONFIG <<EOF
176+ program-default-options
177+ ghc-options: $GHCJOBS +RTS -M3G -RTS
178+ EOF
114179 cat $CABAL_CONFIG
115180 - name: versions
116181 run: |
@@ -149,7 +214,8 @@ jobs:
149214 - name: generate cabal.project
150215 run: |
151216 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
153219 touch cabal.project
154220 touch cabal.project.local
155221 echo "packages: ${PKGDIR_postgresql_simple}" >> cabal.project
@@ -190,7 +256,7 @@ jobs:
190256 ${CABAL} -vnormal check
191257 - name: haddock
192258 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
194260 - name: unconstrained build
195261 run: |
196262 rm -f cabal.project.local
test/Main.hs+3−2
@@ -137,7 +137,7 @@ testFold TestEnv{..} = do
137137 xs <- readIORef ref
138138 writeIORef ref $! (a,b):xs
139139 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]]
141141
142142 -- Make sure fold propagates our exception.
143143 ref <- newIORef []
@@ -472,12 +472,13 @@ testCopyFailures env = testGroup "Copy failures"
472472
473473goldenTest :: TestName -> IO BL.ByteString -> TestTree
474474goldenTest testName =
475− goldenVsString testName (resultsDir </> fileName<.>"expected")
475+ goldenVsStringDiff testName diff (resultsDir </> fileName<.>"expected")
476476 where
477477 resultsDir = "test" </> "results"
478478 fileName = map normalize testName
479479 normalize c | not (isAlpha c) = '-'
480480 | otherwise = c
481+ diff ref new = ["diff", "-u", ref, new]
481482
482483-- | Test that we provide a sensible error message on failure
483484testCopyUniqueConstraintError :: TestEnv -> TestTree
test/results/malformed-input.expected+1−1
@@ -1,4 +1,4 @@
11user 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"
33CONTEXT: COPY copy_unique_constraint_error_test, line 3, column x: "z"
44)