minigraf 1.0.0

Zero-config, single-file, embedded graph database with bi-temporal Datalog queries
Documentation
name: WASM Browser

on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

env:
  CARGO_TERM_COLOR: always

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown

      - name: Install wasm-pack
        run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

      - name: Build (release)
        run: wasm-pack build --target web --features browser

      - name: Rename pkg/ → minigraf-wasm/
        run: mv pkg minigraf-wasm

      - name: Check gzipped binary size
        run: |
          SIZE=$(gzip -c minigraf-wasm/minigraf_bg.wasm | wc -c)
          echo "Gzipped WASM size: ${SIZE} bytes"
          if [ "$SIZE" -gt 1048576 ]; then
            echo "WARNING: exceeds 1 MB gzipped budget (${SIZE} bytes)"
          fi

      - name: Upload pkg artifact
        uses: actions/upload-artifact@v4
        with:
          name: wasm-pkg
          path: minigraf-wasm/

  test:
    needs: build
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        browser: [chrome, firefox]
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown

      - name: Install wasm-pack
        run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

      - name: Setup Chrome
        if: matrix.browser == 'chrome'
        uses: browser-actions/setup-chrome@v1

      - name: Setup Firefox
        if: matrix.browser == 'firefox'
        uses: browser-actions/setup-firefox@v1

      - name: Test (headless ${{ matrix.browser }})
        run: wasm-pack test --headless --${{ matrix.browser }} --features browser