This repository has been archived by the owner on Dec 26, 2024. It is now read-only.
forked from StabbyCutyou/sqltocsv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (48 loc) · 2.14 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
63
64
65
66
########################################################################################################################
## GLOBAL VARIABLES & GENERAL PURPOSE TARGETS
########################################################################################################################
SHELL := /bin/bash
BUILD_FILE := ./build/sqltocsv
PROJECT_NAME := sqltocsv
.PHONY: no-args
no-args:
# Do nothing by default. Ensure this is first in the list of tasks
.PHONY: all
all: dep test build
.PHONY: dep
dep:
go get -u github.com/golang/dep/cmd/dep
dep ensure
.PHONY: test
test:
# TODO: add tests
.PHONY: build
build:
go build -v -o=${BUILD_FILE} .
$(BUILD_FILE):
go build -v -o=${BUILD_FILE} .
.PHONY: clean
clean:
rm $(BUILD_FILE)
########################################################################################################################
## CI & DOCKER RELATED TARGETS
########################################################################################################################
REGISTRY := localhost:5000/tapjoy
GIT_SHA := `git rev-parse HEAD`
.PHONY: artifact-prep
artifact-prep: dep build
# All build-time steps needed for preparing a deployment artifact should be contained here
# This would generally be tasks like bundle installs, asset building, bundling GeoIP data and so on
## NOTE: Once slugs of a project are no longer deployed, this task can be moved to the Dockerfile
# Unless WITH_GIT exists, remove everything but the build directory, the Procfile, the .git, deploy, and data folders
[[ "${WITH_GIT:-}" ]] || rm -r `ls -A | grep -v "build" | grep -v ".git" | grep -v "Procfile" | grep -v "deploy" | grep -v "data" | grep -v "grace-shepherd" | grep -v "pids"`
# Create shafile containing current git SHA
echo ${GIT_SHA} > shafile
# Move the built binary and remove the build directory
mv ${BUILD_FILE} ./ && rm -rf build
.PHONY: artifact-publish
artifact-publish: artifact
docker push ${REGISTRY}/${PROJECT_NAME}:${GIT_SHA}
# We'll need to clean up after ourselves so long as legacy Jenkins is the builder component
docker rmi ${REGISTRY}/${PROJECT_NAME}:${GIT_SHA}
docker rmi `docker images -q -f dangling=true`