Skip to content

Merge pull request #41 from VoidClancy/codegen-READ #74

Merge pull request #41 from VoidClancy/codegen-READ

Merge pull request #41 from VoidClancy/codegen-READ #74

Workflow file for this run

name: verify
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpassword
POSTGRES_DB: valk_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Vet packages
run: make vet
- name: Run compiler unit tests
run: make test
- name: Run SQLite Integration Tests
run: |
cp integration/schema.prisma integration/schema.prisma.bak
node integration/prepareSchema.js sqlite
rm -f integration/valk/migrations/*.sql
make integration-gen
cd integration
../bin/valk migrate -u "file:dev.db" init_sqlite
go test -tags sqlite -v ./...
mv schema.prisma.bak schema.prisma
- name: Run Postgres Integration Tests
run: |
PG_URL="${{ secrets.PG_DATABASE_URL }}"
if [ -z "$PG_URL" ]; then
PG_URL="postgres://testuser:testpassword@localhost:5432/valk_test?sslmode=disable"
else
PG_URL="${PG_URL/valkyrie_test/valk_test}"
fi
cp integration/schema.prisma integration/schema.prisma.bak
node integration/prepareSchema.js postgres
rm -f integration/valk/migrations/*.sql
make integration-gen
cd integration
../bin/valk migrate -u "$PG_URL" init_pg
PG_DATABASE_URL="$PG_URL" go test -v ./...
mv schema.prisma.bak schema.prisma