feat(js): add JS/TS WASM evaluator with comparison benchmarks #321
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| jobs: | ||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| - name: Cache cargo | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/bin/ | ||
| ~/.cargo/registry/index/ | ||
| ~/.cargo/registry/cache/ | ||
| ~/.cargo/git/db/ | ||
| target/ | ||
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-cargo-test- | ||
| - name: Run tests | ||
| run: cargo test --verbose | ||
| clippy: | ||
| name: Clippy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy | ||
| - name: Cache cargo | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/bin/ | ||
| ~/.cargo/registry/index/ | ||
| ~/.cargo/registry/cache/ | ||
| ~/.cargo/git/db/ | ||
| target/ | ||
| key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-cargo-clippy- | ||
| - name: Run Clippy | ||
| run: cargo clippy -- -D warnings | ||
| fmt: | ||
| name: Format | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt | ||
| - name: Check formatting | ||
| run: cargo fmt -- --check | ||
| build-wasm: | ||
| name: Build WASM | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: wasm32-unknown-unknown | ||
| - name: Cache cargo | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/bin/ | ||
| ~/.cargo/registry/index/ | ||
| ~/.cargo/registry/cache/ | ||
| ~/.cargo/git/db/ | ||
| target/ | ||
| key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-cargo-wasm- | ||
| - name: Build WASM | ||
| run: cargo build --target wasm32-unknown-unknown --no-default-features --release --lib | ||
| - name: Upload WASM artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: flagd_evaluator.wasm | ||
| path: target/wasm32-unknown-unknown/release/flagd_evaluator.wasm | ||
| retention-days: 30 | ||
| test-go: | ||
| name: Test Go Package | ||
| needs: build-wasm | ||
| runs-on: ubuntu-latest | ||
| if: hashFiles('go/go.mod') != '' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
| cache-dependency-path: go/go.sum | ||
| - name: Download WASM artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: flagd_evaluator.wasm | ||
| path: go/ | ||
| - name: Run Go tests | ||
| run: cd go && go test -v -count=1 ./... | ||
| test-python: | ||
| name: Test Python Bindings | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: wasm32-unknown-unknown | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.9' | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| enable-cache: true | ||
| - name: Build WASM for Python WASM evaluator | ||
| run: | | ||
| cargo build --target wasm32-unknown-unknown --no-default-features --release --lib | ||
| cp target/wasm32-unknown-unknown/release/flagd_evaluator.wasm python/flagd_evaluator_wasm/flagd_evaluator.wasm | ||
| - name: Install dependencies and build package | ||
| run: | | ||
| cd python | ||
| uv sync --group dev | ||
| source .venv/bin/activate | ||
| maturin develop | ||
| - name: Run Python tests | ||
| run: | | ||
| cd python | ||
| source .venv/bin/activate | ||
| pytest tests/ -v | ||
| test-java: | ||
| name: Test Java Library | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up JDK 11 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '11' | ||
| distribution: 'temurin' | ||
| cache: 'maven' | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: wasm32-unknown-unknown | ||
| - name: Cache cargo | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/bin/ | ||
| ~/.cargo/registry/index/ | ||
| ~/.cargo/registry/cache/ | ||
| ~/.cargo/git/db/ | ||
| target/ | ||
| key: ${{ runner.os }}-cargo-java-${{ hashFiles('**/Cargo.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-cargo-java- | ||
| - name: Make Maven wrapper executable | ||
| run: chmod +x java/mvnw | ||
| - name: Build with Maven | ||
| run: cd java && ./mvnw clean verify | ||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: java-test-results | ||
| path: java/target/surefire-reports/ | ||
| retention-days: 30 | ||
| - name: Upload Java JAR artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: java-library | ||
| path: | | ||
| java/target/*.jar | ||
| retention-days: 30 | ||