-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (56 loc) · 2.15 KB
/
Makefile
File metadata and controls
71 lines (56 loc) · 2.15 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# SharkAuth Unified Makefile
# Supports Windows (Git Bash/MSYS2) and Linux
BINARY_NAME := shark
ifeq ($(OS),Windows_NT)
BINARY := $(BINARY_NAME).exe
# Use standard shell commands available in Git Bash/MSYS2
RM := rm -f
RMDIR := rm -rf
else
BINARY := $(BINARY_NAME)
RM := rm -f
RMDIR := rm -rf
endif
PKG := ./cmd/shark
GO_PACKAGES := ./cmd/... ./internal/... ./tests/...
LDFLAGS := -s -w -X github.com/shark-auth/shark/internal/version.Version=0.1.0 -X "github.com/shark-auth/shark/internal/version.Commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)" -X "github.com/shark-auth/shark/internal/version.BuildTime=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)"
GOFLAGS := -trimpath -ldflags="$(LDFLAGS)"
.PHONY: all build test verify verify-full lint run clean frontend-build binary-build docker
all: build
# Frontend installation
frontend-install:
@echo ">> installing frontend dependencies"
@cd admin && npm install
# Frontend build
frontend-build:
@echo ">> building frontend (admin)"
@cd admin && $(if $(filter Windows_NT,$(OS)),npm run build,NODE_OPTIONS=--max-old-space-size=4096 pnpm build)
# Binary build
# binary-build now depends on frontend-build to ensure assets are always up to date
binary-build: frontend-build
@echo ">> building binary -> $(BINARY)"
go build $(GOFLAGS) -o $(BINARY) $(PKG)
build: binary-build
test:
go test -race -count=1 $(GO_PACKAGES)
# Basic verification
verify:
go vet $(GO_PACKAGES)
go test -count=1 $(GO_PACKAGES)
# Full verification for release/CI
# Integration and E2E tests are often skipped on local Windows dev unless specifically requested
verify-full: verify
go test -race -count=1 -tags=integration $(GO_PACKAGES)
$(if $(filter Windows_NT,$(OS)),,@go test -race -count=1 -tags=e2e ./internal/testutil/e2e/...)
lint:
@which golangci-lint > /dev/null 2>&1 || { echo "golangci-lint not installed"; exit 1; }
golangci-lint run ./...
run: build
./$(BINARY) serve --dev $(if $(filter Windows_NT,$(OS)),,--proxy-upstream http://localhost:3000)
clean:
@echo ">> cleaning"
$(RM) $(BINARY)
$(RMDIR) internal/admin/dist
$(RM) sharkauth.exe $(BINARY_NAME)
docker:
docker build -t sharkauth .