2022-08-12 15:31:24 +08:00
|
|
|
# Run go lint against code
|
|
|
|
lint:
|
2021-11-30 05:25:01 +08:00
|
|
|
golangci-lint run --fix
|
2021-03-28 06:40:59 +08:00
|
|
|
|
|
|
|
# Run go mod tidy
|
|
|
|
tidy:
|
|
|
|
go mod tidy
|
|
|
|
|
2022-07-23 17:05:11 +08:00
|
|
|
generate: deepcopy-gen
|
|
|
|
touch ./tmp/deepcopy-gen-boilerplate.go.txt
|
|
|
|
deepcopy-gen -h ./tmp/deepcopy-gen-boilerplate.go.txt -i ./pkg/types
|
|
|
|
|
2021-03-28 06:40:59 +08:00
|
|
|
# Run tests
|
2022-08-12 15:31:24 +08:00
|
|
|
test: generate lint test-ci
|
2021-11-30 05:25:01 +08:00
|
|
|
|
|
|
|
# Run ci tests
|
2022-03-31 03:54:53 +08:00
|
|
|
test-ci: mocks tidy
|
2021-03-28 06:40:59 +08:00
|
|
|
go test ./... -coverprofile=coverage.out
|
|
|
|
go tool cover -func=coverage.out
|
2021-03-28 22:42:12 +08:00
|
|
|
|
2021-04-11 17:56:55 +08:00
|
|
|
mocks: mockgen
|
2021-08-19 13:41:00 +08:00
|
|
|
mockgen -package client -destination pkg/mocks/client/mock.go github.com/bakito/adguardhome-sync/pkg/client Client
|
2021-04-11 17:56:55 +08:00
|
|
|
|
2021-03-29 01:31:11 +08:00
|
|
|
release: semver
|
|
|
|
@version=$$(semver); \
|
2021-03-28 22:42:12 +08:00
|
|
|
git tag -s $$version -m"Release $$version"
|
|
|
|
goreleaser --rm-dist
|
|
|
|
|
|
|
|
test-release:
|
2021-03-29 01:31:11 +08:00
|
|
|
goreleaser --skip-publish --snapshot --rm-dist
|
|
|
|
|
|
|
|
semver:
|
|
|
|
ifeq (, $(shell which semver))
|
2021-11-30 05:25:01 +08:00
|
|
|
$(shell go install github.com/bakito/semver@latest)
|
2021-04-11 17:56:55 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
mockgen:
|
|
|
|
ifeq (, $(shell which mockgen))
|
2022-01-31 01:54:22 +08:00
|
|
|
$(shell go install github.com/golang/mock/mockgen@v1.6.0)
|
2022-02-15 01:35:56 +08:00
|
|
|
endif
|
|
|
|
|
2022-07-23 17:05:11 +08:00
|
|
|
deepcopy-gen:
|
|
|
|
ifeq (, $(shell which deepcopy-gen))
|
|
|
|
$(shell go install k8s.io/code-generator/cmd/deepcopy-gen@latest)
|
|
|
|
endif
|
|
|
|
|
2022-02-15 01:35:56 +08:00
|
|
|
start-replica:
|
|
|
|
podman run --pull always --rm -it -p 9090:80 -p 9091:3000 adguard/adguardhome
|
2022-10-05 01:55:00 +08:00
|
|
|
# podman run --pull always --rm -it -p 9090:80 -p 9091:3000 adguard/adguardhome:v0.107.13
|
2022-02-15 01:35:56 +08:00
|
|
|
|
|
|
|
check_defined = \
|
|
|
|
$(strip $(foreach 1,$1, \
|
|
|
|
$(call __check_defined,$1,$(strip $(value 2)))))
|
|
|
|
__check_defined = \
|
|
|
|
$(if $(value $1),, \
|
|
|
|
$(error Undefined $1$(if $2, ($2))))
|
|
|
|
|
|
|
|
build-image:
|
|
|
|
$(call check_defined, AGH_SYNC_VERSION)
|
2022-03-15 03:08:55 +08:00
|
|
|
podman build --build-arg VERSION=${AGH_SYNC_VERSION} --build-arg BUILD=$(shell date -u +'%Y-%m-%dT%H:%M:%S.%3NZ') --name adgardhome-replica -t ghcr.io/bakito/adguardhome-sync:${AGH_SYNC_VERSION} .
|