Skip to content

Commit

Permalink
Add support for GHC 9.6 (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
arybczak authored Apr 4, 2023
1 parent b30859c commit 296f7f1
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 74 deletions.
117 changes: 53 additions & 64 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# This GitHub workflow config has been generated by a script via
#
# haskell-ci 'github' '--config=cabal.haskell-ci' 'hpqtypes-extras.cabal'
# haskell-ci 'github' '--config=cabal.haskell-ci' 'cabal.project'
#
# To regenerate the script (for example after adjusting tested-with) run
#
# haskell-ci regenerate
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.15.202211107
# version: 0.15.20230321
#
# REGENDATA ("0.15.202211107",["github","--config=cabal.haskell-ci","hpqtypes-extras.cabal"])
# REGENDATA ("0.15.20230321",["github","--config=cabal.haskell-ci","cabal.project"])
#
name: Haskell-CI
on:
Expand Down Expand Up @@ -38,30 +38,42 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.4.2
- compiler: ghc-9.6.1
compilerKind: ghc
compilerVersion: 9.4.2
compilerVersion: 9.6.1
setup-method: ghcup
allow-failure: false
postgres-version: "11"
- compiler: ghc-9.4.2
- compiler: ghc-9.6.1
compilerKind: ghc
compilerVersion: 9.4.2
compilerVersion: 9.6.1
setup-method: ghcup
allow-failure: false
postgres-version: "14"
- compiler: ghc-9.2.4
postgres-version: "15"
- compiler: ghc-9.4.4
compilerKind: ghc
compilerVersion: 9.2.4
compilerVersion: 9.4.4
setup-method: ghcup
allow-failure: false
postgres-version: "11"
- compiler: ghc-9.2.4
- compiler: ghc-9.4.4
compilerKind: ghc
compilerVersion: 9.2.4
compilerVersion: 9.4.4
setup-method: ghcup
allow-failure: false
postgres-version: "14"
postgres-version: "15"
- compiler: ghc-9.2.7
compilerKind: ghc
compilerVersion: 9.2.7
setup-method: ghcup
allow-failure: false
postgres-version: "11"
- compiler: ghc-9.2.7
compilerKind: ghc
compilerVersion: 9.2.7
setup-method: ghcup
allow-failure: false
postgres-version: "15"
- compiler: ghc-9.0.2
compilerKind: ghc
compilerVersion: 9.0.2
Expand All @@ -73,7 +85,7 @@ jobs:
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
postgres-version: "14"
postgres-version: "15"
- compiler: ghc-8.10.7
compilerKind: ghc
compilerVersion: 8.10.7
Expand All @@ -85,40 +97,30 @@ jobs:
compilerVersion: 8.10.7
setup-method: ghcup
allow-failure: false
postgres-version: "14"
postgres-version: "15"
- compiler: ghc-8.8.4
compilerKind: ghc
compilerVersion: 8.8.4
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
postgres-version: "11"
- compiler: ghc-8.8.4
compilerKind: ghc
compilerVersion: 8.8.4
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
postgres-version: "14"
postgres-version: "15"
fail-fast: false
steps:
- name: apt
run: |
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
if [ "${{ matrix.setup-method }}" = ghcup ]; then
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
else
apt-add-repository -y 'ppa:hvr/ghc'
apt-get update
apt-get install -y "$HCNAME"
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -130,20 +132,11 @@ jobs:
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$HCKIND/$HCVER
if [ "${{ matrix.setup-method }}" = ghcup ]; then
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
else
HC=$HCDIR/bin/$HCKIND
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
fi
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -190,11 +183,6 @@ jobs:
- name: update cabal index
run: |
$CABAL v2-update -v
- name: cache (tools)
uses: actions/cache@v2
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-tools-ca962b92
path: ~/.haskell-ci-tools
- name: install cabal-plan
run: |
mkdir -p $HOME/.cabal/bin
Expand All @@ -204,12 +192,8 @@ jobs:
rm -f cabal-plan.xz
chmod a+x $HOME/.cabal/bin/cabal-plan
cabal-plan --version
- name: install doctest
run: |
$CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.20'
doctest --version
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: source
- name: initial cabal.project for sdist
Expand All @@ -236,6 +220,9 @@ jobs:
echo "package hpqtypes-extras" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
allow-newer: *:base
allow-newer: *:ghc-prim
allow-newer: *:template-haskell
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(hpqtypes-extras)$/; }' >> cabal.project.local
cat cabal.project
Expand All @@ -244,8 +231,8 @@ jobs:
run: |
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
cabal-plan
- name: cache
uses: actions/cache@v2
- name: restore cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
Expand All @@ -263,18 +250,20 @@ jobs:
- name: tests
run: |
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
- name: doctest
run: |
cd ${PKGDIR_hpqtypes_extras} || false
doctest -XHaskell2010 -XBangPatterns -XDeriveDataTypeable -XExistentialQuantification -XFlexibleContexts -XGeneralizedNewtypeDeriving -XLambdaCase -XMultiWayIf -XOverloadedStrings -XRankNTypes -XRecordWildCards -XScopedTypeVariables -XStandaloneDeriving -XTupleSections -XTypeApplications -XTypeFamilies -XUndecidableInstances -XViewPatterns src
- name: cabal check
run: |
cd ${PKGDIR_hpqtypes_extras} || false
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
- name: unconstrained build
run: |
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: save cache
uses: actions/cache/save@v3
if: always()
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/TAGS
/dist/
/dist-newstyle/
cabal.project
TAGS
TAGS.mtime
dist/
dist-newstyle/
cabal.project.local
.ghc.environment.*
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# hpqtypes-extras-1.16.3.1 (2023-??-??)
* Add support for GHC 9.6.

