-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 1.24 KB
/
Makefile
File metadata and controls
37 lines (30 loc) · 1.24 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
.PHONY: build test install clean ui
BINARY_NAME = workflow-plugin-infra
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS = -ldflags "-X github.com/GoCodeAlone/workflow-plugin-infra/internal.Version=$(VERSION)"
INSTALL_DIR ?= data/plugins/$(BINARY_NAME)
INSTALL_PATH = $(if $(DESTDIR),$(DESTDIR)/$(INSTALL_DIR),$(INSTALL_DIR))
GO_ENV = GOWORK=off GOPRIVATE=github.com/GoCodeAlone/*
build: ui
$(GO_ENV) go build $(LDFLAGS) -o bin/$(BINARY_NAME) ./cmd/$(BINARY_NAME)
ui:
cd ui && npm ci && npm run build
rm -rf internal/ui_dist && cp -r ui/dist internal/ui_dist
test: _ensure_ui_dist
$(GO_ENV) go test ./... -v -race
# _ensure_ui_dist: build the SPA only when internal/ui_dist/ is absent.
# This makes `make test` self-contained after `make clean` without forcing
# a full npm/vite rebuild on every run when internal/ui_dist/ already exists
# (e.g. in CI where it is checked in).
_ensure_ui_dist:
@if [ ! -f internal/ui_dist/index.html ]; then \
echo "internal/ui_dist missing — building SPA..."; \
$(MAKE) ui; \
fi
install: build
mkdir -p $(INSTALL_PATH)
cp bin/$(BINARY_NAME) $(INSTALL_PATH)/
cp plugin.json $(INSTALL_PATH)/
cp plugin.contracts.json $(INSTALL_PATH)/
clean:
rm -rf bin/ internal/ui_dist/