name: wasm # Manual only: CI runs locally (tools/ci/local.sh, docs/testing.md). on: workflow_dispatch: # Called by release.yml to build the release from its tag. workflow_call: inputs: ref: description: Git ref to build; empty for the ref of the run type: string default: "" jobs: wasm: runs-on: ubuntu-latest defaults: run: working-directory: npm steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} # Nightly + rust-src builds the multithreaded variant (-Z build-std with atomics); # stable (installed last, so it is the default) builds everything else. - uses: dtolnay/rust-toolchain@nightly with: targets: wasm32-unknown-unknown components: rust-src, clippy - uses: dtolnay/rust-toolchain@stable with: targets: wasm32-unknown-unknown components: clippy - uses: Swatinem/rust-cache@v2 - uses: actions/setup-node@v4 with: node-version: 24 cache: npm cache-dependency-path: npm/package-lock.json - name: Native unit tests of the bindings working-directory: . run: cargo test -p flashraw-wasm - name: Native CLI (expected hashes for the WASM tests, JPEG XL included) working-directory: . run: cargo build --release -p flashraw-cli --features jpegxl # Not in release builds (release.yml passes a tag as `ref`): the local CI lints before tagging, and a newer # toolchain's new lints must not block publishing a tag that cannot change. - name: Clippy (single-threaded, WebGPU, threaded and JPEG XL bindings) if: inputs.ref == '' working-directory: . run: | cargo clippy -p flashraw-wasm --target wasm32-unknown-unknown -- -D warnings cargo clippy -p flashraw-wasm --target wasm32-unknown-unknown --features gpu cargo clippy -p flashraw-wasm --target wasm32-unknown-unknown --features jpegxl -- -D warnings RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals,+simd128" \ cargo +nightly clippy -Z build-std=panic_abort,std -p flashraw-wasm \ --target wasm32-unknown-unknown --features threads,jpegxl -- -D warnings - run: npm ci - name: Build (SIMD, fallback, threaded, WebGPU, SIMD + JPEG XL, threaded + JPEG XL) run: npm run build - name: Node tests (threaded build by default) run: npm test - name: Node tests (single-threaded build) run: FLASHRAW_WASM_THREADS=0 npm test - name: Type tests run: npm run test:types - name: Chromium tests run: | npx playwright install --with-deps chromium npm run test:browser - name: Bundler smoke tests (Vite, esbuild, webpack) run: npm run test:bundlers - name: Package contents run: npm pack --dry-run - uses: actions/upload-artifact@v4 with: name: flashraw-npm-dist path: npm/dist