-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (38 loc) · 1.83 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
DATA_FILE ?= ./episodical.db
DATA_PASSPHRASE ?= PickAStrongAndLong!1!PhraseHere
PROJECT ?= episodical
C = $(shell printf "\033[35;1m-->\033[0m")
V := $(if $V,,@)
GO := $(shell which go)
binaries: ; $(info $(C) building all binaries)
$V $(MAKE) binary GOARCH=amd64 GOOS=linux
$V $(MAKE) binary GOARCH=amd64 GOOS=windows
$V $(MAKE) binary GOARCH=amd64 GOOS=darwin
$V $(MAKE) binary GOARCH=arm64 GOOS=linux
$V $(MAKE) binary GOARCH=arm64 GOOS=darwin
binary: GOARCH?=amd64
binary: GOOS?=linux
binary: ; $(info $(C) building binary $(PROJECT)-$(GOARCH)-$(GOOS))
$V $(GO) build -o dist/$(PROJECT)-$(GOARCH)-$(GOOS) ./cmd/$(PROJECT)
build-fe: ; $(info $(C) building the frontend assets)
$V yarn && NODE_OPTIONS=--openssl-legacy-provider yarn build
clean: ; $(info $(C) cleaning assets and dist)
$V rm -rf ./pkg/server/dist ./c.out ./$(PROJECT) ./cover.html
coverage: ; $(info $(C) running coverage)
$V $(GO) test -race -covermode=atomic -coverprofile=c.out ./...
$V $(GO) tool cover -html=c.out -o cover.html
dev-be: install ; $(info $(C) building backend for dev)
$V DATA_FILE=$(DATA_FILE) DATA_PASSPHRASE=$(DATA_PASSPHRASE) ./$(PROJECT)
dev-fe: ; $(info $(C) building frontend for dev)
$V NODE_OPTIONS=--openssl-legacy-provider yarn serve
docker: ; $(info $(C) building container image)
$V docker build -t cloudcloud/$(PROJECT):latest .
docker.push: ; $(info $(C) pushing image to hub)
$V docker push cloudcloud/$(PROJECT):latest
install: build-fe ; $(info $(C) installing $(PROJECT))
$V $(GO) build ./cmd/$(PROJECT)/
local: ; $(info $(C) zero-to-hero for local running)
$V GOOS=$(shell uname) $(MAKE) install
$V HOSTNAME=http://localhost:8008 DATA_FILE=$(DATA_FILE) DATA_PASSPHRASE=$(DATA_PASSPHRASE) ./$(PROJECT)
test: install ; $(info $(C) running tests)
$V $(GO) test -v -race ./...