-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (91 loc) · 3.41 KB
/
Copy pathMakefile
File metadata and controls
115 lines (91 loc) · 3.41 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
SHELL := /bin/bash
ROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
PLATFORM_DIR := $(ROOT_DIR)/platform
APP_DIR := $(PLATFORM_DIR)/apps/agent-sync-desktop
UI_DIR := $(PLATFORM_DIR)/apps/agent-sync-desktop/ui
TAURI_DIR := $(PLATFORM_DIR)/apps/agent-sync-desktop/src-tauri
.PHONY: all build run app lint lint-fix prepare-dotagents-runtime ensure-ui-dist lint-rust lint-fix-rust lint-ui lint-fix-ui lint-workflows test test-rust test-ui typecheck-ts check-rust hooks-install release check-arch test-e2e
all: app
app: run
build:
if ! cargo tauri --help >/dev/null 2>&1; then \
echo "cargo-tauri is not installed. Install it with: cargo install tauri-cli" >&2; \
exit 1; \
fi
if [[ ! -d "$(UI_DIR)/node_modules" ]]; then \
echo "Installing UI dependencies..."; \
(cd "$(UI_DIR)" && npm install); \
fi
cd "$(APP_DIR)" && cargo tauri build --debug
run:
"$(ROOT_DIR)/scripts/run-tauri-gui.sh"
lint: lint-rust lint-ui
lint-fix: lint-fix-rust lint-fix-ui lint
prepare-dotagents-runtime:
@if ! command -v npx >/dev/null 2>&1; then \
echo "npx is required (install Node.js and npm)." >&2; \
exit 1; \
fi
ensure-ui-dist:
mkdir -p "$(UI_DIR)/dist"
lint-rust: prepare-dotagents-runtime ensure-ui-dist
cd "$(PLATFORM_DIR)" && cargo fmt --all --check
cd "$(PLATFORM_DIR)" && cargo clippy --workspace --all-targets -- -D warnings
lint-fix-rust:
cd "$(PLATFORM_DIR)" && cargo fmt --all
lint-ui:
cd "$(UI_DIR)" && npm run lint
lint-fix-ui:
cd "$(UI_DIR)" && npm run lint:fix
lint-workflows:
@if ! command -v actionlint >/dev/null 2>&1; then \
echo "actionlint is required. Install from https://github.com/rhysd/actionlint"; \
exit 1; \
fi
@if ! command -v yamllint >/dev/null 2>&1; then \
echo "yamllint is required. Install with: pip install yamllint"; \
exit 1; \
fi
actionlint
yamllint -c .yamllint.yml .github/workflows
test: test-rust
test-rust: prepare-dotagents-runtime ensure-ui-dist
cd "$(PLATFORM_DIR)" && cargo test --workspace
test-ui:
cd "$(UI_DIR)" && npm run test
typecheck-ts:
cd "$(UI_DIR)" && npx tsc --noEmit
check-rust: prepare-dotagents-runtime ensure-ui-dist
cd "$(PLATFORM_DIR)" && cargo check --workspace
test-e2e:
cd "$(UI_DIR)" && npx playwright test
check-arch:
"$(ROOT_DIR)/scripts/check-architecture.sh"
hooks-install:
"$(ROOT_DIR)/scripts/install-git-hooks.sh"
release:
ifndef VERSION
$(error VERSION is required. Usage: make release VERSION=0.2.0)
endif
@if ! echo "$(VERSION)" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$$'; then \
echo "Error: VERSION must be semver (e.g. 0.2.0)" >&2; exit 1; \
fi
@if ! git diff --quiet || ! git diff --cached --quiet; then \
echo "Error: working tree is not clean. Commit or stash changes first." >&2; exit 1; \
fi
@if git rev-parse "v$(VERSION)" >/dev/null 2>&1; then \
echo "Error: tag v$(VERSION) already exists." >&2; exit 1; \
fi
$(MAKE) lint
@echo "Bumping version to $(VERSION)..."
sed -i '' 's/^version = ".*"/version = "$(VERSION)"/' "$(PLATFORM_DIR)/Cargo.toml"
sed -i '' 's/"version": ".*"/"version": "$(VERSION)"/' "$(TAURI_DIR)/tauri.conf.json"
sed -i '' 's/"version": ".*"/"version": "$(VERSION)"/' "$(UI_DIR)/package.json"
cd "$(PLATFORM_DIR)" && cargo update --workspace
git add "$(PLATFORM_DIR)/Cargo.toml" "$(PLATFORM_DIR)/Cargo.lock" \
"$(TAURI_DIR)/tauri.conf.json" "$(UI_DIR)/package.json"
git commit -m "release: v$(VERSION)"
git tag "v$(VERSION)"
git push
git push origin "v$(VERSION)"
@echo "Released v$(VERSION)"