Skip to content

Commit 0d31d72

Browse files
committed
chore: speed up CI
This now uses https://github.com/steve-chavez/xpg that already has the cached pg versions.
1 parent d1c4d38 commit 0d31d72

11 files changed

+104
-3166
lines changed

.github/workflows/ci.yaml

+40-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,24 @@ jobs:
1414
- uses: actions/checkout@v4
1515
with:
1616
submodules: true
17-
- uses: cachix/install-nix-action@v18
17+
18+
- name: Install Nix
19+
uses: cachix/install-nix-action@v30
1820
with:
1921
nix_path: nixpkgs=channel:nixos-unstable
22+
23+
- name: Use Cachix Cache
24+
uses: cachix/cachix-action@v10
25+
with:
26+
name: nxpg
27+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
28+
29+
- name: Build
30+
run: nix-shell --run "xpg -v ${{ matrix.pg-version }} build"
31+
2032
- name: Run tests
21-
run: nix-shell --run "nxpg-${{ matrix.pg-version }} nxpg-tmp nxpg-test"
33+
run: nix-shell --run "xpg -v ${{ matrix.pg-version }} test"
34+
2235
- if: ${{ failure() }}
2336
run: |
2437
cat regression.out
@@ -28,23 +41,34 @@ jobs:
2841

2942
runs-on: ubuntu-latest
3043

44+
strategy:
45+
matrix:
46+
pg-version: ['17']
47+
3148
steps:
3249
- uses: actions/checkout@v4
3350
with:
3451
submodules: true
35-
- uses: cachix/install-nix-action@v18
52+
53+
- name: Install Nix
54+
uses: cachix/install-nix-action@v30
3655
with:
3756
nix_path: nixpkgs=channel:nixos-unstable
3857

58+
- name: Use Cachix Cache
59+
uses: cachix/cachix-action@v10
60+
with:
61+
name: nxpg
62+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
63+
3964
- name: Run coverage
40-
run: nix-shell --run "nxpg-16 nxpg-tmp nxpg-coverage"
65+
run: nix-shell --run "xpg -v ${{ matrix.pg-version }} coverage"
4166

4267
- name: Send coverage to Coveralls
4368
uses: coverallsapp/[email protected]
4469
with:
4570
github-token: ${{ secrets.GITHUB_TOKEN }}
46-
files: ./coverage.info
47-
71+
files: ./build-${{ matrix.pg-version }}/coverage.info
4872

4973
style:
5074

@@ -54,9 +78,17 @@ jobs:
5478
- uses: actions/checkout@v4
5579
with:
5680
submodules: true
57-
- uses: cachix/install-nix-action@v18
81+
82+
- name: Install Nix
83+
uses: cachix/install-nix-action@v30
5884
with:
5985
nix_path: nixpkgs=channel:nixos-unstable
6086

87+
- name: Use Cachix Cache
88+
uses: cachix/cachix-action@v10
89+
with:
90+
name: nxpg
91+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
92+
6193
- name: Run style check
62-
run: nix-shell --run "nxpg-style-check"
94+
run: nix-shell --run "plmustache-style-check"

Makefile

+37-18
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
## Our variables
2-
EXTENSION = plmustache
3-
EXTVERSION = 0.1
4-
SED ?= sed
5-
6-
## PGXS variables
7-
PG_CONFIG = pg_config
8-
PGXS := $(shell $(PG_CONFIG) --pgxs)
9-
10-
MODULE_big = $(EXTENSION)
11-
SRC = $(wildcard src/*.c)
12-
OBJS = $(patsubst src/%.c, src/%.o, $(SRC))
13-
SHLIB_LINK = -lmustach
1+
SRC_DIR = src
2+
BUILD_DIR ?= build
143

4+
# the `-Wno`s quiet C90 warnings
155
PG_CFLAGS = -std=c11 -Wextra -Wall -Werror \
166
-Wno-declaration-after-statement \
177
-Wno-vla \
@@ -21,20 +11,49 @@ ifeq ($(COVERAGE), 1)
2111
PG_CFLAGS += --coverage
2212
endif
2313

14+
EXTENSION = plmustache
15+
EXTVERSION = 0.1
16+
SED ?= sed
17+
18+
DATA = $(wildcard sql/*--*.sql)
19+
20+
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql $(EXTENSION).control
21+
2422
TESTS = $(wildcard test/sql/*.sql)
2523
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
2624
REGRESS_OPTS = --inputdir=test
2725

28-
DATA = $(wildcard *--*.sql)
26+
MODULE_big = $(EXTENSION)
27+
SRC = $(wildcard $(SRC_DIR)/*.c)
28+
OBJS = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRC))
29+
30+
PG_CONFIG = pg_config
31+
SHLIB_LINK = -lmustach
32+
33+
# Find <curl/curl.h> from system headers
34+
PG_CPPFLAGS := $(CPPFLAGS) -DEXTVERSION=\"$(EXTVERSION)\"
35+
36+
build: $(BUILD_DIR)/$(EXTENSION).so $(BUILD_DIR)/$(EXTENSION)--$(EXTVERSION).sql $(BUILD_DIR)/$(EXTENSION).control
2937

30-
EXTRA_CLEAN = $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION).control
38+
$(BUILD_DIR)/.gitignore:
39+
mkdir -p $(BUILD_DIR)
40+
echo "*" > $(BUILD_DIR)/.gitignore
3141

32-
all: $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION).control
42+
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c $(BUILD_DIR)/.gitignore
43+
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
3344

34-
$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
45+
$(BUILD_DIR)/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
3546
cp $< $@
3647

37-
$(EXTENSION).control:
48+
$(BUILD_DIR)/$(EXTENSION).control:
3849
$(SED) "s/@EXTVERSION@/$(EXTVERSION)/g" $(EXTENSION).control.in > $@
3950

51+
$(BUILD_DIR)/$(EXTENSION).so: $(EXTENSION).so
52+
mv $? $@
53+
54+
PGXS := $(shell $(PG_CONFIG) --pgxs)
4055
include $(PGXS)
56+
57+
.PHONY: test
58+
test:
59+
make installcheck

nix/nxpg.nix

-118
This file was deleted.

0 commit comments

Comments
 (0)