-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (58 loc) · 1.94 KB
/
Makefile
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
include .env
export
.PHONY: all check-rust-version build-plugin validate-plugin build-run run stop clean restart register-root-ca
# Default target
all: check-rust-version build-plugin run
# Check Rust version
check-rust-version:
@echo "Checking Rust version..."
@if command -v rustc >/dev/null 2>&1; then \
current_version=$$(rustc -V | awk '{print $$2}'); \
if [ "$$current_version" != "$(RUST_VERSION)" ]; then \
echo "Error: Rust version $(RUST_VERSION) is required, but $$current_version is installed."; \
echo "Please install the correct version or use rustup to switch versions."; \
exit 1; \
else \
echo "Rust version $(RUST_VERSION) is installed."; \
fi \
else \
echo "Error: Rust is not installed. Please install Rust $(RUST_VERSION)."; \
exit 1; \
fi
# Generate rust-toolchain.toml
generate-rust-toolchain:
@./generate-rust-toolchain.sh
# Tests the WASM plugin
test-plugin: check-rust-version generate-rust-toolchain
@echo "Testing WASM plugin..."
@cd treblle-wasm-plugin && cargo test
# Build the WASM plugin
build-plugin: test-plugin
@echo "Building WASM plugin..."
@cd treblle-wasm-plugin && ./build.sh
# Validate the WASM plugin binary exports
validate-plugin:
@./validate-wasm-output.sh
# Run Docker Compose
run: build-plugin validate-plugin
@echo "Starting services with Docker Compose..."
docker network create treblle-network
docker compose up -d
# Stop Docker Compose
stop:
@echo "Stopping services with Docker Compose..."
docker compose down
# Run Docker Compose with Build
build-run: build-plugin validate-plugin
@echo "Starting services with Docker Compose..."
docker compose up -d --build
# Clean up
clean:
@echo "Cleaning up..."
docker compose down -v --remove-orphans
docker system prune -af --volumes
rm -rf plugins-local/src
# Helper target to rebuild and restart
restart: clean all
register-root-ca:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./certs/rootCA.pem