Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups #14

Merged
merged 10 commits into from
Dec 27, 2024
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
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.git/
/dist/
/results/
/tmp_check/
/pgdata/
regression.*
*.o
*.so
*.dylib
/.idea/
49 changes: 37 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,62 @@
name: build
on: [push, pull_request]
on: [ push, pull_request ]
jobs:
ubuntu:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- postgres: 18
os: ubuntu-24.04
- postgres: 17
os: ubuntu-22.04
os: ubuntu-24.04
- postgres: 16
os: ubuntu-22.04
- postgres: 15
os: ubuntu-22.04
- postgres: 14
os: ubuntu-22.04
- postgres: 13
os: ubuntu-20.04
- postgres: 12
os: ubuntu-20.04

steps:
- uses: actions/checkout@v4

- run: |
sudo apt update

- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ matrix.postgres }}
dev-files: true
- run: make
# env:
# PG_CFLAGS: -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare
- run: |
export PG_CONFIG=`which pg_config`
sudo --preserve-env=PG_CONFIG make install

- run: make PG_CFLAGS=-Wno-declaration-after-statement -Wno-format-security

- run: sudo make install

- run: make installcheck

- if: ${{ failure() }}
run: cat regression.diffs

mac:
runs-on: ${{ matrix.os }}
if: ${{ !startsWith(github.ref_name, 'windows') }}
strategy:
fail-fast: false
matrix:
include:
- postgres: 17
os: macos-14

steps:
- uses: actions/checkout@v4
- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ matrix.postgres }}
- run: make PG_CFLAGS=-Wno-declaration-after-statement -Wno-format-security

- run: make install

- run: make installcheck
- if: ${{ failure() }}
run: cat regression.diffs
20 changes: 20 additions & 0 deletions .github/workflows/release-pgxn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release
on:
push:
tags: [v*]
jobs:
release:
name: Release on PGXN
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
env:
PGXN_USERNAME: ${{ secrets.PGXN_USERNAME }}
PGXN_PASSWORD: ${{ secrets.PGXN_PASSWORD }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Bundle the Release
id: bundle
run: pgxn-bundle
- name: Release on PGXN
run: pgxn-release
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
*.o
*.so
*.dylib
build/
dist/
*.egg-info/
Expand All @@ -11,4 +12,6 @@ archive/
sql/vasco--0.1.0.sql
sql/vasco--0.2.0.sql

/*.png
/*.png
/pgdata/
/results/
17 changes: 0 additions & 17 deletions .readthedocs.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG PG_MAJOR=17
FROM postgres:$PG_MAJOR
ARG PG_MAJOR

COPY . /tmp/vasco

RUN apt-get update && \
apt-mark hold locales && \
apt-get install -y --no-install-recommends libpoppler-glib-dev pkg-config wget build-essential postgresql-server-dev-$PG_MAJOR && \
cd /tmp/vasco && \
make clean && \
make install && \
mkdir /usr/share/doc/vasco && \
cp LICENSE README.md /usr/share/doc/vasco && \
rm -r /tmp/vasco && \
apt-get remove -y pkg-config wget build-essential postgresql-server-dev-$PG_MAJOR && \
apt-get autoremove -y && \
apt-mark unhold locales && \
rm -rf /var/lib/apt/lists/*
67 changes: 36 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
EXTENSION = vasco
EXTVERSION = 0.2.0
EXTVERSION = 0.1.0

PG_CONFIG ?= pg_config

# Do not hardcode them here, but pick them up from the .control file
EXT_CTRL_FILE = $(EXTENSION).control
PGFILEDESC = $(shell cat $(EXT_CTRL_FILE) | grep 'comment' | sed "s/^.*'\(.*\)'$\/\1/g")
EXT_REQUIRES = $(shell cat $(EXT_CTRL_FILE) | grep 'requires' | sed "s/^.*'\(.*\)'$\/\1/g")
PGVERSION = $(shell $(PG_CONFIG) --version | sed "s/PostgreSQL //g")
LICENSE = LICENSE

MODULE_big = $(EXTENSION)

OBJS = \
src/mine.o \
src/vasco.o
OBJS = src/mine.o src/vasco.o

EXT_SQL_FILE = sql/$(EXTENSION)--$(EXTVERSION).sql

Expand All @@ -24,41 +14,56 @@ SQL_FILES = sql/preamble.sql \
sql/vasco.sql \
sql/explore.sql

ifdef WITH_PGVECTOR
SQL_FILES += sql/vasco_pgvector.sql
endif

TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-extension=$(EXTENSION)

$(EXT_SQL_FILE): $(SQL_FILES)
@cat $^ > $@

all: $(EXT_SQL_FILE)

DATA = $(EXT_SQL_FILE)

TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-extension=$(EXTENSION)

EXTRA_CLEAN = $(EXT_SQL_FILE)

DATA = $(wildcard sql/*--*.sql) #$(EXT_SQL_FILE)
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

EXTRA_CLEAN += dist $(EXT_SQL_FILE) *.png
######### DIST / RELEASE #########

.PHONY: dist

dist:
mkdir -p dist
git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ --output dist/$(EXTENSION)-$(EXTVERSION).zip main

ifdef DEBUG
COPT += -O0 -Werror -g
# for Docker
PG_MAJOR ?= 17

ASSEMBLY_FILE = $(MODULE_big).s
.PHONY: docker

$(ASSEMBLY_FILE): $(MODULE_big)
objdump -d $(MODULE_big).o > $@
docker:
docker build --pull --no-cache --build-arg PG_MAJOR=$(PG_MAJOR) -t florents/vasco:pg$(PG_MAJOR) -t florents/vasco:$(EXTVERSION)-pg$(PG_MAJOR) .

EXTRA_CLEAN += $(ASSEMBLY_FILE)
endif
.PHONY: docker-release

PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
docker-release:
docker buildx build --push --pull --no-cache --platform linux/amd64,linux/arm64 --build-arg PG_MAJOR=$(PG_MAJOR) -t florents/vasco:pg$(PG_MAJOR) -t florents/vasco:$(EXTVERSION)-pg$(PG_MAJOR) .

######### DEVELOPMENT #########

PGDATA = ./pgdata
PG_CTL = pg_ctl
.PHONY: restart-db
restart-db:
$(PG_CTL) -D $(PGDATA) restart

stop-db:
$(PG_CTL) -D $(PGDATA) stop

start-db:
postgres -D $(PGDATA)

dev: restart-db uninstall clean all install installcheck restart-db
Loading
Loading