-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
46 lines (34 loc) · 1.48 KB
/
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
38
39
40
41
42
43
44
45
46
include golang.mk
.DEFAULT_GOAL := test # override default goal set in library makefile
SHELL := /bin/bash
PKGS := $(shell go list ./... | grep -v /vendor | grep -v /tools)
VERSION := $(shell head -n 1 VERSION)
EXECUTABLE := sfncli
EXECUTABLE_PKG := github.com/Clever/sfncli/cmd/sfncli
.PHONY: all test $(PKGS) build install_deps release clean mocks
$(eval $(call golang-version-check,1.21))
all: test build release
test: mocks $(PKGS)
$(PKGS): golang-test-all-deps
$(call golang-test-all,$@)
build:
mkdir -p build
go build -ldflags="-X main.Version=$(VERSION)" -o bin/$(EXECUTABLE) $(EXECUTABLE_PKG)
run: build
./bin/sfncli -activityname $$_DEPLOY_ENV--echo -region us-west-2 -workername `hostname` -cmd echo
release:
mkdir -p release
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.Version=$(VERSION)" \
-o="$@/$(EXECUTABLE)-$(VERSION)-linux-amd64" $(EXECUTABLE_PKG)
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X main.Version=$(VERSION)" \
-o="$@/$(EXECUTABLE)-$(VERSION)-darwin-amd64" $(EXECUTABLE_PKG)
clean:
rm -rf bin release
mocks:
mkdir -p bin
go build -o bin/mockgen -mod=vendor ./vendor/github.com/golang/mock/mockgen
rm -rf mocks/mock_*.go
./bin/mockgen -source ./vendor/github.com/aws/aws-sdk-go/service/sfn/sfniface/interface.go -destination mocks/mock_sfn.go -package mocks
./bin/mockgen -source ./vendor/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go -destination mocks/mock_cloudwatch.go -package mocks
install_deps:
go mod vendor