Skip to content

Added all unit-tests to CI #8

Added all unit-tests to CI

Added all unit-tests to CI #8

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
services:
# Database service container (pgvector)
postgres:
image: ankane/pgvector:v0.5.1
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
POSTGRES_DB: perfkit_pg_vector_db_ci
ports:
- 5432:5432
# Health check to wait until postgres is ready
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Install PostgreSQL client
run: sudo apt-get update && sudo apt-get install -y postgresql-client
- name: Create vector extension
run: PGPASSWORD=password psql -h localhost -U root -d perfkit_pg_vector_db_ci -c "CREATE EXTENSION vector;"
- name: Test
run: go test -v ./db/sql/...
env:
# Pass database connection details to tests (using pgvector config)
DB_HOST: localhost
DB_PORT: 5432
DB_USER: root
DB_PASSWORD: password
DB_NAME: perfkit_pg_vector_db_ci