-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (110 loc) · 3.4 KB
/
Makefile
File metadata and controls
119 lines (110 loc) · 3.4 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.PHONY: help clone build sync sync-files clean version check-version
# Variables
HYPERDX_REPO := https://github.com/hyperdxio/hyperdx.git
HYPERDX_DIR := hyperdx
BUILD_DIR := hyperdx/packages/app/out
OUT_DIR := out
TAG ?= UNSET
# Default target - show help
help:
@echo "HyperDX Build Makefile"
@echo "======================"
@echo ""
@echo "Targets:"
@echo " make sync TAG=2.16.0 - Clone, build, and sync HyperDX (full workflow)"
@echo " make clone TAG=2.16.0 - Clone HyperDX at specific tag"
@echo " make build - Build HyperDX from cloned source"
@echo " make sync-files - Copy built files to repository"
@echo " make clean - Remove build directory"
@echo " make version - Show current synced version"
@echo " make check-version - Check if current version matches TAG"
@echo ""
@echo "Variables:"
@echo " TAG - HyperDX release tag version (REQUIRED)"
@echo ""
@echo "Examples:"
@echo " make sync TAG=2.16.0 - Sync specific version"
@echo ""
# Clone HyperDX repository
clone:
ifeq ($(TAG),UNSET)
@echo "Error: TAG is required"
@echo "Usage: make clone TAG=2.16.0"
@exit 1
endif
@echo "Cloning HyperDX $(TAG)..."
@rm -rf $(HYPERDX_DIR)
@git clone --depth 1 --branch @hyperdx/app@$(TAG) $(HYPERDX_REPO) $(HYPERDX_DIR)
@echo "✓ Successfully cloned HyperDX $(TAG)"
# Build HyperDX
build:
@if [ ! -d "$(HYPERDX_DIR)" ]; then \
echo "Error: HyperDX directory not found at $(HYPERDX_DIR)"; \
echo "Run 'make clone TAG=<version>' first"; \
exit 1; \
fi
@echo "Installing dependencies..."
cd $(HYPERDX_DIR) && yarn install --immutable
@echo "Building HyperDX..."
cd $(HYPERDX_DIR) && yarn build:clickhouse
@if [ ! -d "$(BUILD_DIR)" ]; then \
echo "Error: Build did not produce 'out' directory"; \
exit 1; \
fi
@echo "✓ Build completed successfully"
# Sync built files to repository
sync-files:
@if [ ! -d "$(BUILD_DIR)" ]; then \
echo "Error: Built 'out' directory not found"; \
echo "Run 'make build' first"; \
exit 1; \
fi
@echo "Syncing built files to repository..."
@rm -rf $(OUT_DIR)
@cp -r $(BUILD_DIR) $(OUT_DIR)
@echo "$(TAG)" > HYPERDX_VERSION
@echo "✓ Synced HyperDX $(TAG) to repository"
@echo " - Built files: ./$(OUT_DIR)"
@echo " - Version file: HYPERDX_VERSION"
# Full sync workflow (clone + build + sync)
sync: clean clone build sync-files
@echo ""
@echo "========================================="
@echo "✓ HyperDX $(TAG) successfully synced!"
@echo "========================================="
@echo ""
@echo "Next steps:"
@echo " - Review changes: git status"
@echo " - Commit changes: git add out HYPERDX_VERSION && git commit -m 'chore: sync HyperDX $(TAG)'"
@echo ""
# Clean up build directory
clean:
@if [ -d "$(HYPERDX_DIR)" ]; then \
echo "Cleaning up hyperdx directory..."; \
rm -rf $(HYPERDX_DIR); \
echo "✓ Build directory removed"; \
fi
# Show current synced version
version:
@if [ -f "HYPERDX_VERSION" ]; then \
echo "Current synced version: $$(cat HYPERDX_VERSION)"; \
else \
echo "No version synced yet"; \
echo "Run 'make sync TAG=<version>' to sync a version"; \
fi
# Check if current version matches TAG
check-version:
ifeq ($(TAG),UNSET)
@echo "Error: TAG is required"
@exit 1
endif
@if [ ! -f "HYPERDX_VERSION" ]; then \
echo "skip=false"; \
exit 0; \
fi
@CURRENT=$$(cat HYPERDX_VERSION); \
if [ "$$CURRENT" = "$(TAG)" ]; then \
echo "skip=true"; \
else \
echo "skip=false"; \
fi