Skip to content

Commit f1d0e8e

Browse files
nix: add postgrest-with-oriole-17
1 parent 243bbb1 commit f1d0e8e

10 files changed

Lines changed: 44 additions & 17 deletions

File tree

.github/workflows/test.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ jobs:
7070
strategy:
7171
fail-fast: false
7272
matrix:
73-
pgVersion: [14, 15, 16, 17, 18]
74-
name: PG ${{ matrix.pgVersion }}
73+
pgVersion: [pg-14, pg-15, pg-16, pg-17, pg-18, oriole-17]
74+
name: ${{ matrix.pgVersion }}
7575
runs-on: ubuntu-24.04
7676
defaults:
7777
run:
@@ -84,25 +84,25 @@ jobs:
8484
uses: ./.github/actions/setup-nix
8585
with:
8686
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
87-
tools: tests.testSpec.bin tests.testObservability.bin tests.testIO.bin tests.testBigSchema.bin withTools.pg-${{ matrix.pgVersion }}.bin cabalTools.update.bin
87+
tools: tests.testSpec.bin tests.testObservability.bin tests.testIO.bin tests.testBigSchema.bin withTools.${{ matrix.pgVersion }}.bin cabalTools.update.bin
8888

8989
- run: postgrest-cabal-update
9090

9191
- name: Run spec tests
9292
if: always()
93-
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-spec
93+
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-spec
9494

9595
- name: Run observability tests
9696
if: always()
97-
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-observability
97+
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-observability
9898

9999
- name: Run IO tests
100100
if: always()
101-
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-io -vv
101+
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-io -vv
102102

103103
- name: Run IO tests on a big schema
104104
if: always()
105-
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
105+
run: postgrest-with-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
106106

107107

108108
memory:

default.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ let
5757
{ name = "pg-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
5858
{ name = "pg-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
5959
{ name = "pg-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
60+
{
61+
name = "oriole-17";
62+
postgresql = pkgs.orioledb.withPackages (p: [ p.postgis p.pg_safeupdate ]);
63+
config = "
64+
default_table_access_method = 'orioledb'
65+
shared_preload_libraries = 'orioledb'
66+
";
67+
}
6068
];
6169

6270
haskellPackages = pkgs.haskell.packages."${compiler}";

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "REST API for any Postgres database";
33

44
inputs = {
5-
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
5+
nixpkgs.url = "github:wolfgangwalther/nixpkgs/orioledb-latest";
66
};
77

88
nixConfig = {

nix/tools/withTools.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
}:
1212
let
1313
withTmpDb =
14-
{ name, postgresql }:
14+
{ name, postgresql, config ? "" }:
1515
let
1616
commandName = "postgrest-with-${name}";
17+
postgresqlConf = writeText "postgresql.conf" ("
18+
listen_addresses = ''
19+
log_statement = all
20+
" + config);
1721
in
1822
checkedShellScript
1923
{
@@ -72,6 +76,10 @@ let
7276
TZ=$PGTZ initdb --no-locale --encoding=UTF8 --nosync -U postgres --auth=trust \
7377
>> "$setuplog"
7478
79+
# Append our own config to the one initdb created to avoid replacing
80+
# default values created by the latter.
81+
cat ${postgresqlConf} >> "$tmpdir/db/postgresql.conf"
82+
7583
log "Starting the database cluster..."
7684
7785
# Instead of listening on a local port, we will listen on a unix domain socket.
@@ -80,7 +88,7 @@ let
8088
# On MacOS, it's 104 chars
8189
# See: https://serverfault.com/questions/641347/check-if-a-path-exceeds-maximum-for-unix-domain-socket
8290
83-
pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $PGHOST -c log_statement=\"all\" " \
91+
pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c hba_file=$HBA_FILE -k $PGHOST " \
8492
>> "$setuplog"
8593
8694
log "Creating a minimally privileged $PGUSER connection role..."
@@ -106,7 +114,7 @@ let
106114
log "Starting replica on $replica_host"
107115
108116
# We set a low max_standby_streaming_delay to make the replication conflict fail faster in tests (otherwise it waits for the default 30s)
109-
pg_ctl -D "$replica_dir" -l "$replica_dblog" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $replica_host -c log_statement=\"all\" -c max_standby_streaming_delay=\"3s\" " \
117+
pg_ctl -D "$replica_dir" -l "$replica_dblog" -w start -o "-F -c hba_file=$HBA_FILE -k $replica_host-c max_standby_streaming_delay=\"3s\" " \
110118
>> "$setuplog"
111119
112120
>&2 echo "${commandName}: Replica enabled. You can connect to it with: psql 'postgres:///$PGDATABASE?host=$replica_host' -U postgres"

test/io/fixtures/load.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
\set ON_ERROR_STOP on
44

5+
\ir ../../orioledb.sql
56
\ir database.sql
67
\ir db_config.sql
78
\ir roles.sql

test/load/fixtures.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
\ir ../orioledb.sql
2+
13
CREATE ROLE postgrest_test_anonymous;
24
CREATE ROLE postgrest_test_author;
35
GRANT postgrest_test_anonymous TO :"PGUSER";

test/observability/fixtures/load.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
\set ON_ERROR_STOP on
44

5+
\ir ../../orioledb.sql
56
\ir database.sql
67
\ir roles.sql
78
\ir schema.sql

test/orioledb.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SELECT EXISTS (SELECT * FROM pg_available_extensions WHERE name = 'orioledb') AS is_orioledb_available \gset
2+
3+
\if :is_orioledb_available
4+
CREATE SCHEMA orioledb;
5+
CREATE EXTENSION orioledb WITH SCHEMA orioledb;
6+
\endif

test/spec/fixtures/load.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
\set ON_ERROR_STOP on
44

5+
\ir ../../orioledb.sql
56
\ir database.sql
67
\ir roles.sql
78
\ir schema.sql

0 commit comments

Comments
 (0)