Skip to content

fix: remove inline comment breaking metadata-action v6 #5

fix: remove inline comment breaking metadata-action v6

fix: remove inline comment breaking metadata-action v6 #5

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# Renaming for clarity in matrix, maps to Dockerfile ARGs
pg_version_matrix: [16, 15] # Corresponds to PG_MAJOR_VERSION
pgvector_tag_matrix: [v0.8.0, v0.7.2] # Corresponds to PGVECTOR_TAG
# POSTGIS_MAJOR_VERSION is set to 3 directly in build-args below
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image
id: build
uses: docker/build-push-action@v7
with:
context: .
load: true # Load image into local Docker daemon for testing
tags: postgres-postgis-pgvector:test-${{ matrix.pg_version_matrix }}-pgvector${{ matrix.pgvector_tag_matrix }}
build-args: |
PG_MAJOR_VERSION=${{ matrix.pg_version_matrix }}
POSTGIS_MAJOR_VERSION=3
PGVECTOR_TAG=${{ matrix.pgvector_tag_matrix }}
- name: Start PostgreSQL container and test extensions
run: |
IMAGE_TAG="postgres-postgis-pgvector:test-${{ matrix.pg_version_matrix }}-pgvector${{ matrix.pgvector_tag_matrix }}"
echo "Testing image: $IMAGE_TAG"
docker run -d --name test-db \
-e POSTGRES_PASSWORD=test \
-e POSTGRES_USER=test \
-e POSTGRES_DB=test \
$IMAGE_TAG \
postgres -c shared_preload_libraries=vector # Ensure pgvector is preloaded
echo "Waiting for PostgreSQL to start..."
sleep 15 # Allow time for PostgreSQL to initialize
echo "PostgreSQL logs:"
docker logs test-db
echo "Checking PostGIS version..."
docker exec test-db psql -U test -d test -c "SELECT postgis_full_version();"
echo "Checking pgvector extension version..."
docker exec test-db psql -U test -d test -c "CREATE EXTENSION IF NOT EXISTS vector; SELECT extversion FROM pg_extension WHERE extname = 'vector';"
echo "Attempting to create a table with a vector column and insert data..."
docker exec test-db psql -U test -d test -c "CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3)); INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]'); SELECT COUNT(*) FROM items;"
- name: Stop and remove container
if: always() # Ensure cleanup even if previous steps fail
run: |
docker stop test-db || true
docker rm test-db || true