Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Local mirror of the .github/workflows/pr.yml checks.
  2. # Keep this in sync with the workflow. Run `make check` before pushing.
  3. SHELL := /bin/bash
  4. AGENT_VERSION ?= 0.0.0-dev
  5. GO ?= go
  6. NPM ?= npm
  7. AGENT_BIN := server-go/internal/agentbin/agents
  8. .PHONY: check frontend agents server agent collector clean
  9. check: frontend agents server agent
  10. @echo "check: all steps passed"
  11. frontend:
  12. cd app && $(NPM) ci --no-audit --no-fund
  13. cd app && $(NPM) run lint
  14. cd app && $(NPM) run build
  15. rm -rf server-go/internal/staticspa/dist
  16. cp -r app/dist server-go/internal/staticspa/dist
  17. # The agent binaries are go:embed inputs of the server, so they must exist
  18. # before the server compiles. Arch names follow normalizeArch: armv7 is
  19. # "arm" with GOARM=7 and MIPS is softfloat.
  20. agents:
  21. @mkdir -p $(AGENT_BIN)
  22. cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -trimpath -ldflags "-s -w -X main.Version=$(AGENT_VERSION)" -o ../$(AGENT_BIN)/netpulse-agent-amd64 ./cmd/netpulse-agent
  23. cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -trimpath -ldflags "-s -w -X main.Version=$(AGENT_VERSION)" -o ../$(AGENT_BIN)/netpulse-agent-arm64 ./cmd/netpulse-agent
  24. cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GO) build -trimpath -ldflags "-s -w -X main.Version=$(AGENT_VERSION)" -o ../$(AGENT_BIN)/netpulse-agent-arm ./cmd/netpulse-agent
  25. cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat $(GO) build -trimpath -ldflags "-s -w -X main.Version=$(AGENT_VERSION)" -o ../$(AGENT_BIN)/netpulse-agent-mipsle ./cmd/netpulse-agent
  26. cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat $(GO) build -trimpath -ldflags "-s -w -X main.Version=$(AGENT_VERSION)" -o ../$(AGENT_BIN)/netpulse-agent-mips ./cmd/netpulse-agent
  27. server:
  28. cd server-go && $(GO) test ./...
  29. agent:
  30. cd agent && $(GO) test ./...
  31. # The collector is its own module and is not part of the PR workflow.
  32. collector:
  33. cd collector && $(GO) test ./...
  34. clean:
  35. rm -rf app/dist server-go/internal/staticspa/dist