Skip to content

Sync collection registration + core API catch-up (lite→Origin round-trip) #1

Sync collection registration + core API catch-up (lite→Origin round-trip)

Sync collection registration + core API catch-up (lite→Origin round-trip) #1

Workflow file for this run

name: WASM
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
workflow_call:
concurrency:
group: wasm-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
wasm-build:
name: WASM Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Restore cargo registry cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: wasm
shared-key: lite-wasm
- name: Restore wasm-pack cache
uses: actions/cache@v4
with:
path: ~/.cache/wasm-pack
key: wasm-pack-${{ runner.os }}
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Check workspace for wasm32 target
run: cargo check --workspace --target wasm32-unknown-unknown
- name: Build WASM release
run: wasm-pack build --target web --release nodedb-lite-wasm
- name: Rewrite pkg/package.json metadata
working-directory: nodedb-lite-wasm/pkg
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.name = '@nodedb/lite';
pkg.version = '0.1.0';
pkg.license = 'Apache-2.0';
pkg.repository = { type: 'git', url: 'https://github.com/NodeDB-Lab/nodedb-lite' };
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"
- name: Run WASM node tests
run: wasm-pack test --node nodedb-lite-wasm
- name: Install Chrome for browser tests
uses: browser-actions/setup-chrome@v1
- name: Run WASM browser tests (headless Chrome)
run: wasm-pack test --headless --chrome nodedb-lite-wasm