-
Notifications
You must be signed in to change notification settings - Fork 8
/
Taskfile.yml
126 lines (111 loc) · 2.83 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
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
# https://taskfile.dev
version: '3'
vars:
BINARY_FOLDER: bin
BINARY_NAME: terraform-provider-qovery
GOLANGCI_LINT_VERSION: v1.49.0
MOCKERY_VERSION: v2.22.1
dotenv: ['.env']
tasks:
mocks:
desc: Generate mocks for repositories
deps:
- install-mockery
cmds:
- go generate ./internal/domain/...
sources:
- "internal/domain/**/*.go"
- go.mod
- go.sum
generates:
- internal/infrastructure/repositories/mocks_test/*.go
build:
desc: Build the provider binary
cmds:
- go get github.com/qovery/qovery-client-go
- go build -v -o {{.BINARY_FOLDER}}/{{.BINARY_NAME}}
sources:
- "**/*.go"
- go.mod
- go.sum
generates:
- '{{.BINARY_FOLDER}}/{{.BINARY_NAME}}'
install:
deps:
- install-dev-override
- build
test:
desc: Run unit tests
cmds:
- go test -tags=unit -v -cover ./...
testacc:
desc: Run acceptance tests
env:
TF_ACC: true
cmds:
- go test -tags=integration -v -cover -timeout 2h ./...
docs:
desc: Update the generated documentation
cmds:
- go generate
sources:
- "main.go"
- "qovery/**/*.go"
- "internal/**/*.go"
- "examples/**/*.tf"
- "examples/**/import.sh"
- "examples/**/examples.md"
- "templates/**/*.tmpl"
- go.mod
- go.sum
generates:
- docs/**/*.md
fetch-instance-types:
desc: Update cluster_instance_types local data
cmds:
- ./scripts/fetch_instance_types.sh
generates:
- qovery/data/cluster_instance_types/*.json
lint:
desc: Run linters
deps:
- install-golangci-lint
cmds:
- golangci-lint run ./internal/...
sources:
- "internal/**/*.go"
- go.mod
- go.sum
- .golangci.yml
install-golangci-lint:
desc: Install the golangci-lint tool
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@{{.GOLANGCI_LINT_VERSION}}
status:
- which golangci-lint
- golangci-lint version | grep {{.GOLANGCI_LINT_VERSION}}
install-mockery:
desc: Install the mockery tool
cmds:
- go install github.com/vektra/mockery/v2@{{.MOCKERY_VERSION}}
status:
- which mockery
- mockery --version | grep {{.MOCKERY_VERSION}}
install-dev-override:
desc: Set up an override allowing a local version of the provider to be used
cmds:
- cmd: |
cat << EOF > ~/.terraformrc
provider_installation {
dev_overrides {
"qovery/qovery" = "$(pwd)/{{.BINARY_FOLDER}}"
}
direct {}
}
EOF
status:
- cat ~/.terraformrc | grep "$(pwd)/{{.BINARY_FOLDER}}"
uninstall-dev-override:
desc: Remove any local terraform overrides for local development
cmds:
- rm ~/.terraformrc