forked from fastly/go-fastly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (51 loc) · 1.59 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Metadata about this makefile and position
MKFILE_PATH := $(lastword $(MAKEFILE_LIST))
CURRENT_DIR := $(dir $(realpath $(MKFILE_PATH)))
CURRENT_DIR := $(CURRENT_DIR:/=)
# Get the project metadata
GOVERSION := 1.8
PROJECT := github.com/sethvargo/go-fastly
OWNER := $(dir $(PROJECT))
OWNER := $(notdir $(OWNER:/=))
NAME := $(notdir $(PROJECT))
EXTERNAL_TOOLS =
# List of tests to run
TEST ?= ./...
# List all our actual files, excluding vendor
GOFILES = $(shell go list $(TEST) | grep -v /vendor/)
# Tags specific for building
GOTAGS ?=
# Number of procs to use
GOMAXPROCS ?= 4
# bootstrap installs the necessary go tools for development or build
bootstrap:
@echo "==> Bootstrapping ${PROJECT}..."
@for t in ${EXTERNAL_TOOLS}; do \
echo "--> Installing $$t" ; \
go get -u "$$t"; \
done
# deps gets all the dependencies for this repository and vendors them.
deps:
@echo "==> Updating dependencies..."
@docker run \
--interactive \
--tty \
--rm \
--dns=8.8.8.8 \
--env="GOMAXPROCS=${GOMAXPROCS}" \
--workdir="/go/src/${PROJECT}" \
--volume="${CURRENT_DIR}:/go/src/${PROJECT}" \
"golang:${GOVERSION}" /usr/bin/env sh -c "scripts/deps.sh"
# generate runs the code generator
generate:
@echo "==> Generating ${PROJECT}..."
@go generate ${GOFILES}
# test runs the test suite
test:
@echo "==> Testing ${PROJECT}..."
@go test -timeout=60s -parallel=20 -tags="${GOTAGS}" ${GOFILES} ${TESTARGS}
# test-race runs the race checker
test-race:
@echo "==> Testing ${PROJECT} (race)..."
@go test -timeout=60s -race -tags="${GOTAGS}" ${GOFILES} ${TESTARGS}
.PHONY: bootstrap deps generate test test-race