-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.04 KB
/
Copy pathapi.yml
File metadata and controls
38 lines (36 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: API
on:
push:
paths: ["api/**", ".github/workflows/api.yml"]
pull_request:
paths: ["api/**", ".github/workflows/api.yml"]
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: api
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: purros
POSTGRES_PASSWORD: purros
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: >-
--health-cmd "pg_isready -U purros" --health-interval 5s --health-timeout 3s --health-retries 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: api/go.mod
cache-dependency-path: api/go.sum
- name: gofmt
run: test -z "$(gofmt -l .)" || (gofmt -l . && exit 1)
- run: go vet ./...
- name: Test
run: go test -race -count=1 ./...
env:
PURROS_TEST_DATABASE_URL: postgres://purros:purros@localhost:5432/postgres?sslmode=disable
- run: go build ./cmd/purros