-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
42 lines (35 loc) · 1.33 KB
/
Copy pathTaskfile.yml
File metadata and controls
42 lines (35 loc) · 1.33 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
39
40
41
42
version: "3"
vars:
TEST_DATABASE_URL: '{{default "postgres://postgres:postgres@127.0.0.1:5432/projects_service?sslmode=disable" .TEST_DATABASE_URL}}'
GO_TEST_ENV: GOCACHE=/tmp/go-build GOMODCACHE=/tmp/go-mod-cache
tasks:
validate-openapi:
cmds:
- "{{.GO_TEST_ENV}} go run ./cmd/validate-openapi api.json"
generate:
cmds:
- task: validate-openapi
- "CGO_ENABLED=0 {{.GO_TEST_ENV}} go run -mod=readonly github.com/sqlc-dev/sqlc/cmd/sqlc generate"
- "{{.GO_TEST_ENV}} go run -mod=readonly github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config oapi-codegen.yaml api.json"
test:
cmds:
- |
set -e
trap 'docker compose stop postgres' EXIT
docker compose up -d postgres
TEST_DATABASE_URL='{{.TEST_DATABASE_URL}}' {{.GO_TEST_ENV}} go test -p 1 ./...
test-unit:
cmds:
- "{{.GO_TEST_ENV}} go test ./..."
test-integration:
cmds:
- |
set -e
trap 'docker compose stop postgres' EXIT
docker compose up -d postgres
TEST_DATABASE_URL='{{.TEST_DATABASE_URL}}' {{.GO_TEST_ENV}} go test -p 1 ./...
ci:
cmds:
- task: generate
- git diff --exit-code -- api.json sqlc.yaml oapi-codegen.yaml internal/platform/postgres/sql internal/platform/postgres/sqlc internal/transport/http/api
- task: test-integration