Skip to content

chore: Google Vertex AI support #209

chore: Google Vertex AI support

chore: Google Vertex AI support #209

Workflow file for this run

name: Tests
# This workflow runs unit and integration tests
on:
pull_request:
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- 'migrations/**'
- 'tests/**'
- '.githooks/**'
- '.github/workflows/tests.yml'
concurrency:
group: tests-${{ github.head_ref }}
cancel-in-progress: true
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
with:
go-version: '1.26.1'
- name: Cache Go modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
- name: Run unit tests
run: make test-unit
integration-tests:
name: Integration Tests
runs-on: ubuntu-24.04
timeout-minutes: 10
services:
postgres:
image: pgvector/pgvector:pg18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_db?sslmode=disable
API_KEY: test-api-key-for-ci
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
with:
go-version: '1.26.1'
- name: Cache Go modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
- name: Install goose
run: go install github.com/pressly/goose/v3/cmd/goose@v3.27.0
- name: Validate migrations
run: make migrate-validate
- name: Initialize database schema
run: make init-db
- name: Run River migrations
run: |
go install github.com/riverqueue/river/cmd/river@v0.31.0
make river-migrate
- name: Run integration tests
run: make tests
coverage:
name: Coverage
runs-on: ubuntu-24.04
timeout-minutes: 10
services:
postgres:
image: pgvector/pgvector:pg18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_db?sslmode=disable
API_KEY: test-api-key-for-ci
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
with:
go-version: '1.26.1'
- name: Cache Go modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
- name: Install goose
run: go install github.com/pressly/goose/v3/cmd/goose@v3.27.0
- name: Initialize database schema
run: make init-db
- name: Run River migrations
run: |
go install github.com/riverqueue/river/cmd/river@v0.31.0
make river-migrate
- name: Check coverage (excludes cmd/api)
run: make check-coverage
tests:
name: All Tests
needs: [unit-tests, integration-tests, coverage]
runs-on: ubuntu-24.04
if: always()
steps:
- name: Check test results
run: |
if [ "${{ needs.unit-tests.result }}" != "success" ]; then
echo "Unit tests failed"
exit 1
fi
if [ "${{ needs.integration-tests.result }}" != "success" ]; then
echo "Integration tests failed"
exit 1
fi
if [ "${{ needs.coverage.result }}" != "success" ]; then
echo "Coverage check failed"
exit 1
fi
echo "✅ All tests passed!"