Skip to content
Open
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
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
name: CI
on: [push, pull_request]
jobs:
# Style linter (https://github.com/Postgres-Extensions/linter, vendored at
# .vendor/linter). Deliberately checked out WITHOUT submodules -- `make
# lint` is the same command a developer runs locally, and lint.mk
# self-initializes the submodule on first use (see its comment). Using the
# exact same entry point here is what actually proves that self-init works,
# rather than papering over it with a submodules: true checkout. The
# linter's own test suite (fixtures + scanner edge cases) is that repo's
# own CI's job, not this one's. No PostgreSQL needed -- sql-lint is a
# standalone Perl script -- so this doesn't use the pgxn-tools container.
lint:
name: 🧹 SQL Lint
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Lint SQL
run: make lint

test:
strategy:
matrix:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".vendor/linter"]
path = .vendor/linter
url = https://github.com/Postgres-Extensions/linter.git
1 change: 1 addition & 0 deletions .vendor/linter
Submodule linter added at 97c89b
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ testdeps: check_control
.PHONY: check_control
check_control:
grep -q "requires = 'pgtap, test_factory'" test_factory_pgtap.control

# Style linter (see https://github.com/Postgres-Extensions/linter, vendored
# at .vendor/linter -- lint.mk is the thin local hand-off, see its comment).
include lint.mk
11 changes: 11 additions & 0 deletions lint.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# lint.mk — thin wrapper; the whole local footprint for consuming
# https://github.com/Postgres-Extensions/linter. Everything else lives in
# the .vendor/linter submodule; see its README for available targets/rules.
#
# Self-initializing (via the rule below) so `make lint` works right after a
# plain `git clone`, with no --recurse-submodules needed, and so CI can rely
# on the exact same entry point a developer would use locally.
.vendor/linter/lint.mk:
git submodule update --init -- .vendor/linter

include .vendor/linter/lint.mk
6 changes: 0 additions & 6 deletions sql/test_factory--0.5.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ CREATE SCHEMA _test_factory_test_data AUTHORIZATION test_factory__owner;
CREATE OR REPLACE FUNCTION _tf.schema__getsert(
) RETURNS name SECURITY DEFINER SET search_path = pg_catalog LANGUAGE plpgsql AS $body$
BEGIN
/*
IF NOT EXISTS( SELECT 1 FROM pg_namespace WHERE nspname = '_test_data' ) THEN
CREATE SCHEMA _test_data AUTHORIZATION test_factory__owner;
END IF;
*/

RETURN '_test_factory_test_data';
END
$body$;
Expand Down
6 changes: 0 additions & 6 deletions sql/test_factory.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ CREATE SCHEMA _test_factory_test_data AUTHORIZATION test_factory__owner;
CREATE OR REPLACE FUNCTION _tf.schema__getsert(
) RETURNS name SECURITY DEFINER SET search_path = pg_catalog LANGUAGE plpgsql AS $body$
BEGIN
/*
IF NOT EXISTS( SELECT 1 FROM pg_namespace WHERE nspname = '_test_data' ) THEN
CREATE SCHEMA _test_data AUTHORIZATION test_factory__owner;
END IF;
*/

RETURN '_test_factory_test_data';
END
$body$;
Expand Down
6 changes: 4 additions & 2 deletions test/deps.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
-- IF NOT EXISTS will emit NOTICEs, which is annoying
SET client_min_messages = WARNING;

-- Add any test dependency statements here
-- Note: pgTap is loaded by setup.sql
/*
* Add any test dependency statements here
* Note: pgTap is loaded by setup.sql
*/
--CREATE EXTENSION IF NOT EXISTS ...;
/*
* Now load our extension. We don't use IF NOT EXISTs here because we want an
Expand Down
Loading
Loading