diff --git a/Makefile b/Makefile index b30d728..8b5cb44 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all build prod prod-with-native native-release native-build native-debug native-test native-smoke native-clean dev clean clean-docs test test-unit test-integration test-e2e test-coverage lint install configlint worker-configlint ci-local docs docs-setup docs-check-port docs-stop docs-build docs-build-prod benchmark benchmark-local artifacts clean-benchmarks clean-all clean-aggressive status size load-test chaos-test profile-load profile-load-norate profile-ws-queue profile-tools detect-regressions tech-excellence docker-build dev-smoke prod-smoke native-smoke self-cleanup test-full test-auth deploy-up deploy-down deploy-status deploy-clean dev-up dev-down dev-status dev-logs prod-up prod-down prod-status prod-logs security-scan gosec govulncheck check-unsafe security-audit test-security check-sqlbuild +.PHONY: all build prod prod-with-native native-release native-build native-debug native-test native-smoke native-clean dev clean clean-docs test test-unit test-integration test-e2e test-coverage lint install configlint worker-configlint ci-local docs docs-setup docs-check-port docs-stop docs-build docs-build-prod benchmark benchmark-local benchmark-native artifacts clean-benchmarks clean-all clean-aggressive status size load-test chaos-test profile-load profile-load-norate profile-ws-queue profile-tools detect-regressions detect-regressions-native tech-excellence docker-build dev-smoke prod-smoke native-smoke self-cleanup test-full test-auth deploy-up deploy-down deploy-status deploy-clean dev-up dev-down dev-status dev-logs prod-up prod-down prod-status prod-logs security-scan gosec govulncheck check-unsafe security-audit test-security check-sqlbuild OK = ✓ DOCS_PORT ?= 1313 DOCS_BIND ?= 127.0.0.1 @@ -369,6 +369,19 @@ detect-regressions: @$(MAKE) profile-tools @./bin/performance-regression-detector -baseline tests/bin/baseline.bench.txt -current tests/bin/current.bench.txt -threshold $(REGRESSION_THRESHOLD) +# Performance regression detection with native libraries +detect-regressions-native: native-build + @echo "Detecting performance regressions with native libraries..." + @mkdir -p tests/bin + @if [ ! -f "tests/bin/baseline-native.bench.txt" ]; then \ + echo "Creating native baseline performance metrics..."; \ + go test -bench=. -benchmem -tags native_libs ./tests/benchmarks/... | tee tests/bin/baseline-native.bench.txt; \ + fi + @echo "Analyzing current native performance against baseline..." + @go test -bench=. -benchmem -tags native_libs ./tests/benchmarks/... | tee tests/bin/current-native.bench.txt + @$(MAKE) profile-tools + @./bin/performance-regression-detector -baseline tests/bin/baseline-native.bench.txt -current tests/bin/current-native.bench.txt -threshold $(REGRESSION_THRESHOLD) + # Technical excellence suite (runs all performance tests) complete-suite: benchmark load-test chaos-test profile-tools @echo "Technical excellence test suite completed" @@ -419,20 +432,22 @@ help: @echo " make install - Install binaries to /usr/local/bin (requires sudo)" @echo "" @echo "Performance Testing:" - @echo " make benchmark - Run performance benchmarks" - @echo " make benchmark-local - Run benchmarks locally with artifact management" - @echo " make artifacts - Manage benchmark artifacts (list, clean, compare, export)" - @echo " make clean-benchmarks - Clean benchmark artifacts (keep last 10)" - @echo " make clean-all - Comprehensive cleanup (keep last 5 runs)" - @echo " make clean-aggressive - Aggressive cleanup (removes more data)" - @echo " make status - Show disk usage status" - @echo " make load-test - Run load testing suite" - @echo " make profile-load - CPU profile MediumLoad HTTP test suite" - @echo " make profile-ws-queue - CPU profile WebSocket→queue→worker path" - @echo " make chaos-test - Run chaos engineering tests" - @echo " make profile-tools - Build performance profiling tools" - @echo " make detect-regressions - Detect performance regressions" - @echo " make complete-suite - Run complete technical suite" + @echo " make benchmark - Run performance benchmarks" + @echo " make benchmark-local - Run benchmarks locally with artifact management" + @echo " make benchmark-native - Run benchmarks with native libraries" + @echo " make artifacts - Manage benchmark artifacts (list, clean, compare, export)" + @echo " make clean-benchmarks - Clean benchmark artifacts (keep last 10)" + @echo " make clean-all - Comprehensive cleanup (keep last 5 runs)" + @echo " make clean-aggressive - Aggressive cleanup (removes more data)" + @echo " make status - Show disk usage status" + @echo " make load-test - Run load testing suite" + @echo " make profile-load - CPU profile MediumLoad HTTP test suite" + @echo " make profile-ws-queue - CPU profile WebSocket→queue→worker path" + @echo " make chaos-test - Run chaos engineering tests" + @echo " make profile-tools - Build performance profiling tools" + @echo " make detect-regressions - Detect performance regressions" + @echo " make detect-regressions-native - Detect performance regressions with native libs" + @echo " make complete-suite - Run complete technical suite" @echo "" @echo "Documentation:" @echo " make docs-setup - Validate Hugo is installed" diff --git a/cli/build.zig b/cli/build.zig index ae275e8..74aa3f7 100644 --- a/cli/build.zig +++ b/cli/build.zig @@ -99,11 +99,21 @@ pub fn build(b: *std.Build) void { // LTO disabled: requires LLD linker which may not be available // exe.want_lto = true; - // Link native dataset_hash library + // Check if we're cross-compiling (target differs from host) + const host_target = b.graph.host; + const is_cross_compiling = (target.result.os.tag != host_target.query.os_tag) or + (target.result.cpu.arch != host_target.query.cpu_arch); + + // Link native dataset_hash library (only when not cross-compiling) exe.linkLibC(); - exe.addLibraryPath(b.path("../native/build")); - exe.linkSystemLibrary("dataset_hash"); - exe.addIncludePath(b.path("../native/dataset_hash")); + if (!is_cross_compiling) { + exe.addLibraryPath(b.path("../native/build")); + exe.linkSystemLibrary("dataset_hash"); + exe.addIncludePath(b.path("../native/dataset_hash")); + } else { + // Cross-compiling: native library not available, skip it + std.log.warn("Cross-compiling detected - skipping native library linking", .{}); + } // SQLite setup: embedded for ReleaseSmall only, system lib for dev const use_embedded_sqlite = has_sqlite_release and (optimize == .ReleaseSmall);