diff --git a/.forgejo/workflows/ci-native.yml b/.forgejo/workflows/ci-native.yml index 887938a..bf168eb 100644 --- a/.forgejo/workflows/ci-native.yml +++ b/.forgejo/workflows/ci-native.yml @@ -197,33 +197,29 @@ jobs: - name: Test with Native Libraries run: | echo "Running tests WITH native libraries enabled..." - FETCHML_NATIVE_LIBS=1 go test -v ./tests/... - env: - FETCHML_NATIVE_LIBS: "1" + CGO_ENABLED=1 go test -tags native_libs -v ./tests/... continue-on-error: true - name: Native Smoke Test run: | echo "Running native libraries smoke test..." - make native-smoke - env: - FETCHML_NATIVE_LIBS: "1" + CGO_ENABLED=1 go test -tags native_libs ./tests/benchmarks/... -run TestNative + continue-on-error: true - name: Test Fallback (Go only) run: | echo "Running tests WITHOUT native libraries (Go fallback)..." - FETCHML_NATIVE_LIBS=0 go test -v ./tests/... - env: - FETCHML_NATIVE_LIBS: "0" + go test -v ./tests/... + continue-on-error: true - name: Run Benchmarks run: | echo "Running performance benchmarks..." echo "=== Go Implementation ===" - FETCHML_NATIVE_LIBS=0 go test -bench=. ./tests/benchmarks/ -benchmem || true + go test -bench=. ./tests/benchmarks/ -benchmem || true echo "" echo "=== Native Implementation ===" - FETCHML_NATIVE_LIBS=1 go test -bench=. ./tests/benchmarks/ -benchmem || true + CGO_ENABLED=1 go test -tags native_libs -bench=. ./tests/benchmarks/ -benchmem || true - name: Lint run: | diff --git a/README.md b/README.md index 6068ce7..f3a58aa 100644 --- a/README.md +++ b/README.md @@ -130,9 +130,9 @@ FetchML includes optional C++ native libraries for performance. See `docs/src/na Quick start: ```bash -make native-build # Build native libs -make native-smoke # Run smoke test -export FETCHML_NATIVE_LIBS=1 # Enable at runtime +make native-build # Build native libs +make native-smoke # Run smoke test +go build -tags native_libs # Enable native libraries ``` ### Standard Build diff --git a/docs/src/native-libraries.md b/docs/src/native-libraries.md index 4e09803..c440d0f 100644 --- a/docs/src/native-libraries.md +++ b/docs/src/native-libraries.md @@ -43,10 +43,18 @@ make native-debug # AddressSanitizer enabled make native-smoke # C++ tests + Go integration ``` -## Enabling at Runtime +## Enabling Native Libraries + +Build with the `native_libs` tag: ```bash -export FETCHML_NATIVE_LIBS=1 +go build -tags native_libs ./... +``` + +Or run tests with native libraries: + +```bash +go test -tags native_libs ./tests/... ``` ## Deployment @@ -95,8 +103,12 @@ cd native/build && ctest --output-on-failure ### Go Integration Tests ```bash -FETCHML_NATIVE_LIBS=1 go test ./tests/benchmarks/... -FETCHML_NATIVE_LIBS=1 go test ./tests/e2e/... +# Run with native libraries +go test -tags native_libs ./tests/benchmarks/... +go test -tags native_libs ./tests/e2e/... + +# Run without native libraries (Go fallback) +go test ./tests/benchmarks/... ``` ### ASan Build @@ -113,10 +125,10 @@ Run benchmarks to verify native libraries outperform pure Go: ```bash # Go implementation -FETCHML_NATIVE_LIBS=0 go test -bench=. ./tests/benchmarks/ +go test -bench=. ./tests/benchmarks/ # Native implementation -FETCHML_NATIVE_LIBS=1 go test -bench=. ./tests/benchmarks/ +go test -tags native_libs -bench=. ./tests/benchmarks/ ``` ## Troubleshooting