chore: updated and linted #216
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 WASM | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/actions/**' | |
| - '.github/workflows/ci-wasm.yaml' | |
| - '.cargo/config.toml' | |
| - 'rust-toolchain.toml' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'crates/kreuzberg/**' | |
| - 'crates/kreuzberg-wasm/**' | |
| - 'packages/typescript/core/**' | |
| - 'packages/wasm/**' | |
| - 'e2e/wasm/**' | |
| - 'e2e/wasm-deno/**' | |
| - 'e2e/wasm-workers/**' | |
| - 'test_documents/**' | |
| - 'fixtures/**' | |
| - 'tools/e2e-generator/**' | |
| - 'pnpm-lock.yaml' | |
| - 'package.json' | |
| - 'scripts/ci/wasm/**' | |
| - 'scripts/ci/cache/**' | |
| - 'scripts/ci/actions/**' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/actions/**' | |
| - '.github/workflows/ci-wasm.yaml' | |
| - '.cargo/config.toml' | |
| - 'rust-toolchain.toml' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'crates/kreuzberg/**' | |
| - 'crates/kreuzberg-wasm/**' | |
| - 'packages/typescript/core/**' | |
| - 'packages/wasm/**' | |
| - 'e2e/wasm/**' | |
| - 'e2e/wasm-deno/**' | |
| - 'e2e/wasm-workers/**' | |
| - 'test_documents/**' | |
| - 'fixtures/**' | |
| - 'tools/e2e-generator/**' | |
| - 'pnpm-lock.yaml' | |
| - 'package.json' | |
| - 'scripts/ci/wasm/**' | |
| - 'scripts/ci/cache/**' | |
| - 'scripts/ci/actions/**' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-wasm-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_PROFILE_DEV_DEBUG: 0 | |
| RUST_BACKTRACE: short | |
| RUST_MIN_STACK: 16777216 | |
| PDFIUM_VERSION: "7578" | |
| PDFIUM_STATIC_VERSION: "7442b" | |
| PDFIUM_WASM_VERSION: "7442b" | |
| MACOSX_DEPLOYMENT_TARGET: "14.0" | |
| WASM_RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory -C link-arg=--shared-memory -C link-arg=--max-memory=2147483648 -C link-arg=--import-memory -C link-arg=--export=__wasm_init_tls -C link-arg=--export=__tls_size -C link-arg=--export=__tls_align -C link-arg=--export=__tls_base" | |
| BUILD_PROFILE: "ci" | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests (${{ matrix.os }}) | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 180 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| - os: macos-latest | |
| - os: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| uses: ./.github/actions/install-system-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| cache-key-prefix: wasm-test-${{ matrix.os }} | |
| target: wasm32-unknown-unknown | |
| - name: Setup Node | |
| uses: ./.github/actions/setup-node-workspace | |
| - name: Install wasm-pack | |
| shell: bash | |
| run: scripts/ci/wasm/install-wasm-pack.sh | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Run WASM tests | |
| shell: bash | |
| working-directory: crates/kreuzberg-wasm | |
| run: pnpm run build --minify && pnpm test | |
| env: | |
| RUST_BACKTRACE: 1 | |
| - name: Cleanup Rust cache | |
| if: always() | |
| uses: ./.github/actions/cleanup-rust-cache | |
| build-wasm-targets: | |
| name: Build WASM (${{ matrix.os }}) | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 180 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| uses: ./.github/actions/install-system-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| cache-key-prefix: wasm-build-${{ matrix.target }} | |
| target: wasm32-unknown-unknown | |
| - name: Setup Node | |
| uses: ./.github/actions/setup-node-workspace | |
| - name: Install wasm-pack | |
| shell: bash | |
| run: scripts/ci/wasm/install-wasm-pack.sh | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Build or restore WASM bindings from cache | |
| id: wasm | |
| uses: ./.github/actions/build-and-cache-binding | |
| with: | |
| binding-name: wasm | |
| platform: ${{ matrix.os }} | |
| task-command: wasm:build:ci | |
| cache-paths: | | |
| crates/kreuzberg-wasm/pkg/ | |
| cache-version: v1 | |
| rust-hash: "n/a" | |
| binding-files: | | |
| crates/kreuzberg-wasm/** | |
| dep-files: | | |
| Cargo.lock | |
| crates/kreuzberg-wasm/Cargo.toml | |
| env: | |
| RUSTFLAGS: ${{ env.WASM_RUSTFLAGS }} | |
| - name: Upload WASM artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: wasm-${{ matrix.target }} | |
| path: | | |
| crates/kreuzberg-wasm/pkg/*.wasm | |
| crates/kreuzberg-wasm/pkg/*.js | |
| crates/kreuzberg-wasm/pkg/*.ts | |
| crates/kreuzberg-wasm/pkg/package.json | |
| retention-days: 7 | |
| - name: Cleanup Rust cache | |
| if: always() | |
| uses: ./.github/actions/cleanup-rust-cache | |
| type-definitions: | |
| name: Type Definitions Check | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| cache-key-prefix: wasm-types | |
| target: wasm32-unknown-unknown | |
| - name: Setup Node | |
| uses: ./.github/actions/setup-node-workspace | |
| - name: Install wasm-pack | |
| shell: bash | |
| run: scripts/ci/wasm/install-wasm-pack.sh | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Build WASM (required for type generation) | |
| shell: bash | |
| run: task wasm:build:bundler | |
| env: | |
| RUSTFLAGS: ${{ env.WASM_RUSTFLAGS }} | |
| - name: Type-check WASM | |
| shell: bash | |
| run: task wasm:typecheck | |
| env: | |
| NODE_ENV: production | |
| - name: Verify .d.ts files exist | |
| shell: bash | |
| run: scripts/ci/wasm/verify-dts-files.sh | |
| - name: Cleanup Rust cache | |
| if: always() | |
| uses: ./.github/actions/cleanup-rust-cache | |
| integration-tests-node: | |
| name: Integration Tests (Node ${{ matrix.node-version }}) | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| needs: [build-wasm-targets] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: ["22"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: ./.github/actions/setup-node-workspace | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Download WASM artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: wasm-x86_64-unknown-linux-gnu | |
| path: crates/kreuzberg-wasm/pkg/ | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| cache-key-prefix: wasm-test-ubuntu | |
| target: wasm32-unknown-unknown | |
| - name: Install wasm-pack | |
| shell: bash | |
| run: scripts/ci/wasm/install-wasm-pack.sh | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Run WASM tests | |
| shell: bash | |
| run: task wasm:test:ci | |
| deno-tests: | |
| name: Deno Tests | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| uses: ./.github/actions/install-system-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| cache-key-prefix: wasm-deno-ubuntu | |
| target: wasm32-unknown-unknown | |
| - name: Setup Node (for wasm-pack and build tools) | |
| uses: ./.github/actions/setup-node-workspace | |
| - name: Install wasm-pack | |
| shell: bash | |
| run: scripts/ci/wasm/install-wasm-pack.sh | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Install Deno | |
| uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: "2.x" | |
| - name: Build WASM (all targets for E2E) | |
| shell: bash | |
| run: task wasm:build:all | |
| env: | |
| RUSTFLAGS: ${{ env.WASM_RUSTFLAGS }} | |
| - name: Generate Deno E2E tests | |
| shell: bash | |
| run: task wasm:e2e:deno:generate | |
| - name: Run Deno E2E tests | |
| shell: bash | |
| run: task wasm:e2e:deno:test | |
| - name: Cleanup Rust cache | |
| if: always() | |
| uses: ./.github/actions/cleanup-rust-cache | |
| workers-tests: | |
| name: Cloudflare Workers Tests | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| uses: ./.github/actions/install-system-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| cache-key-prefix: wasm-workers | |
| target: wasm32-unknown-unknown | |
| - name: Setup Node | |
| uses: ./.github/actions/setup-node-workspace | |
| - name: Install wasm-pack | |
| run: scripts/ci/wasm/install-wasm-pack.sh | |
| - name: Install Task | |
| uses: ./.github/actions/install-task | |
| - name: Build WASM (all targets for E2E) | |
| run: task wasm:build:all | |
| env: | |
| RUSTFLAGS: ${{ env.WASM_RUSTFLAGS }} | |
| - name: Verify WASM size for Workers | |
| run: scripts/ci/wasm/verify-workers-wasm-size.sh | |
| - name: Generate Workers E2E tests | |
| run: task wasm:e2e:workers:generate | |
| - name: Run Cloudflare Workers E2E tests | |
| run: task wasm:e2e:workers:test | |
| - name: Cleanup Rust cache | |
| if: always() | |
| uses: ./.github/actions/cleanup-rust-cache |