-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
44 lines (35 loc) · 1.1 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
SHELL := /bin/bash -o pipefail
GENERATE_FILES := $(shell find . -name "*.go" -type f -print | xargs grep -l "//go:generate counterfeiter")
FAKE_FILES := $(shell find . -name "*.go" -type f -print | xargs grep -l "//go:generate counterfeiter" | sed -e 's~\(.*\)/\(.*\)/\(.*\.go\)~\1/\2/\2fakes/fake_\3~')
.PHONY: all
all: help
.PHONY: help
help: Makefile
@echo
@echo " Choose a command to run in cloud-runner:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
.PHONY: clean
clean:
@echo "🧹 Cleaning old build"
@rm -rf build
@mkdir build
## test: Runs unit tests
.PHONY: test
test: clean
@echo "🚌 Running unit tests"
@go test -v ./...
## build: Builds application
.PHONY: build
build: clean test $(FAKE_FILES)
@echo "🚧 Building application"
@go build -o build/cloud-runner cmd/cloud-runner/cloud-runner.go
## run: Runs cloud-runner locally
.PHONY: run
run: $(FAKE_FILES) cloud-runner
@echo "🚀 Starting application"
@GOOS=darwin GOARCH=amd64 go run cmd/cloud-runner/cloud-runner.go
$(FAKE_FILES): $(GENERATE_FILES)
@echo "🔋 Generating fakes"
@go generate ./...