-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
166 lines (144 loc) · 4.18 KB
/
Taskfile.yaml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
version: '3'
includes:
cli:
taskfile: ./cmd/cli
dir: ./cmd/cli
docker:
taskfile: ./docker
dir: ./docker
aliases: [compose]
db:
taskfile: ./db
dir: ./db
aliases: [atlas]
config:
taskfile: ./jsonschema
env:
ATLAS_SQLITE_DB_URI: "sqlite://file?mode=memory&_fk=1"
ATLAS_POSTGRES_DB_URI: "postgres:17-alpine"
TEST_DB_URL: "libsql://file::memory:?cache=shared"
TEST_DB_CONTAINER_EXPIRY: "2" # in minutes
TEST_FGA_URL: "localhost:8080"
ENV: config
GOFLAGS: -buildvcs=false
tasks:
default:
silent: true
cmds:
- task --list
install:
desc: installs tools and packages needed to develop against the dbx repo
cmds:
- "brew install gomplate"
- "go install entgo.io/ent/cmd/ent@latest"
- "brew install golangci-lint"
- "curl -sSf https://atlasgo.sh | sh"
- "curl -sSL https://rover.apollo.dev/nix/latest | sh"
- "go get -u github.com/openfga/go-sdk"
- "brew install openfga/tap/fga"
- go install github.com/vektra/mockery/v2@v2.40.1
- task: config:install
- defer: {task: 'go:tidy'}
generate:
desc: a combination of the ent, graph, and gqlgen tasks which are required to fully generate the necessary graph, server, resolvers, client, etc.
cmds:
- go generate ./...
## Go tasks
go:lint:
desc: runs golangci-lint, the most annoying opinionated linter ever
cmds:
- golangci-lint run --config=.golangci.yaml --verbose
go:test:
desc: runs and outputs results of created go tests
cmds:
- go test -v ./...
go:test:cover:
desc: runs and outputs results of created go tests with coverage
aliases: [cover]
cmds:
- go test -v ./... -coverprofile=coverage.out
go:test:cover:out:
desc: runs and outputs results of created go tests with coverage
aliases: [cover]
cmds:
- task: go:test:cover
- go tool cover -html=coverage.out
go:fmt:
desc: format all go code
cmds:
- go fmt ./...
go:tidy:
desc: Runs go mod tidy on the backend
aliases: [tidy]
cmds:
- go mod tidy
go:build:
desc: Runs go build for the dbx server
cmds:
- "{{ .GOOS }} {{ .GOARCH }} go build -mod=mod -o dbx"
go:build:ci:
desc: Runs go build for the core server
cmds:
- go build -mod=mod -a -o bin/dbx
go:build-cli:ci:
desc: Runs go build for the openlane cli in CI
cmds:
- go build -mod=mod -a -o bin/dbx-cli ./cmd/cli
go:build-cli:
aliases: [buildcli]
desc: Runs go build for the dbx cli
cmds:
- go build -mod=mod -o dbx-cli ./cmd/cli
go:all:
aliases: [go]
desc: Runs all go test and lint related tasks
cmds:
- task: go:tidy
- task: go:fmt
- task: go:lint
- task: go:test
# dev tasks
run-dev:
dotenv: ['{{.ENV}}/.env-dev']
desc: runs the dbx server in dev mode
cmds:
- task: compose:redis
- task: compose:fga
- go run main.go serve --debug --pretty
pr:
desc: runs the comprehensive roll-up tasks required to ensure all files are being committed / pushed as a part of opening a PR
cmds:
- task: generate
- task: config:generate
- task: config:docs
- task: atlas:all
- task: go
ci:
desc: a task that runs during CI
cmds:
- task: generate
- task: tidy
- "git config --global --add safe.directory /workdir"
- |
status=$(git status --porcelain)
if [ -n "$status" ]; then
echo "detected git diff after running generate; please re-run tasks"
echo "$status"
exit 1
fi
clean:local:
desc: cleans up dbx.db and dbx-cli local
cmds:
- "rm -f dbx.db"
- "rm -f dbx-cli"
rover:
desc: launches an interactive browser to navigate the configured graph schema
cmds:
- 'open "http://localhost:4000"'
- rover dev --skip-update-check --skip-update -u http://localhost:1337/query -s schema.graphql -n dbx --elv2-license=accept
precommit-full:
desc: Lint the project against all files
cmds:
- pre-commit install && pre-commit install-hooks
- pre-commit autoupdate
- pre-commit run --show-diff-on-failure --color=always --all-files