diff --git a/.forgejo/workflows/ci-native.yml b/.forgejo/workflows/ci-native.yml new file mode 100644 index 0000000..4ca2c3d --- /dev/null +++ b/.forgejo/workflows/ci-native.yml @@ -0,0 +1,76 @@ +name: CI with Native Libraries + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test-native: + runs-on: self-hosted + + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.25' + + - name: Setup CMake + run: | + # Install cmake if not present (adjust for your self-hosted OS) + which cmake || (apt-get update && apt-get install -y cmake zlib1g-dev 2>/dev/null || brew install cmake zlib) + + - name: Build Native Libraries + run: make native-build + + - name: Test with Native Libraries + run: FETCHML_NATIVE_LIBS=1 go test -v ./tests/... + env: + FETCHML_NATIVE_LIBS: "1" + + - name: Test Fallback (Go only) + run: FETCHML_NATIVE_LIBS=0 go test -v ./tests/... + env: + FETCHML_NATIVE_LIBS: "0" + + - name: Run Benchmarks + run: | + echo "=== Go Implementation ===" + FETCHML_NATIVE_LIBS=0 go test -bench=. ./tests/benchmarks/ -benchmem + echo "" + echo "=== Native Implementation ===" + FETCHML_NATIVE_LIBS=1 go test -bench=. ./tests/benchmarks/ -benchmem + + - name: Lint + run: | + make lint || true + + build-release: + runs-on: self-hosted + needs: test-native + + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.25' + + - name: Setup Build Tools + run: | + which cmake || (apt-get update && apt-get install -y cmake zlib1g-dev 2>/dev/null || brew install cmake zlib) + + - name: Build Release Libraries + run: make native-release + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: native-libs-${{ runner.os }}-${{ runner.arch }} + path: | + native/build/lib*.so + native/build/lib*.dylib