-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (31 loc) · 1.16 KB
/
Makefile
File metadata and controls
41 lines (31 loc) · 1.16 KB
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
# Ensure go modules are enabled:
export GO111MODULE=on
export GOPROXY=https://proxy.golang.org
ifneq (,$(wildcard $(CURDIR)/.docker))
DOCKER_CONF := $(CURDIR)/.docker
else
DOCKER_CONF := $(HOME)/.docker
endif
# Disable CGO so that we always generate static binaries:
export CGO_ENABLED=0
# Allow overriding: `make lint CONTAINER_ENGINE=docker`.
CONTAINER_ENGINE ?= $(shell which podman >/dev/null 2>&1 && echo podman || echo docker)
.PHONY: all
all: build
.PHONY: build
build:
go build -ldflags "-X github.com/app-sre/aus-cli/cmd/ocm-aus/version.Version=`git describe --tags --abbrev=0` -X github.com/app-sre/aus-cli/cmd/ocm-aus/version.Commit=`git rev-parse HEAD`" ./cmd/ocm-aus
.PHONY: release
release:
@$(CONTAINER_ENGINE) run --rm -v "$(PWD):/app:z" -u $(id -u ${USER}):$(id -g ${USER}) -e GITHUB_TOKEN=$(GITHUB_TOKEN) --workdir=/app ghcr.io/goreleaser/goreleaser:v1.18.2 release
.PHONY: test
test: build
CGO_ENABLED=0 GOOS=$(GOOS) go test ./...
.PHONY: fmt
fmt:
gofmt -s -l -w cmd pkg
.PHONY: lint
lint:
@$(CONTAINER_ENGINE) --config=$(DOCKER_CONF) run --rm -w app -v "$(PWD):/app:z" --workdir=/app \
quay.io/app-sre/golangci-lint:v2.3.0 \
golangci-lint run