-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
210 lines (181 loc) Β· 8.34 KB
/
Makefile
File metadata and controls
210 lines (181 loc) Β· 8.34 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Makefile for Flippio project
# Updated Phony declaration
.PHONY: test-rust test-frontend test-all lint typecheck precommit dev build help generate-test-dbs test-database test-ios test-android test-cross-platform test-platforms quick-test-platforms verify-test-dbs test-performance clean-test dev-test test-real-commands coverage coverage-html coverage-text coverage-lcov coverage-json coverage-progress coverage-workflow clean-coverage
# Basic test targets
test-rust:
@echo "π§ͺ Running Rust tests..."
cd src-tauri && cargo test
test-frontend:
@echo "π§ͺ Running frontend tests..."
npm run test
# Generate test databases
generate-test-dbs:
@echo "π Generating test databases..."
node scripts/generate-test-databases.js
# Run comprehensive database tests
test-database:
@echo "π§ͺ Running database integration tests..."
cd src-tauri && cargo test database_isolation -- --nocapture
cd src-tauri && cargo test connection_pool -- --nocapture
cd src-tauri && cargo test wal_file_recovery -- --nocapture
# Run real Tauri command integration tests
test-real-commands: verify-test-dbs
@echo "π Running real Tauri command integration tests..."
cd src-tauri && cargo test database_isolation -- --nocapture
# Platform-specific tests
test-ios: verify-test-dbs
@echo "π Running iOS workflow tests..."
cd src-tauri && cargo test ios_workflow -- --nocapture
test-android: verify-test-dbs
@echo "π€ Running Android workflow tests..."
cd src-tauri && cargo test android_workflow -- --nocapture
test-cross-platform: verify-test-dbs
@echo "π Running cross-platform workflow tests..."
cd src-tauri && cargo test cross_platform_workflow -- --nocapture
test-platforms: test-ios test-android test-cross-platform
@echo "β
All platform-specific tests completed"
# Run all tests (frontend + backend + real commands)
test-all: generate-test-dbs test-platforms test-real-commands
@echo "π― Running comprehensive test suite..."
npm test
cd src-tauri && cargo test -- --nocapture
# Manual testing helper - verify test databases
verify-test-dbs:
@echo "π Verifying test databases..."
@if [ -f "src-tauri/tests/fixtures/databases/test_ecommerce.db" ]; then \
echo "β
E-commerce database exists"; \
echo "π Tables: `sqlite3 src-tauri/tests/fixtures/databases/test_ecommerce.db '.tables'`"; \
echo "π₯ Users: `sqlite3 src-tauri/tests/fixtures/databases/test_ecommerce.db 'SELECT COUNT(*) FROM users;'`"; \
else \
echo "β E-commerce database missing"; \
fi
@if [ -f "src-tauri/tests/fixtures/databases/test_social.db" ]; then \
echo "β
Social database exists"; \
echo "π Tables: `sqlite3 src-tauri/tests/fixtures/databases/test_social.db '.tables'`"; \
echo "π€ Profiles: `sqlite3 src-tauri/tests/fixtures/databases/test_social.db 'SELECT COUNT(*) FROM profiles;'`"; \
else \
echo "β Social database missing"; \
fi
@if [ -f "src-tauri/tests/fixtures/databases/test_notes.db" ]; then \
echo "β
Notes database exists"; \
echo "π Tables: `sqlite3 src-tauri/tests/fixtures/databases/test_notes.db '.tables'`"; \
echo "π Notes: `sqlite3 src-tauri/tests/fixtures/databases/test_notes.db 'SELECT COUNT(*) FROM notes;'`"; \
else \
echo "β Notes database missing"; \
fi
# Performance testing
test-performance:
@echo "β‘ Running performance tests..."
cd src-tauri && cargo test performance --release -- --nocapture
# Clean up test artifacts
clean-test:
@echo "π§Ή Cleaning test artifacts..."
rm -rf src-tauri/tests/fixtures/databases/*.db
rm -rf src-tauri/tests/fixtures/databases/*.db-wal
rm -rf src-tauri/tests/fixtures/databases/*.db-shm
find /tmp -name "*flippio*test*.db*" -delete 2>/dev/null || true
# Development test cycle
dev-test: test-real-commands test-platforms
@echo "π Development test cycle completed"
# Quick platform test (without regenerating databases)
quick-test-platforms: verify-test-dbs
@echo "β‘ Running all platform tests in parallel..."
cd src-tauri && cargo test ios_workflow android_workflow cross_platform_workflow -- --nocapture
@echo "β‘ Quick platform tests completed"
# Coverage targets
coverage: coverage-html
@echo "π Code coverage analysis completed"
coverage-html: verify-test-dbs
@echo "π Generating HTML coverage report..."
cd src-tauri && cargo llvm-cov --html --open
@echo "β
HTML coverage report generated and opened in browser"
@echo "π Report location: src-tauri/target/llvm-cov/html/index.html"
coverage-text: verify-test-dbs
@echo "π Generating text coverage report..."
cd src-tauri && cargo llvm-cov --text | tail -50
coverage-lcov: verify-test-dbs
@echo "π Generating LCOV coverage report..."
cd src-tauri && cargo llvm-cov --lcov --output-path target/llvm-cov/lcov.info
@echo "β
LCOV report generated: src-tauri/target/llvm-cov/lcov.info"
coverage-json: verify-test-dbs
@echo "π Generating JSON coverage report..."
cd src-tauri && cargo llvm-cov --json --output-path target/llvm-cov/coverage.json
@echo "β
JSON report generated: src-tauri/target/llvm-cov/coverage.json"
coverage-progress:
@echo "π― Coverage Progress Tracking"
@echo "=============================="
@cd src-tauri && echo "π Current Coverage:" && cargo llvm-cov --text --quiet 2>/dev/null | tail -3 | head -1 || echo "Run 'make coverage-text' first"
@echo ""
@echo "π Test Count:"
@cd src-tauri && cargo test 2>/dev/null | grep "test result:" | tail -1 || echo "Tests not run yet"
@echo ""
@echo "π― Target: 60%+ line coverage"
@echo "π Strategy: docs/COVERAGE_IMPROVEMENT_STRATEGY.md"
@echo ""
# Complete coverage workflow
coverage-workflow: verify-test-dbs coverage-text coverage-progress
@echo "β
Coverage analysis complete!"
@echo "π View detailed strategy: docs/COVERAGE_IMPROVEMENT_STRATEGY.md"
clean-coverage:
@echo "π§Ή Cleaning coverage artifacts..."
rm -rf src-tauri/target/llvm-cov/
@echo "β
Coverage artifacts cleaned"
# Linting and type checking
lint:
@echo "π Running frontend linter..."
npm run lint
typecheck:
@echo "π Running TypeScript type check..."
npm run typecheck
# Pre-commit hook
precommit: lint typecheck test-all
# Development build
dev:
@echo "π Starting development build..."
npm run tauri dev
# Production build
build:
@echo "ποΈ Building production version..."
npm run tauri build
# Help target
help:
@echo "π Flippio Makefile Commands:"
@echo ""
@echo "π§ͺ Testing Commands:"
@echo " test-rust - Run Rust backend tests"
@echo " test-frontend - Run frontend tests"
@echo " test-all - Run all tests (frontend + backend + platforms)"
@echo ""
@echo "ποΈ Database Testing:"
@echo " generate-test-dbs - Generate test databases for testing"
@echo " test-database - Run database integration tests"
@echo " test-real-commands - Run real Tauri command integration tests"
@echo " verify-test-dbs - Verify test databases are created correctly"
@echo " test-performance - Run database performance tests"
@echo " clean-test - Clean up test artifacts"
@echo ""
@echo "π± Platform Testing:"
@echo " test-ios - Run iOS workflow integration tests"
@echo " test-android - Run Android workflow integration tests"
@echo " test-cross-platform - Run cross-platform workflow tests"
@echo " test-platforms - Run all platform-specific tests"
@echo " quick-test-platforms - Quick platform tests (no db regeneration)"
@echo ""
@echo "π Coverage Analysis:"
@echo " coverage - Generate HTML coverage report (default)"
@echo " coverage-html - Generate interactive HTML coverage report"
@echo " coverage-text - Display text coverage summary"
@echo " coverage-lcov - Generate LCOV format report"
@echo " coverage-json - Generate JSON format report"
@echo " coverage-progress - Track current coverage progress"
@echo " coverage-workflow - Run full coverage analysis workflow"
@echo " clean-coverage - Clean up coverage artifacts"
@echo ""
@echo "π οΈ Development:"
@echo " dev-test - Real commands + platform tests cycle"
@echo " lint - Run linting"
@echo " typecheck - Run TypeScript type checking"
@echo " precommit - Run all checks before commit"
@echo " dev - Start development server"
@echo " build - Build production version"
@echo " help - Show this help message"