2021-03-28 06:40:59 +08:00
|
|
|
# Run go fmt against code
|
|
|
|
fmt:
|
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
|
|
|
|
|
|
|
|
# Run tests
|
2021-11-30 05:25:01 +08:00
|
|
|
test: test-ci fmt
|
|
|
|
|
|
|
|
# Run ci tests
|
|
|
|
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
|
|
|
|
|
|
|
|
start-replica:
|
|
|
|
podman run --pull always --rm -it -p 9090:80 -p 9091:3000 adguard/adguardhome
|
|
|
|
|
|
|
|
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-12 00:06:40 +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} .
|