Skip to content

Commit de4050c

Browse files
committed
feat(ci): matrix
1 parent 9ddb29a commit de4050c

File tree

3 files changed

+52
-45
lines changed

3 files changed

+52
-45
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ on:
66
branches:
77
- main
88

9-
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
129

1310
jobs:
1411
test:
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ matrix.pg }}-${{ github.ref }}
14+
cancel-in-progress: true
1515
strategy:
1616
matrix:
1717
pg:
18-
- v17
18+
- postgresql
19+
- postgresql_17
20+
- postgresql_16
21+
- postgresql_15
22+
- postgresql_14
1923
runs-on: namespace-profile-cached-amd64-lg
2024
steps:
2125
- uses: actions/checkout@v4
@@ -34,6 +38,6 @@ jobs:
3438
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
3539
- run: nix flake check
3640
- run: nix build .#${{ matrix.pg }}
37-
- run: nix run .#devenv -- up -D
38-
- run: nix develop -c pg_prove test.sql
39-
- run: nix run .#devenv down
41+
- run: nix run .#${{ matrix.pg }}-compose -- up -D
42+
- run: nix develop .#${{ matrix.pg }} -c pg_prove test.sql
43+
- run: nix run .#${{ matrix.pg }}-compose down

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ select jsonb_patch(
1313
(1 row)
1414
```
1515

16-
See [./test.sql] for more examples.
16+
Compatible (I think) with PostgreSQL 14+.
17+
See [./test.sql](./test.sql) for more examples.
1718
I have not yet written tests for A.11-A.15 from the RFC.

flake.nix

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,52 @@
3535
pkgs,
3636
system,
3737
...
38-
}: {
39-
devShells.default = pkgs.mkShell {
40-
name = "pg_jsonpatch";
41-
buildInputs = with pkgs; [
42-
postgresql
43-
perlPackages.TAPParserSourceHandlerpgTAP # pg_prove
44-
];
45-
PGDATA = "data/default";
46-
PGHOST = "localhost";
47-
PGDATABASE = "postgres";
48-
};
49-
38+
}: let
5039
packages = {
5140
default = pkgs.callPackage ./package.nix {inherit (pkgs) postgresql;};
52-
v17 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_17;};
53-
v16 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_16;};
54-
v15 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_15;};
55-
v14 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_14;};
41+
postgresql_17 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_17;};
42+
postgresql_16 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_16;};
43+
postgresql_15 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_15;};
44+
postgresql_14 = pkgs.callPackage ./package.nix {postgresql = pkgs.postgresql_14;};
5645
};
46+
in {
47+
devShells = builtins.mapAttrs (name: drv:
48+
pkgs.mkShell {
49+
name = "pg_jsonpatch";
50+
buildInputs = [
51+
drv.passthru.postgresql
52+
pkgs.perlPackages.TAPParserSourceHandlerpgTAP # pg_prove
53+
];
54+
PGDATA = "data/${name}";
55+
PGHOST = "localhost";
56+
PGDATABASE = "postgres";
57+
})
58+
packages;
5759

58-
process-compose.devenv = {
59-
imports = [
60-
inputs.services.processComposeModules.default
61-
];
60+
inherit packages;
6261

63-
cli.options.no-server = false;
62+
process-compose = lib.mapAttrs' (name: drv:
63+
lib.nameValuePair "${name}-compose" {
64+
imports = [
65+
inputs.services.processComposeModules.default
66+
];
6467

65-
services.postgres.default = {
66-
enable = true;
67-
extensions = exts:
68-
with exts; [
69-
config.packages.default
70-
pgtap
71-
];
72-
initialScript.after = ''
73-
create extension pgtap;
74-
'';
75-
package = config.packages.default.postgresql;
76-
settings = {
77-
log_statement = "all";
78-
logging_collector = false;
68+
cli.options.no-server = false;
69+
70+
services.postgres.${name} = {
71+
enable = true;
72+
extensions = exts: [drv exts.pgtap];
73+
initialScript.after = ''
74+
create extension pgtap;
75+
'';
76+
package = drv.passthru.postgresql;
77+
settings = {
78+
log_statement = "all";
79+
logging_collector = false;
80+
};
7981
};
80-
};
81-
};
82+
})
83+
packages;
8284
};
8385
};
8486
}

0 commit comments

Comments
 (0)