-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (41 loc) · 1.95 KB
/
Makefile
File metadata and controls
56 lines (41 loc) · 1.95 KB
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
.PHONY: clean backend-lint frontend-lint lint backend-test frontend-test test frontend-dev backend-dev prod prod-all frontend-prod
DIRTY_TREE := $(shell git diff-index --quiet HEAD -- || echo '+dirty')
COMMIT := $(addsuffix $(DIRTY_TREE),$(shell git rev-parse --short HEAD))
VERSION := 1.0.0-rc1+$(COMMIT)
# Coverage output file (placed in build/)
COVERAGE_FILE := build/backend-coverage.out
BUILD_FLAGS := -tags prod -ldflags "-X github.com/cactusdynamics/wesplot.Version=$(VERSION)"
clean:
rm -rf build webui frontend/dist
backend-lint:
go vet ./...
gopls check -severity=info $(shell find . -name '*.go')
frontend-lint:
cd frontend && npm run lint
lint: backend-lint frontend-lint
backend-test:
@mkdir -p build
COVERAGE_FILE=$(COVERAGE_FILE) COVERAGE=$(COVERAGE) scripts/run-backend-test.sh
frontend-test:
cd frontend && npm run test
test: backend-test frontend-test
backend-dev:
# Not the best for now but whatever
python3 scripts/fake_data.py | go run cmd/wesplot/main.go
frontend-dev:
cd frontend && npm run dev -- --host 0.0.0.0 --port 5273
frontend-prod:
cd frontend && npm run build
rm -rf webui
cp -ar frontend/dist webui
prod: frontend-prod
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/wesplot ./cmd/wesplot
prod-all:
@mkdir -p build
export GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 && go build $(BUILD_FLAGS) -o build/wesplot-$$GOOS-$$GOARCH-$(VERSION) ./cmd/wesplot
export GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 && go build $(BUILD_FLAGS) -o build/wesplot-$$GOOS-$$GOARCH-$(VERSION) ./cmd/wesplot
export GOOS=linux GOARCH=amd64 CGO_ENABLED=0 && go build $(BUILD_FLAGS) -o build/wesplot-$$GOOS-$$GOARCH-$(VERSION) ./cmd/wesplot
export GOOS=linux GOARCH=arm64 CGO_ENABLED=0 && go build $(BUILD_FLAGS) -o build/wesplot-$$GOOS-$$GOARCH-$(VERSION) ./cmd/wesplot
export GOOS=windows GOARCH=amd64 CGO_ENABLED=0 && go build $(BUILD_FLAGS) -o build/wesplot-$$GOOS-$$GOARCH-$(VERSION) ./cmd/wesplot
cd build && sha256sum * | tee sha256sums
ls -lh build