-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
49 lines (40 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
47
48
49
NAME=sshfront
OWNER=gliderlabs
ARCH=$(shell uname -m)
RMFLAG=--rm
VERSION=0.2.1
build/Linux/sshfront:
mkdir -p build/Linux && GOOS=linux CGO_ENABLED=0 go build -a \
-ldflags "-X main.Version=$(VERSION)" \
-installsuffix cgo \
-o build/Linux/$(NAME) ./cmd/sshfront
build/Darwin/sshfront:
mkdir -p build/Darwin && GOOS=darwin CGO_ENABLED=0 go build -a \
-ldflags "-X main.Version=$(VERSION)" \
-installsuffix cgo \
-o build/Darwin/$(NAME) ./cmd/sshfront
build: build/Linux/sshfront build/Darwin/sshfront
deps:
go get -u github.com/progrium/gh-release/...
go get || true
example: build
./build/Darwin/sshfront -d -p 2222 -k ~/.ssh/id_rsa example/helloworld
test:
docker build -t $(NAME)-tests tests
docker run $(RMFLAG) \
-v $(PWD)/tests:/tests \
-v $(PWD)/build/Linux/sshfront:/bin/sshfront \
$(NAME)-tests \
basht /tests/*.bash
release:
rm -rf release && mkdir release
tar -zcf release/$(NAME)_$(VERSION)_Linux_$(ARCH).tgz -C build/Linux $(NAME)
tar -zcf release/$(NAME)_$(VERSION)_Darwin_$(ARCH).tgz -C build/Darwin $(NAME)
gh-release create $(OWNER)/$(NAME) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) v$(VERSION)
circleci:
rm ~/.gitconfig
rm -rf /home/ubuntu/.go_workspace/src/github.com/$(OWNER)/$(NAME) && cd .. \
&& mkdir -p /home/ubuntu/.go_workspace/src/github.com/$(OWNER) \
&& mv $(NAME) /home/ubuntu/.go_workspace/src/github.com/$(OWNER)/$(NAME) \
&& ln -s /home/ubuntu/.go_workspace/src/github.com/$(OWNER)/$(NAME) $(NAME)
.PHONY: build release