Skip to content
Merged
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
33 changes: 15 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build-test-xpg-core:
runs-on: blacksmith-8vcpu-ubuntu-2404
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
fi

build-test-xpg:
runs-on: blacksmith-8vcpu-ubuntu-2404
runs-on: blacksmith-4vcpu-ubuntu-2404
strategy:
matrix:
pg-version: ['12', '13', '14', '15', '16', '17', '18']
Expand All @@ -74,36 +74,33 @@ jobs:
name: nxpg
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Build xpg
run: nix-build -A xpg

- name: Install xpg and GCC
- name: Install GCC
run: |
nix profile install .#xpg nixpkgs#gcc14
nix profile install nixpkgs#gcc14
echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"

- name: Build postgres extension
run: |
cd examples/hello
xpg -v ${{ matrix.pg-version }} build
nix run .#xpg${{ matrix.pg-version }} -- build

- name: Test postgres extension
run: |
cd examples/hello
xpg -v ${{ matrix.pg-version }} psql -v ON_ERROR_STOP=1 -c "SELECT true;"
xpg -v ${{ matrix.pg-version }} psql -v ON_ERROR_STOP=1 -c "SELECT true;"
xpg -v ${{ matrix.pg-version }} test
xpg -v ${{ matrix.pg-version }} pgbench -n -c 1 -T 1 -f bench/query.sql
nix run .#xpg${{ matrix.pg-version }} -- psql -v ON_ERROR_STOP=1 -c "SELECT true;"
nix run .#xpg${{ matrix.pg-version }} -- psql -v ON_ERROR_STOP=1 -c "SELECT true;"
nix run .#xpg${{ matrix.pg-version }} -- test
nix run .#xpg${{ matrix.pg-version }} -- pgbench -n -c 1 -T 1 -f bench/query.sql

# test for options argument
xpg -v ${{ matrix.pg-version }} --options "-c work_mem=8MB" psql -c "DO \$\$ BEGIN ASSERT current_setting('work_mem') = '8MB'; END \$\$;"
nix run .#xpg${{ matrix.pg-version }} -- --options "-c work_mem=8MB" psql -c "DO \$\$ BEGIN ASSERT current_setting('work_mem') = '8MB'; END \$\$;"

# test for cassert enabled build
xpg -v ${{ matrix.pg-version }} --cassert psql -c "DO \$\$ BEGIN ASSERT current_setting('debug_assertions') = 'on'; END \$\$;"
nix run .#xpg${{ matrix.pg-version }} -- --cassert psql -c "DO \$\$ BEGIN ASSERT current_setting('debug_assertions') = 'on'; END \$\$;"

# test for pg core test
if [ "${{ matrix.pg-version }}" -ge 15 ]; then
xpg -v ${{ matrix.pg-version }} test-core
nix run .#xpg${{ matrix.pg-version }} -- test-core
fi

- if: ${{ failure() }}
Expand All @@ -115,13 +112,13 @@ jobs:
- name: Upload to cachix
run: |
set -euo pipefail
result=$(nix-build -A xpg)
result=$(nix-build -A xpg${{ matrix.pg-version }})
if [ "${GITHUB_REF}" = 'refs/heads/master' ]; then
echo "$result" | cachix push nxpg
fi

test-nix-expressions:
runs-on: blacksmith-8vcpu-ubuntu-2404
runs-on: blacksmith-4vcpu-ubuntu-2404

steps:
- uses: actions/checkout@v4
Expand All @@ -142,7 +139,7 @@ jobs:
run: |
nix-build tests
cd examples/hello
../../result/bin/xpg -v 15 psql -v ON_ERROR_STOP=1 -c "CREATE EXTENSION plpgsql_check;"
../../result/bin/xpg17 psql -v ON_ERROR_STOP=1 -c "CREATE EXTENSION plpgsql_check;"

build-on-macos:
runs-on: blacksmith-6vcpu-macos-15
Expand Down
24 changes: 21 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@
in
xpgPkgs
// {
default = xpgPkgs.xpg;
default = xpgPkgs.xpg17;

xpg12 = xpgPkgs.xpg12;
xpg13 = xpgPkgs.xpg13;
xpg14 = xpgPkgs.xpg14;
xpg15 = xpgPkgs.xpg15;
xpg16 = xpgPkgs.xpg16;
xpg17 = xpgPkgs.xpg17;
xpg18 = xpgPkgs.xpg18;
xpg19 = xpgPkgs.xpg19;
}
);

Expand All @@ -58,8 +67,17 @@
};
in
{
default = mkApp "xpg" xpgPkgs.xpg;
xpg = mkApp "xpg" xpgPkgs.xpg;
default = mkApp "xpg" xpgPkgs.xpg17;

xpg12 = mkApp "xpg12" xpgPkgs.xpg12;
xpg13 = mkApp "xpg13" xpgPkgs.xpg13;
xpg14 = mkApp "xpg14" xpgPkgs.xpg14;
xpg15 = mkApp "xpg15" xpgPkgs.xpg15;
xpg16 = mkApp "xpg16" xpgPkgs.xpg16;
xpg17 = mkApp "xpg17" xpgPkgs.xpg17;
xpg18 = mkApp "xpg18" xpgPkgs.xpg18;
xpg19 = mkApp "xpg19" xpgPkgs.xpg19;

xpg-core = mkApp "xpg-core" xpgPkgs.xpg-core;
}
);
Expand Down
12 changes: 11 additions & 1 deletion nix/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ let
};
in
{
inherit xpg;
xpg = xpg;

xpg12 = xpg.forVersions { versions = [ "12" ]; };
xpg13 = xpg.forVersions { versions = [ "13" ]; };
xpg14 = xpg.forVersions { versions = [ "14" ]; };
xpg15 = xpg.forVersions { versions = [ "15" ]; };
xpg16 = xpg.forVersions { versions = [ "16" ]; };
xpg17 = xpg.forVersions { versions = [ "17" ]; };
xpg18 = xpg.forVersions { versions = [ "18" ]; };
xpg19 = xpg.forVersions { versions = [ "19" ]; };

xpg-core = pkgs.callPackage ./xpg-core.nix {
inherit ourPg checked-shell-script;
};
Expand Down
2 changes: 1 addition & 1 deletion nix/xpg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let
xpg =
checked-shell-script
{
name = "xpg";
name = "xpg${defaultVersion}";
docs = "Develop native PostgreSQL extensions";
args = [
"ARG_POSITIONAL_SINGLE([operation], [Operation])"
Expand Down
6 changes: 3 additions & 3 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ in
with pkgs;
let
xpgPkgs = import ../default.nix;
pgsqlcheck15 = callPackage ../nix/plpgsql-check.nix {
postgresql = xpgPkgs.postgresql_15;
pgsqlcheck17 = callPackage ../nix/plpgsql-check.nix {
postgresql = xpgPkgs.postgresql_17;
};
in
{
xpg = xpgPkgs.xpg.withExtensions {
extensions = {
"15" = [ pgsqlcheck15 ];
"17" = [ pgsqlcheck17 ];
};
};
}
Loading