Skip to content

Examine the Wasm Bindings #569

Examine the Wasm Bindings

Examine the Wasm Bindings #569

name: Examine the Wasm Bindings
on:
push:
branches:
- develop
- production
paths:
- ".github/workflows/examine-wasm-bindings.yml"
- ".github/actions/**"
- "wallet/bindings/wasm/**"
# Watch the Rust core too
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
pull_request:
branches:
- develop
- production
paths:
- ".github/workflows/examine-wasm-bindings.yml"
- ".github/actions/**"
- "wallet/bindings/wasm/**"
# Watch the Rust core too
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: Test
if: ${{ ! github.event.schedule }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
node: ["16"]
steps:
- name: Checkout the Source Code
uses: actions/checkout@v3
- name: Set Up Nightly Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
target: wasm32-unknown-unknown
cache-root: wallet/bindings/wasm/
cache-job-id: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.node }}
cache-hash: ${{ hashFiles('.github/workflows/examine-wasm-bindings.yml') }}
# Download a pre-compiled wasm-bindgen binary.
- name: Install wasm-bindgen-cli
uses: jetli/wasm-bindgen-action@24ba6f9fff570246106ac3f80f35185600c3f6c9
with:
version: '0.2.84'
- name: Set Up Node.js ${{ matrix.node }} and Yarn Cache
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: yarn
cache-dependency-path: wallet/bindings/wasm/yarn.lock
- name: Run Yarn Install
working-directory: wallet/bindings/wasm/
run: yarn install
- name: Run Yarn Build
working-directory: wallet/bindings/wasm/
run: yarn build
- name: Start private tangle
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: './.github/actions/private-tangle/setup'
- name: Run Yarn Test
if: ${{ startsWith(matrix.os, 'ubuntu') }}
working-directory: wallet/bindings/wasm/
run: yarn test
- name: Run Yarn Test
if: ${{ !startsWith(matrix.os, 'ubuntu') }}
working-directory: wallet/bindings/wasm/
# Only run test that doesn't require a node because we can't use the private tangle script on macos and windows
run: yarn test -t 'Wallet methods'
- name: Tear down private tangle
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: './.github/actions/private-tangle/tear-down'
lint:
name: Lint
if: ${{ ! github.event.schedule }}
runs-on: ubuntu-latest
steps:
- name: Checkout the Source Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: yarn
cache-dependency-path: wallet/bindings/wasm/yarn.lock
node-version: 16.x
- name: Install Dependencies
working-directory: wallet/bindings/wasm/
run: yarn
- name: Lint
working-directory: wallet/bindings/wasm/
run: yarn lint
check-unused-deps:
name: Check Unused Dependencies
if: ${{ ! github.event.schedule }}
runs-on: ubuntu-latest
steps:
- name: Checkout the Source Code
uses: actions/checkout@v3
- name: Install Cargo-udeps with Nightly Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
target: wasm32-unknown-unknown
install: cargo-udeps
cache-root: wallet/bindings/wasm/
cache-job-id: ${{ github.workflow }}-${{ github.job }}
cache-hash: ${{ hashFiles('.github/workflows/examine-wasm-bindings.yml') }}
- name: Run Cargo Udeps
uses: actions-rs/cargo@v1
with:
command: udeps
args: --manifest-path wallet/bindings/wasm/Cargo.toml --all-features --target=wasm32-unknown-unknown
# TODO: Check yarn too
check-format:
name: Check Format
if: ${{ ! github.event.schedule }}
runs-on: ubuntu-latest
steps:
- name: Checkout the Source Code
uses: actions/checkout@v3
- name: Set Up Nightly Rustfmt
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
target: wasm32-unknown-unknown
components: rustfmt
cache: false
- name: Install cargo-license-template
uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-license-template
- name: Run Cargo Fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path wallet/bindings/wasm/Cargo.toml --all -- --check
- name: Run cargo-license-template
uses: actions-rs/cargo@v1
with:
command: license-template
args: --template .license_template
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: yarn
cache-dependency-path: wallet/bindings/wasm/yarn.lock
node-version: 16.x
- name: Install Dependencies
working-directory: wallet/bindings/wasm/
run: yarn
- name: Format
working-directory: wallet/bindings/wasm/
run: yarn format-check