mirror of
https://github.com/bakito/adguardhome-sync.git
synced 2024-11-10 09:12:29 +08:00
d6d8d2148d
* implement metrics
135 lines
3.1 KiB
YAML
135 lines
3.1 KiB
YAML
version: '3'
|
|
env:
|
|
AGH_MODEL_VERSION: v0.107.43
|
|
GOBIN: '{{.USER_WORKING_DIR}}/bin'
|
|
|
|
tasks:
|
|
|
|
install-go-tool:
|
|
label: "Install {{ .TOOL_NAME }}"
|
|
cmds:
|
|
- go install {{ .TOOL_MODULE }}
|
|
status:
|
|
- test -f {{.GOBIN}}/{{.TOOL_NAME}}
|
|
|
|
deepcopy-gen:
|
|
desc: Install deepcopy-gen
|
|
cmd:
|
|
task: install-go-tool
|
|
vars:
|
|
TOOL_NAME: deepcopy-gen
|
|
TOOL_MODULE: k8s.io/code-generator/cmd/deepcopy-gen
|
|
|
|
ginkgo:
|
|
cmd:
|
|
task: install-go-tool
|
|
vars:
|
|
TOOL_NAME: ginkgo
|
|
TOOL_MODULE: github.com/onsi/ginkgo/v2/ginkgo
|
|
|
|
goreleaser:
|
|
cmd:
|
|
task: install-go-tool
|
|
vars:
|
|
TOOL_NAME: goreleaser
|
|
TOOL_MODULE: github.com/goreleaser/goreleaser
|
|
|
|
golangci-lint:
|
|
cmd:
|
|
task: install-go-tool
|
|
vars:
|
|
TOOL_NAME: golangci-lint
|
|
TOOL_MODULE: github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
|
|
mockgen:
|
|
cmd:
|
|
task: install-go-tool
|
|
vars:
|
|
TOOL_NAME: mockgen
|
|
TOOL_MODULE: go.uber.org/mock/mockgen
|
|
|
|
oapi-codegen:
|
|
cmd:
|
|
task: install-go-tool
|
|
vars:
|
|
TOOL_NAME: oapi-codegen
|
|
TOOL_MODULE: github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen
|
|
|
|
semver:
|
|
cmd:
|
|
task: install-go-tool
|
|
vars:
|
|
TOOL_NAME: semver
|
|
TOOL_MODULE: github.com/bakito/semver
|
|
|
|
lint:
|
|
deps:
|
|
- golangci-lint
|
|
cmds:
|
|
- '{{.GOBIN}}/golangci-lint run --fix'
|
|
|
|
tidy:
|
|
desc: Run go mod tidy
|
|
cmd: go mod tidy
|
|
|
|
generate:
|
|
deps:
|
|
- deepcopy-gen
|
|
cmds:
|
|
- mkdir -p ./tmp
|
|
- touch ./tmp/deepcopy-gen-boilerplate.go.txt
|
|
- '{{.GOBIN}}/deepcopy-gen -h ./tmp/deepcopy-gen-boilerplate.go.txt -i ./pkg/types'
|
|
|
|
mocks:
|
|
deps:
|
|
- mockgen
|
|
cmds:
|
|
- '{{.GOBIN}}/mockgen -package client -destination pkg/mocks/client/mock.go github.com/bakito/adguardhome-sync/pkg/client Client'
|
|
- '{{.GOBIN}}/mockgen -package client -destination pkg/mocks/flags/mock.go github.com/bakito/adguardhome-sync/pkg/config Flags'
|
|
|
|
test:
|
|
cmds:
|
|
- task: generate
|
|
- task: lint
|
|
- task: test-ci
|
|
|
|
test-ci:
|
|
deps:
|
|
- ginkgo
|
|
- tidy
|
|
- mocks
|
|
cmds:
|
|
- '{{.GOBIN}}/ginkgo --cover --coverprofile coverage.out.tmp ./...'
|
|
- cat coverage.out.tmp | grep -v "_generated.go" > coverage.out
|
|
- go tool cover -func=coverage.out
|
|
|
|
release:
|
|
deps:
|
|
- semver
|
|
- goreleaser
|
|
cmds:
|
|
- git tag -s $$version -m"Release $({{.GOBIN}}/semver)
|
|
- '{{.GOBIN}}/goreleaser --clean'
|
|
|
|
test-release:
|
|
deps:
|
|
- goreleaser
|
|
- semver
|
|
cmds:
|
|
- '{{.GOBIN}}/goreleaser --skip=publish --snapshot --clean'
|
|
|
|
model:
|
|
deps:
|
|
- oapi-codegen
|
|
cmds:
|
|
- mkdir -p tmp
|
|
- go run openapi/main.go {{.AGH_MODEL_VERSION}}
|
|
- '{{.GOBIN}}/oapi-codegen -package model -generate types,client -config .oapi-codegen.yaml tmp/schema.yaml > pkg/client/model/model_generated.go'
|
|
|
|
model-diff:
|
|
deps:
|
|
- oapi-codegen
|
|
cmds:
|
|
- go run openapi/main.go {{.AGH_MODEL_VERSION}}
|
|
- go run openapi/main.go
|
|
- diff tmp/schema.yaml tmp/schema-master.yaml
|