jdrouet/mrml

View on GitHub
.github/workflows/mrml-wasm-main.yml

Summary

Maintainability
Test Coverage
on:
  merge_group:
    types: [checks_requested]
  workflow_call:
  pull_request:
    paths:
      - ".github/workflows/mrml-wasm-main.yml"
      - "Cargo.lock"
      - "Cargo.toml"
      - "packages/mrml-core/**"
      - "packages/mrml-wasm/**"
  push:
    branches:
      - main
    paths:
      - ".github/workflows/mrml-wasm-main.yml"
      - "Cargo.lock"
      - "Cargo.toml"
      - "packages/mrml-core/**"
      - "packages/mrml-wasm/**"

name: mrml-wasm main

defaults:
  run:
    working-directory: packages/mrml-wasm

env:
  RUSTFLAGS: "-Dwarnings"

jobs:
  testing:
    runs-on: ubuntu-latest
    container: rust:1-bullseye

    concurrency:
      group: ${{ github.ref }}-mrml-wasm-testing
      cancel-in-progress: true

    steps:
      - uses: actions/checkout@v4

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal

      - uses: actions/setup-node@v4
        with:
          node-version: latest

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

      - uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-mrml-wasm-testing-${{ hashFiles('**/Cargo.lock') }}

      - name: run integration tests
        run: wasm-pack test --node

      - name: build for nodejs
        run: bash build.sh

      - name: run node example
        run: |
          cd examples/node
          npm install
          npm test

      - name: run browser example tests
        run: |
          cd examples/browser
          npm install
          npm run build