mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-19 06:04:31 -04:00
170 lines
4.7 KiB
YAML
170 lines
4.7 KiB
YAML
name: WASM
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- ready_for_review
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
check-wasm:
|
|
name: Build test
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' || !github.event.pull_request.draft
|
|
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
name:
|
|
- matrix-qrcode
|
|
- matrix-sdk (no-default, wasm-flags)
|
|
- matrix-sdk-base
|
|
- matrix-sdk-common
|
|
- matrix-sdk-crypto
|
|
- matrix-sdk / indexeddb_stores
|
|
|
|
include:
|
|
- name: matrix-qrcode
|
|
cargo_args: --package matrix-qrcode
|
|
- name: matrix-sdk (no-default, wasm-flags)
|
|
cargo_args: --no-default-features --features qrcode,encryption,indexeddb_stores,rustls-tls --package matrix-sdk --lib
|
|
- name: matrix-sdk-base
|
|
cargo_args: --package matrix-sdk-base
|
|
- name: matrix-sdk-common
|
|
cargo_args: --package matrix-sdk-common
|
|
- name: matrix-sdk-crypto
|
|
cargo_args: --package matrix-sdk-crypto
|
|
|
|
# special check for specific features
|
|
- name: matrix-sdk / indexeddb_stores
|
|
cargo_args: --package matrix-sdk --no-default-features --features indexeddb_stores,encryption,rustls-tls --lib
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: wasm32-unknown-unknown
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Load cache
|
|
uses: Swatinem/rust-cache@v1
|
|
# needed for libolm-sys compilation
|
|
- name: Install emscripten
|
|
uses: mymindstorm/setup-emsdk@v11
|
|
with:
|
|
version: latest
|
|
|
|
- name: check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target wasm32-unknown-unknown ${{ matrix.cargo_args }}
|
|
|
|
test-wasm:
|
|
# building wasm is not enough, we've seen runtime errors before,
|
|
# hence the tests
|
|
name: ${{ matrix.name }} test
|
|
if: github.event_name == 'push' || !github.event.pull_request.draft
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: ${{ matrix.experimental }}
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- name: matrix-sdk
|
|
experimental: false
|
|
base_dir: matrix-sdk
|
|
cargo_args: --no-default-features --features indexeddb_stores,rustls-tls --lib
|
|
- name: matrix-sdk-encryption
|
|
experimental: false
|
|
emcc_version: 2.0.27
|
|
node_version: '14'
|
|
base_dir: matrix-sdk
|
|
cargo_args: --no-default-features --features indexeddb_stores,rustls-tls,encryption --lib
|
|
- name: "matrix-sdk-indexeddb"
|
|
base_dir: matrix-sdk-indexeddb
|
|
experimental: false
|
|
- name: "matrix-sdk-example-wasm_command_bot @Node14"
|
|
experimental: false
|
|
emcc_version: 2.0.27
|
|
node_version: '14'
|
|
# known to work
|
|
base_dir: matrix-sdk/examples/wasm_command_bot
|
|
cmd: |
|
|
npm install
|
|
npm test
|
|
wasm-pack test --firefox --headless
|
|
- name: matrix-sdk-example-wasm_command_bot
|
|
base_dir: matrix-sdk/examples/wasm_command_bot
|
|
# this might fail
|
|
experimental: true
|
|
cmd: |
|
|
npm install
|
|
npm test
|
|
wasm-pack test --firefox --headless
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: wasm32-unknown-unknown
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Load cache
|
|
uses: Swatinem/rust-cache@v1
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node_version || 'lts/*' }}
|
|
|
|
- name: Install emscripten
|
|
uses: mymindstorm/setup-emsdk@v11
|
|
with:
|
|
version: ${{ matrix.emcc_version || 'latest' }}
|
|
|
|
- name: Install wasm-pack
|
|
run: cargo install wasm-pack
|
|
|
|
- name: Verify versions
|
|
run: |
|
|
echo "> node --version"
|
|
node --version
|
|
echo "> npm --version"
|
|
npm --version
|
|
echo "> wasm-pack --version"
|
|
wasm-pack --version
|
|
echo "> emcc -v"
|
|
emcc -v
|
|
|
|
- name: Default wasm-pack tests
|
|
if: '!matrix.cmd'
|
|
run: |
|
|
cd crates/${{ matrix.base_dir }}
|
|
wasm-pack test --node -- ${{ matrix.cargo_args }}
|
|
wasm-pack test --firefox --headless -- ${{ matrix.cargo_args }}
|
|
|
|
- name: Testing with custom command
|
|
if: matrix.cmd
|
|
run: |
|
|
cd crates/${{ matrix.base_dir }}
|
|
${{ matrix.cmd }}
|