-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
46 lines (41 loc) · 1.53 KB
/
Taskfile.yml
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
43
44
45
46
---
version: "3"
vars:
version:
sh: git describe --always --tags --abbrev=8
time:
sh: date +%Y-%m-%dT%T%z
package:
sh: go mod edit -json | jq .Module.Path -r
ldflags: -ldflags "-X 'main.BuildVersion={{.version}}' -X 'main.BuildTime={{.time}}'"
tasks:
default:
cmds:
- go mod tidy
- goimports -w -local {{.package}} .
- go install {{.ldflags}} ./cmd/...
- task: test
test:
deps: [test:sqlite, test:mysql]
test:sqlite:
desc: "Test with sqlite"
cmds:
- mig migrate stats --path testdata/sqlite/stats --db-driver sqlite --db-dsn ":memory:" --apply --verbose
- mig migrate stats --path testdata/sqlite/stats --db-driver sqlite --db-dsn "file:test.db" --apply --verbose
- mig gen --lang=go --schema=stats --db-driver sqlite --db-dsn "file:test.db" --output testdata/sqlite/model
test:mysql:
desc: "Test with mysql"
env:
DB_DSN: 'root:test@tcp(localhost:3306)/stats'
cmds:
- defer: docker compose down
- docker compose up -d --wait --remove-orphans
- mig create stats --db-dsn "root:test@tcp(localhost:3306)/mysql" --apply
- mig migrate stats --path testdata/schema/stats --apply
- rm -rf testdata/gen_* docs/*
- mig docs --schema=stats --output=testdata/docs
- mig docs --schema=stats --output=testdata/docs --output-file=README.md
- mig gen --schema=stats --lang=go --output=testdata/gen_go
- mig gen --schema=stats --lang=php81 --output=testdata/gen_php81
- mig lint --schema=stats
- mig version