forked from keratin/authn-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (71 loc) · 2.13 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
include .env
ORG := keratin
PROJECT := authn-server
NAME := $(ORG)/$(PROJECT)
VERSION := 1.15.0
MAIN := main.go
BIN := $(shell pwd)/bin
export GOBIN := $(BIN)
export PATH := $(BIN):$(PATH)
.PHONY: clean
clean:
rm -rf dist
init: $(BIN)/ego
go install
$(BIN)/ego server/views
# Run the server
# OLD COMMAND: go run -ldflags "-X main.VERSION=$(VERSION)" $(MAIN)
.PHONY: server
server: init
docker-compose up -d redis
DATABASE_URL=sqlite3://localhost/dev \
REDIS_URL=redis://127.0.0.1:8701/11 \
nodemon --signal SIGTERM --exec go run -ldflags "-X main.VERSION=$(VERSION)" $(MAIN)
.PHONY: devServer
devServer: init
docker-compose up -d redis
DATABASE_URL=${DATABASE_URL} \
REDIS_URL=redis://127.0.0.1:8701/11 \
AUTHN_URL=${AUTHN_URL} \
nodemon --signal SIGTERM --exec go run -ldflags "-X main.VERSION=$(VERSION)" $(MAIN)
.PHONY: devMigrate
devMigrate: init
docker-compose up -d redis
DATABASE_URL=${DATABASE_URL} \
REDIS_URL=redis://
go run -ldflags "-X main.VERSION=$(VERSION)" $(MAIN) migrate
# Run tests
.PHONY: test
test: init
docker-compose up -d redis mysql postgres
TEST_REDIS_URL=redis://127.0.0.1:8701/12 \
TEST_MYSQL_URL=mysql://[email protected]:8702/authnservertest \
TEST_POSTGRES_URL=postgres://$(DB_USERNAME):$(DB_PASSWORD)@127.0.0.1:8703/postgres?sslmode=disable \
go test -race ./...
# Run benchmarks
.PHONY: benchmarks
benchmarks:
docker-compose up -d redis
TEST_REDIS_URL=redis://127.0.0.1:8701/12 \
go test -run=XXX -bench=. \
github.com/keratin/authn-server/server/meta \
github.com/keratin/authn-server/server/sessions
# Run migrations
.PHONY: migrate
migrate:
docker-compose up -d redis
DATABASE_URL=sqlite3://localhost/dev \
REDIS_URL=redis://127.0.0.1:8701/11 \
go run -ldflags "-X main.VERSION=$(VERSION)" $(MAIN) migrate
# Cut a release of the current version.
# 1. update CHANGELOG.md and Makefile with the next semantic version
# 2. `make release`
# 3. wait for build and attach artifacts to GitHub release
.PHONY: release
release:
git push
git tag v$(VERSION)
git push --tags
open https://github.com/$(NAME)/releases/tag/v$(VERSION)
$(BIN)/ego:
go install github.com/benbjohnson/ego/...