Skip to content

Commit 16b5fbc

Browse files
committed
feat: run pg_regress tests during build
We don't recompile the extension using pgx with dev/debug symbols, but we do run the pg_regress tests to ensure everything is working correctly.
1 parent a1ae715 commit 16b5fbc

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

nix/ext/pg_graphql/default.nix

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,25 @@ let
7777
create_control_files
7878
'';
7979

80+
pgrxBinaryName = if builtins.compareVersions "0.7.4" pgrxVersion >= 0 then "pgx" else "pgrx";
81+
8082
preCheck = ''
81-
export PGRX_HOME=$(mktemp -d)
82-
export NIX_PGLIBDIR=$PGRX_HOME/${lib.versions.major postgresql.version}/lib
83-
${lib.getExe rsync} --chmod=ugo+w -a ${postgresql}/ ${postgresql.lib}/ $PGRX_HOME/${lib.versions.major postgresql.version}/
84-
cargo pgrx init --pg${lib.versions.major postgresql.version} $PGRX_HOME/${lib.versions.major postgresql.version}/bin/pg_config
83+
export PGRX_HOME="$(mktemp -d)"
84+
export PG_VERSION="${lib.versions.major postgresql.version}"
85+
export NIX_PGLIBDIR="$PGRX_HOME/$PG_VERSION/lib"
86+
export PATH="$PGRX_HOME/$PG_VERSION/bin:$PATH"
87+
${lib.getExe rsync} --chmod=ugo+w -a ${postgresql}/ ${postgresql.lib}/ "$PGRX_HOME/$PG_VERSION/"
88+
cargo ${pgrxBinaryName} init "--pg$PG_VERSION" "$PGRX_HOME/$PG_VERSION/bin/pg_config"
89+
cargo ${pgrxBinaryName} install --release --features "pg$PG_VERSION"
8590
'';
8691

87-
doCheck = false;
92+
doCheck = true;
93+
94+
checkPhase = ''
95+
runHook preCheck
96+
bash -x ./bin/installcheck
97+
runHook postCheck
98+
'';
8899

89100
meta = with lib; {
90101
description = "GraphQL support for PostreSQL";

0 commit comments

Comments
 (0)