-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
37 lines (29 loc) · 908 Bytes
/
Makefile
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
SHELL := /bin/bash
GO ?= go
GO_CMD := CGO_ENABLED=0 $(GO)
GIT_VERSION := $(shell git describe --tags --dirty)
VERSION := $(GIT_VERSION:v%=%)
GIT_COMMIT := $(shell git rev-parse HEAD)
DOCKER_REPO ?= xperimental/netatmo-exporter
DOCKER_TAG ?= dev
.PHONY: all
all: test build-binary
include .bingo/Variables.mk
.PHONY: test
test:
$(GO_CMD) test -cover ./...
.PHONY: lint
lint: $(GOLANGCI_LINT)
@$(GOLANGCI_LINT) run --fix
.PHONY: build-binary
build-binary:
$(GO_CMD) build -tags netgo -ldflags "-w -X main.Version=$(VERSION) -X main.GitCommit=$(GIT_COMMIT)" -o netatmo-exporter .
.PHONY: image
image:
docker buildx build -t "ghcr.io/$(DOCKER_REPO):$(DOCKER_TAG)" --load .
.PHONY: all-images
all-images:
docker buildx build -t "ghcr.io/$(DOCKER_REPO):$(DOCKER_TAG)" -t "docker.io/$(DOCKER_REPO):$(DOCKER_TAG)" --platform linux/amd64,linux/arm64 --push .
.PHONY: clean
clean:
rm -f netatmo-exporter