Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 51 additions & 18 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.19.20250506
# version: 0.19.20250821
#
# REGENDATA ("0.19.20250506",["github","--config=cabal.haskell-ci","cabal.project"])
# REGENDATA ("0.19.20250821",["github","--config=cabal.haskell-ci","cabal.project"])
#
name: Haskell-CI
on:
Expand Down Expand Up @@ -38,6 +38,11 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.14.0.20250819
compilerKind: ghc
compilerVersion: 9.14.0.20250819
setup-method: ghcup-prerelease
allow-failure: false
- compiler: ghc-9.12.2
compilerKind: ghc
compilerVersion: 9.12.2
Expand All @@ -53,9 +58,9 @@ jobs:
compilerVersion: 9.8.4
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.6
- compiler: ghc-9.6.7
compilerKind: ghc
compilerVersion: 9.6.6
compilerVersion: 9.6.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.8
Expand All @@ -68,16 +73,6 @@ jobs:
compilerVersion: 9.2.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
compilerKind: ghc
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.10.7
compilerKind: ghc
compilerVersion: 8.10.7
setup-method: ghcup
allow-failure: false
fail-fast: false
steps:
- name: apt-get install
Expand All @@ -91,8 +86,8 @@ jobs:
chmod a+x "$HOME/.ghcup/bin/ghcup"
- name: Install cabal-install
run: |
"$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
"$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
- name: Install GHC (GHCup)
if: matrix.setup-method == 'ghcup'
run: |
Expand All @@ -107,6 +102,21 @@ jobs:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
HCVER: ${{ matrix.compilerVersion }}
- name: Install GHC (GHCup prerelease)
if: matrix.setup-method == 'ghcup-prerelease'
run: |
"$HOME/.ghcup/bin/ghcup" config add-release-channel prereleases
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
HCVER: ${{ matrix.compilerVersion }}
- name: Set PATH and environment variables
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
Expand All @@ -117,7 +127,7 @@ jobs:
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
if [ $((HCNUMVER >= 91400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
env:
HCKIND: ${{ matrix.compilerKind }}
Expand Down Expand Up @@ -145,6 +155,18 @@ jobs:
repository hackage.haskell.org
url: http://hackage.haskell.org/
EOF
if $HEADHACKAGE; then
cat >> $CABAL_CONFIG <<EOF
repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
key-threshold: 3
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override
EOF
fi
cat >> $CABAL_CONFIG <<EOF
program-default-options
ghc-options: $GHCJOBS +RTS -M3G -RTS
Expand Down Expand Up @@ -193,9 +215,20 @@ jobs:
touch cabal.project.local
echo "packages: ${PKGDIR_hpqtypes_extras}" >> cabal.project
echo "package hpqtypes-extras" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package hpqtypes-extras" >> cabal.project ; fi
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
echo "package hpqtypes-extras" >> cabal.project
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
cat >> cabal.project <<EOF
source-repository-package
type: git
location: https://github.com/scrive/hpqtypes
tag: 8feaea012d5182574f9fa2c2ef2ca4654e062648
EOF
if $HEADHACKAGE; then
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
fi
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(hpqtypes-extras)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
Expand Down
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.19.0.0 (2025-??-??)
* Compatibility with `hpqtypes` >= 0.13.0.0.

# hpqtypes-extras-1.18.0.0 (2025-06-02)
* Don't consider invalid indexes when checking consistency of the database.
* Improve handling of lock failures during migrations.
Expand Down
2 changes: 0 additions & 2 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ branches: master
doctest: False
tests: True
postgresql: True

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

source-repository-package
type: git
location: https://github.com/scrive/hpqtypes
tag: 8feaea012d5182574f9fa2c2ef2ca4654e062648
8 changes: 4 additions & 4 deletions hpqtypes-extras.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: hpqtypes-extras
version: 1.18.0.0
version: 1.19.0.0
synopsis: Extra utilities for hpqtypes library
description: The following extras for hpqtypes library:
.
Expand All @@ -20,7 +20,7 @@ maintainer: Andrzej Rybczak <[email protected]>,
copyright: Scrive AB
category: Database
build-type: Simple
tested-with: GHC == { 8.10.7, 9.0.2, 9.2.8, 9.4.8, 9.6.6, 9.8.4, 9.10.2, 9.12.2 }
tested-with: GHC == { 9.2.8, 9.4.8, 9.6.7, 9.8.4, 9.10.2, 9.12.2, 9.14.1 }

Source-repository head
Type: git
Expand Down Expand Up @@ -82,8 +82,8 @@ library
other-modules: Database.PostgreSQL.PQTypes.Checks.Util
, Database.PostgreSQL.PQTypes.Utils.NubList

build-depends: base >= 4.13 && < 5
, hpqtypes >= 1.8.0.0
build-depends: base >= 4.16 && < 5
, hpqtypes >= 1.13.0.0
, base16-bytestring >= 0.1
, bytestring >= 0.10
, containers >= 0.5
Expand Down
7 changes: 2 additions & 5 deletions src/Database/PostgreSQL/PQTypes/Checks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -855,9 +855,6 @@ checkDBConsistency
-> [Migration m]
-> m ()
checkDBConsistency options domains enums tablesWithVersions migrations = do
autoTransaction <- tsAutoTransaction <$> getTransactionSettings
unless autoTransaction $ do
error "checkDBConsistency: tsAutoTransaction setting needs to be True"
-- Check the validity of the migrations list.
validateMigrations
validateDropTableMigrations
Expand Down Expand Up @@ -1135,7 +1132,7 @@ checkDBConsistency options domains enums tablesWithVersions migrations = do
-- because using 'commit' function automatically starts another
-- transaction. We don't want that as concurrent creation of index
-- won't run inside a transaction.
bracket_ (runSQL_ "COMMIT") (runSQL_ "BEGIN") $ do
unsafeWithoutTransaction $ do
-- If migration was run before but creation of an index failed, index
-- will be left in the database in an inactive state, so when we
-- rerun, we need to remove it first (see
Expand All @@ -1151,7 +1148,7 @@ checkDBConsistency options domains enums tablesWithVersions migrations = do
-- because using 'commit' function automatically starts another
-- transaction. We don't want that as concurrent dropping of index
-- won't run inside a transaction.
bracket_ (runSQL_ "COMMIT") (runSQL_ "BEGIN") $ do
unsafeWithoutTransaction $ do
runQuery_ (sqlDropIndexConcurrently tname idx)
updateTableVersion
ModifyColumnMigration tableName cursorSql updateSql batchSize -> do
Expand Down
4 changes: 2 additions & 2 deletions src/Database/PostgreSQL/PQTypes/Model/Trigger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module Database.PostgreSQL.PQTypes.Model.Trigger
) where

import Data.Bits (testBit)
import Data.Foldable (foldl')
import Data.Foldable qualified as F
import Data.Int
import Data.Monoid.Utils
import Data.Set (Set)
Expand Down Expand Up @@ -320,7 +320,7 @@ getDBTriggers tableName = do
-- the same bit set in the underlying tgtype bit field.
trgEvents :: Set TriggerEvent
trgEvents =
foldl'
F.foldl'
( \set (mask, event) ->
if testBit tgtype mask
then
Expand Down
11 changes: 4 additions & 7 deletions test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1839,13 +1839,10 @@ migrationTest5 connSource =
sqlSetList "name" $ (\i -> "bank" <> show i) <$> numbers
sqlSetList "location" $ (\i -> "location" <> show i) <$> numbers

-- Explicitly vacuum to update the catalog so that getting the row number estimates
-- works. The bracket_ trick is here because vacuum can't run inside a transaction
-- block, which every test runs in.
bracket_
(runSQL_ "COMMIT")
(runSQL_ "BEGIN")
(runSQL_ "VACUUM bank")
-- Explicitly vacuum to update the catalog so that getting the row number
-- estimates works. Note that vacuum can't run inside a transaction block,
-- which every test runs in.
unsafeWithoutTransaction $ runSQL_ "VACUUM bank"

forM_ (zip4 tables migrations steps assertions) $
\(table, migration, step', assertion) -> do
Expand Down