forked from supabase/auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (44 loc) · 2.08 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
.PHONY: all build deps image lint migrate test vet
CHECK_FILES?=$$(go list ./... | grep -v /vendor/)
FLAGS?=-ldflags "-X github.com/netlify/gotrue/cmd.Version=`git describe --tags`"
DEV_DOCKER_COMPOSE:=docker-compose-dev.yml
help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
all: lint vet build ## Run the tests and build the binary.
build: ## Build the binary.
go build $(FLAGS)
GOOS=linux GOARCH=arm64 go build $(FLAGS) -o gotrue-arm64
deps: ## Install dependencies.
@go install github.com/gobuffalo/pop/soda@latest
@go install golang.org/x/lint/golint@latest
@go mod download
image: ## Build the production Docker image.
docker build .
lint: ## Lint the code.
golint $(CHECK_FILES)
migrate_dev: ## Run database migrations for development.
hack/migrate.sh postgres
migrate_test: ## Run database migrations for test.
hack/migrate.sh postgres
test: ## Run tests.
go test -p 1 -v $(CHECK_FILES)
vet: # Vet the code
go vet $(CHECK_FILES)
dev: ## Run the development containers
# Start postgres first and apply migrations
docker-compose -f $(DEV_DOCKER_COMPOSE) up -d postgres
docker-compose -f $(DEV_DOCKER_COMPOSE) run gotrue sh -c "make migrate_dev"
# Actually start the containers for dev
docker-compose -f $(DEV_DOCKER_COMPOSE) up
docker-test: ## Run the tests using the development containers
docker-compose -f $(DEV_DOCKER_COMPOSE) up -d postgres
docker-compose -f $(DEV_DOCKER_COMPOSE) run gotrue sh -c "make migrate_test"
docker-compose -f $(DEV_DOCKER_COMPOSE) run gotrue sh -c "make test"
docker-compose -f $(DEV_DOCKER_COMPOSE) down -v
docker-build: ## Force a full rebuild of the development containers
docker-compose -f $(DEV_DOCKER_COMPOSE) build --no-cache
docker-compose -f $(DEV_DOCKER_COMPOSE) up -d postgres
docker-compose -f $(DEV_DOCKER_COMPOSE) run gotrue sh -c "make migrate_dev"
docker-compose -f $(DEV_DOCKER_COMPOSE) down
docker-clean: ## Remove the development containers and volumes
docker-compose -f $(DEV_DOCKER_COMPOSE) rm -fsv