Skip to content

Commit

Permalink
Use pg_validate_extupgrade instead of old Makefile hack (#84)
Browse files Browse the repository at this point in the history
* Use pg_validate_extupgrade instead of old Makefile hack
* remove some of the old upgrade check code
  • Loading branch information
zachasme authored Sep 20, 2022
1 parent 90665bc commit 419c9af
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ RUN RUSTUP_TOOLCHAIN=stable CARGO_TARGET_DIR=target \
RUN ./target/release/pg_validate_extupgrade --version
RUN cp ./target/release/pg_validate_extupgrade /usr/bin/
# For some reason i need this to run pg_validate_extupgrade
RUN echo "local all postgres peer" > /etc/postgresql/14/main/pg_hba.conf
RUN echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/14/main/pg_hba.conf
RUN echo "local all postgres peer" > /etc/postgresql/${POSTGRESQL}/main/pg_hba.conf
RUN echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/${POSTGRESQL}/main/pg_hba.conf

# Set workdir
WORKDIR /github/workspace
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
name: Test

on: [push, pull_request]
on: [push]

jobs:
docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: python -m pip install lark-parser
- run: rm docs/api.md
- run: make docs/api.md
- run: git diff --exit-code docs

installcheck:
runs-on: ubuntu-20.04
strategy:
Expand All @@ -27,6 +17,15 @@ jobs:
- name: Test
run: docker run -v ${PWD}:/github/workspace ghcr.io/zachasme/h3-pg/test:${{ matrix.postgresql }}-${{ matrix.ubuntu }}-${{ matrix.arch }}

extupgrade:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to repository
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
- name: Test
run: docker run -v ${PWD}:/github/workspace ghcr.io/zachasme/h3-pg/test:14-jammy-amd64 "pg_validate_extupgrade --config h3/pg_validate_extupgrade.toml && pg_validate_extupgrade --config h3_postgis/pg_validate_extupgrade.toml"

i386:
runs-on: ubuntu-20.04
strategy:
Expand All @@ -40,3 +39,13 @@ jobs:
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
- name: Test
run: docker run -v ${PWD}:/github/workspace ghcr.io/zachasme/h3-pg/test:${{ matrix.postgresql }}-${{ matrix.ubuntu }}-${{ matrix.arch }}

docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: python -m pip install lark-parser
- run: rm docs/api.md
- run: make docs/api.md
- run: git diff --exit-code docs
41 changes: 13 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,33 +163,6 @@ EXTRA_BINDING_FUNCTIONS = \
/tmp/extra-functions:
echo "$(EXTRA_BINDING_FUNCTIONS)" | tr " " "\n" > $@

PRINT_TYPES_SQL = "SELECT typname, typlen, typbyval, typalign FROM pg_type WHERE typname LIKE '%h3index' ORDER BY typname;"
PRINT_FUNCTIONS_SQL = "\df *h3*"
PRINT_FUNCFLAGS_SQL = "SELECT proname, proisstrict, provolatile, proparallel, prosrc FROM pg_proc WHERE proname LIKE '%h3%' ORDER BY proname, prosrc;"
PRINT_OPERATORS_SQL = "\do *h3*"

# rules for testing the update path against full install
h3/test/sql/ci-install.sql: $(SQL_FULLINSTALL)
echo $(PRINT_TYPES_SQL) > $@
echo $(PRINT_FUNCTIONS_SQL) >> $@
echo $(PRINT_FUNCFLAGS_SQL) >> $@
echo $(PRINT_OPERATORS_SQL) >> $@
h3/test/expected/ci-install.out: $(SQL_UPDATES)
psql -c "DROP DATABASE IF EXISTS pg_regress;"
psql -c "CREATE DATABASE pg_regress;"
psql -d pg_regress -c "CREATE EXTENSION postgis;"
psql -d pg_regress -c "CREATE EXTENSION h3 VERSION '0.1.0';"
psql -d pg_regress -c "ALTER EXTENSION h3 UPDATE;"
echo $(PRINT_TYPES_SQL) > $@
psql -d pg_regress -c $(PRINT_TYPES_SQL) >> $@
echo $(PRINT_FUNCTIONS_SQL) >> $@
psql -d pg_regress -c $(PRINT_FUNCTIONS_SQL) >> $@
echo $(PRINT_FUNCFLAGS_SQL) >> $@
psql -d pg_regress -c $(PRINT_FUNCFLAGS_SQL) >> $@
echo $(PRINT_OPERATORS_SQL) >> $@
psql -d pg_regress -c $(PRINT_OPERATORS_SQL) >> $@
psql -c "DROP DATABASE pg_regress;"

ARCH_SQL = "SELECT typbyval FROM pg_type WHERE typname = 'h3index';"

ifeq ($(ARCH),amd64)
Expand All @@ -211,6 +184,18 @@ h3/test/expected/ci-arch-$(ARCH).out: $(SQL_UPDATES)
psql -d pg_regress -c $(ARCH_SQL) | sed '3 s/.*/ ${ARCH_BOOL}/' - >> $@
psql -c "DROP DATABASE pg_regress;"


PRINT_FUNCTIONS_SQL = "SELECT proname, proisstrict, provolatile, proparallel, prosrc FROM pg_proc WHERE proname LIKE '%h3%' ORDER BY proname, prosrc;"

# rules for testing the update path against full install
h3/test/expected/ci-install.out: $(SQL_UPDATES)
psql -c "DROP DATABASE IF EXISTS pg_regress;"
psql -c "CREATE DATABASE pg_regress;"
psql -d pg_regress -c "CREATE EXTENSION h3;"
echo $(PRINT_FUNCTIONS_SQL) >> $@
psql -d pg_regress -c $(PRINT_FUNCTIONS_SQL) >> $@
psql -c "DROP DATABASE pg_regress;"

# generate expected bindings from h3 generated binding function list
h3/test/expected/ci-bindings.out: $(LIBH3_BUILD)/binding-functions /tmp/excluded-functions
psql -c "DROP DATABASE IF EXISTS pg_regress;"
Expand Down Expand Up @@ -239,5 +224,5 @@ h3/test/sql/ci-bindings.sql: h3/test/expected/ci-install.out /tmp/extra-function
| sort | uniq \
)'" > $@

ci: h3/test/sql/ci-arch-$(ARCH).sql h3/test/expected/ci-arch-$(ARCH).out h3/test/sql/ci-install.sql h3/test/expected/ci-install.out h3/test/sql/ci-bindings.sql h3/test/expected/ci-bindings.out
ci: h3/test/sql/ci-arch-$(ARCH).sql h3/test/expected/ci-arch-$(ARCH).out h3/test/sql/ci-bindings.sql h3/test/expected/ci-bindings.out
.PHONY: ci format

0 comments on commit 419c9af

Please sign in to comment.