@@ -0,0 +1,44 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_DB: gardomatic
|
||||
POSTGRES_USER: gardomatic
|
||||
POSTGRES_PASSWORD: gardomatic
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U gardomatic"
|
||||
--health-interval 2s
|
||||
--health-timeout 5s
|
||||
--health-retries 15
|
||||
env:
|
||||
GARDOMATIC_DB_DSN: postgres://gardomatic:gardomatic@localhost:5432/gardomatic?sslmode=disable
|
||||
GARDOMATIC_TEST_DB_DSN: postgres://gardomatic:gardomatic@localhost:5432/gardomatic?sslmode=disable
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Install migrate
|
||||
run: go install -tags postgres github.com/golang-migrate/migrate/v4/cmd/migrate@latest
|
||||
- name: Migrate database
|
||||
run: migrate -path ./internal/storage/postgres/migrations -database "$GARDOMATIC_DB_DSN" up
|
||||
- name: Verify module and source
|
||||
run: |
|
||||
go mod tidy -diff
|
||||
go vet ./...
|
||||
- name: Test with race detector
|
||||
run: go test -race -count=1 ./...
|
||||
- name: Build all binaries
|
||||
run: make build/all
|
||||
Reference in New Issue
Block a user