# hpqtypes-extras-1.16.3.0 (2023-01-25)
* Add support for `WITH MATERIALIZED` with backward compatibility.
* Add `sqlWhereEqualsAny`.
Expand Down
8 changes: 5 additions & 3 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
branches: master
benchmarks: True
doctest: True
doctest: False
tests: True
postgresql: True
postgresql-versions: 11 14

postgresql-versions: 11 15

ghcup-jobs: True
6 changes: 6 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
packages: .

-- GHC 9.6
allow-newer: *:base
, *:ghc-prim
, *:template-haskell
4 changes: 2 additions & 2 deletions hpqtypes-extras.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: hpqtypes-extras
version: 1.16.3.0
version: 1.16.3.1
synopsis: Extra utilities for hpqtypes library
description: The following extras for hpqtypes library:
.
Expand All @@ -20,7 +20,7 @@ maintainer: Andrzej Rybczak <andrzej@rybczak.net>,
copyright: Scrive AB
category: Database
build-type: Simple
tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.2
tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.4 || ==9.6.1

Source-repository head
Type: git
Expand Down
3 changes: 2 additions & 1 deletion src/Database/PostgreSQL/PQTypes/Checks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ module Database.PostgreSQL.PQTypes.Checks (

import Control.Arrow ((&&&))
import Control.Concurrent (threadDelay)
import Control.Monad
import Control.Monad.Catch
import Control.Monad.Reader
import Data.Int
import Data.Function (on)
import Data.Function
import Data.List (partition)
import Data.Maybe
import Data.Monoid.Utils
Expand Down
2 changes: 2 additions & 0 deletions src/Database/PostgreSQL/PQTypes/Deriving.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Data.Map.Strict (Map)
import Data.Text (Text)
import Data.Typeable
import Database.PostgreSQL.PQTypes
import Foreign.Storable
import qualified Data.Map.Strict as Map

-- | Helper newtype to be used with @deriving via@ to derive @(PQFormat, ToSQL,
Expand Down Expand Up @@ -93,6 +94,7 @@ instance

instance
( EnumEncoding a
, Storable (PQBase (EnumBase a))
, PQFormat (EnumBase a)
, FromSQL (EnumBase a)
, Show (EnumBase a)
Expand Down

0 comments on commit 296f7f1

Please sign in to comment.