-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
53 lines (40 loc) · 1.8 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
VERSION="$(shell cat DRAUPNIR_VERSION)"
BUILD_COMMAND=go build -ldflags "-X github.com/gocardless/draupnir/pkg/version.Version=$(VERSION)"
.PHONY: build client clean test test-integration dump-schema publish-circleci-dockerfile
build-linux:
GOOS=linux GOARCH=amd64 $(BUILD_COMMAND) -o draupnir.linux_amd64 cmd/draupnir/draupnir.go
build-osx:
GOOS=darwin GOARCH=amd64 $(BUILD_COMMAND) -o draupnir.darwin_amd64 cmd/draupnir/draupnir.go
build: build-linux build-osx
migrate:
# https://github.com/rubenv/sql-migrate
sql-migrate up
dump-schema:
pg_dump --schema-only --no-privileges --no-owner --file structure.sql draupnir
test:
go test ./...
go vet ./...
test-integration:
docker build -t gocardless/draupnir-base .\
&& bundle exec rspec
build-production: test
GOOS=linux GOARCH=amd64 $(BUILD_COMMAND) -o draupnir.linux_amd64 cmd/draupnir/draupnir.go
GOOS=darwin GOARCH=amd64 $(BUILD_COMMAND) -o draupnir.darwin_amd64 cmd/draupnir/draupnir.go
deb: build-production
fpm -f -s dir -t $@ -n draupnir -v $(VERSION) \
--description "Databases on demand" \
--maintainer "GoCardless Engineering <[email protected]>" \
draupnir.linux_amd64=/usr/local/bin/draupnir \
cmd/draupnir-create-instance=/usr/local/bin/draupnir-create-instance \
cmd/draupnir-destroy-image=/usr/local/bin/draupnir-destroy-image \
cmd/draupnir-destroy-instance=/usr/local/bin/draupnir-destroy-instance \
cmd/draupnir-finalise-image=/usr/local/bin/draupnir-finalise-image \
cmd/draupnir-start-image=/usr/local/bin/draupnir-start-image
clean:
-rm -f draupnir draupnir.*_amd64 *.deb
publish-base-dockerfile:
docker build -t gocardless/draupnir-base . \
&& docker push gocardless/draupnir-base
publish-circleci-dockerfile:
docker build -t gocardless/draupnir-circleci .circleci \
&& docker push gocardless/draupnir-circleci