diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ab9aee..7ea0fe4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,21 +1,21 @@ name: tests on: pull_request: - push: { branches: master } + push: { branches: main } jobs: test: name: Run tests strategy: matrix: - postgres: ["15.1.1.13"] + postgres: ["15.14.1.169", "17.6.1.169"] runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Build docker images - run: PG_VERSION=${{ matrix.postgres }} docker compose -f dockerfiles/docker-compose.yml build + run: SUPABASE_VERSION=${{ matrix.postgres }} docker compose -f dockerfiles/docker-compose.yml build - name: Run tests - run: PG_VERSION=${{ matrix.postgres }} docker compose -f dockerfiles/docker-compose.yml run test + run: SUPABASE_VERSION=${{ matrix.postgres }} docker compose -f dockerfiles/docker-compose.yml run test diff --git a/bin/compile_json.py b/bin/compile_json.py index 2ad885c..cb2d29d 100644 --- a/bin/compile_json.py +++ b/bin/compile_json.py @@ -32,9 +32,7 @@ import compile # noqa: E402 (bin/compile.py; import after sys.path setup) NAME_RE = re.compile(r"'([a-z0-9_]+)'\s+as\s+name", re.IGNORECASE) -CATEGORIES_RE = re.compile( - r"array\[(.*?)\]\s+as\s+categories", re.IGNORECASE | re.DOTALL -) +CATEGORIES_RE = re.compile(r"array\[([^\]]*)\]\s+as\s+categories", re.IGNORECASE) def extract_name(stem: str, query: str) -> str: diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 5156078..a88154c 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -1,4 +1,4 @@ -ARG SUPABASE_VERSION=15.1.1.13 +ARG SUPABASE_VERSION=15.14.1.169 FROM supabase/postgres:${SUPABASE_VERSION} WORKDIR /home/splinter diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index 99b2535..47c7278 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -7,7 +7,7 @@ services: context: .. dockerfile: ./dockerfiles/Dockerfile args: - PG_VERSION: ${SUPABASE_VERSION:-15.1.1.13} + SUPABASE_VERSION: ${SUPABASE_VERSION:-15.14.1.169} healthcheck: test: pg_isready -U postgres -h localhost interval: 5s diff --git a/test/expected/0022_extension_versions_outdated.out b/test/expected/0022_extension_versions_outdated.out index 25f5fda..2f06dfb 100644 --- a/test/expected/0022_extension_versions_outdated.out +++ b/test/expected/0022_extension_versions_outdated.out @@ -15,8 +15,8 @@ begin; 1 (1 row) - -- Test that the query returns proper column structure - -- This will help ensure the lint is properly formed + -- Verify the stable columns. The available (default) version is excluded + -- so the test doesn't depend on the amcheck version in the running image. select name, title, @@ -24,14 +24,14 @@ begin; facing, categories, description, - detail, remediation, - metadata, - cache_key + cache_key, + metadata - 'default_version' as metadata, + detail like 'Extension `amcheck` is using version `1.0`%' as detail_reports_installed_version from lint."0022_extension_versions_outdated"; - name | title | level | facing | categories | description | detail | remediation | metadata | cache_key ------------------------------+-----------------------------+-------+----------+------------+--------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------- - extension_versions_outdated | Extension Versions Outdated | WARN | EXTERNAL | {SECURITY} | Detects extensions that are not using the default (recommended) version. | Extension `amcheck` is using version `1.0` but version `1.3` is available. Using outdated extension versions may expose the database to security vulnerabilities. | https://supabase.com/docs/guides/database/database-linter?lint=0022_extension_versions_outdated | {"extension_name": "amcheck", "default_version": "1.3", "installed_version": "1.0"} | extension_versions_outdated_amcheck_1.0 + name | title | level | facing | categories | description | remediation | cache_key | metadata | detail_reports_installed_version +-----------------------------+-----------------------------+-------+----------+------------+--------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+-----------------------------------------+-----------------------------------------------------------+---------------------------------- + extension_versions_outdated | Extension Versions Outdated | WARN | EXTERNAL | {SECURITY} | Detects extensions that are not using the default (recommended) version. | https://supabase.com/docs/guides/database/database-linter?lint=0022_extension_versions_outdated | extension_versions_outdated_amcheck_1.0 | {"extension_name": "amcheck", "installed_version": "1.0"} | t (1 row) drop extension amcheck; diff --git a/test/sql/0022_extension_versions_outdated.sql b/test/sql/0022_extension_versions_outdated.sql index cd394d5..34154f4 100644 --- a/test/sql/0022_extension_versions_outdated.sql +++ b/test/sql/0022_extension_versions_outdated.sql @@ -10,8 +10,8 @@ begin; count(*) as total_outdated_extensions from lint."0022_extension_versions_outdated"; - -- Test that the query returns proper column structure - -- This will help ensure the lint is properly formed + -- Verify the stable columns. The available (default) version is excluded + -- so the test doesn't depend on the amcheck version in the running image. select name, title, @@ -19,10 +19,10 @@ begin; facing, categories, description, - detail, remediation, - metadata, - cache_key + cache_key, + metadata - 'default_version' as metadata, + detail like 'Extension `amcheck` is using version `1.0`%' as detail_reports_installed_version from lint."0022_extension_versions_outdated"; drop extension amcheck;