iota-client 1.4.0

The official, general-purpose IOTA client library in Rust for interaction with the IOTA network (Tangle)
Documentation
name: Examine the Node.js Bindings
on:
  push:
    branches:
      - develop
      - production
    paths:
      - '.github/workflows/examine-nodejs-bindings.yml'
      - '.github/actions/**'
      - 'bindings/nodejs/**'
      # Watch the Rust core too
      - 'src/**'
      - 'Cargo.toml'
      - 'Cargo.lock'
  pull_request:
    branches:
      - develop
      - production
    paths:
      - '.github/workflows/examine-nodejs-bindings.yml'
      - '.github/actions/**'
      - 'bindings/nodejs/**'
      # Watch the Rust core too
      - 'src/**'
      - 'Cargo.toml'
      - 'Cargo.lock'
  schedule:
    - cron: '0 1 * * *'
  workflow_dispatch:

jobs:
  test:
    name: Test
    if: ${{ ! github.event.schedule }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        # XXX: The GitHub hosted Windows 2022 image comes with Visual Studio 2022, but node-gyp
        # (which is used by neon-sys) sadly fails to recognize it. As a mitigation, we still run the
        # tests on Windows 2019, until we can figure out a way to fix the problem.
        os: [windows-2019, macos-latest, ubuntu-latest]
        node: ['12', '14', '16']
        exclude:
          # Remove once neon is updated
          - os: windows-2019
            node: '16'

    steps:
      - name: Checkout the Source Code
        uses: actions/checkout@v2

      - name: Set Up Nightly Rust
        uses: ./.github/actions/setup-rust
        with:
          toolchain: nightly
          cache: true
          cache-root: bindings/nodejs/native/
          cache-job-id: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.node }}
          cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}

      - 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: bindings/nodejs/yarn.lock

      # This step is required for bindgen to work on Windows.
      - name: Set Up Clang/LLVM (Windows)
        if: ${{ startsWith(matrix.os, 'windows') }}
        uses: ./.github/actions/setup-clang

      - name: Run Yarn Install
        working-directory: bindings/nodejs/
        run: yarn install

      - name: Run Cargo Test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --manifest-path bindings/nodejs/native/Cargo.toml --all-features --release

      - name: Run Yarn Test
        working-directory: bindings/nodejs/
        run: yarn test

  lint:
    name: Lint
    if: ${{ ! github.event.schedule }}
    runs-on: ubuntu-latest

    steps:
      - name: Checkout the Source Code
        uses: actions/checkout@v2

      - name: Set Up Nightly Clippy
        uses: ./.github/actions/setup-rust
        with:
          toolchain: nightly
          components: clippy
          cache: true
          cache-root: bindings/nodejs/native/
          cache-job-id: ${{ github.workflow }}-${{ github.job }}
          cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}

      - name: Run Clippy
        uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --manifest-path bindings/nodejs/native/Cargo.toml --all-features --all-targets -- --deny warnings
          name: Clippy Results for the Node.js Bindings

      # TODO: Lint the JavaScript code too

  check-unused-deps:
    name: Check Unused Dependencies
    if: ${{ ! github.event.schedule }}
    runs-on: ubuntu-latest

    steps:
      - name: Checkout the Source Code
        uses: actions/checkout@v2

      - name: Install Cargo-udeps with Nightly Rust
        uses: ./.github/actions/setup-rust
        with:
          toolchain: nightly
          cache: true
          install: cargo-udeps
          cache-root: bindings/nodejs/native/
          cache-job-id: ${{ github.workflow }}-${{ github.job }}
          cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}

      - name: Run Cargo Udeps
        uses: actions-rs/cargo@v1
        with:
          command: udeps
          args: --manifest-path bindings/nodejs/native/Cargo.toml --all-targets

      # 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@v2

      - name: Set Up Nightly Rustfmt
        uses: ./.github/actions/setup-rust
        with:
          toolchain: nightly
          components: rustfmt
          cache: false

      - name: Run Cargo Fmt
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --manifest-path bindings/nodejs/native/Cargo.toml --all -- --check

      # TODO: Check the JavaScript code too

  audit:
    name: Perform Security Audit
    runs-on: ubuntu-latest

    steps:
      - name: Checkout the Source Code
        uses: actions/checkout@v2

      - name: Install Cargo-audit with Nightly Rust
        uses: ./.github/actions/setup-rust
        with:
          toolchain: nightly
          install: cargo-audit
          cache: true
          cache-job-id: ${{ github.workflow }}-${{ github.job }}
          cache-hash: ${{ hashFiles('.github/workflows/examine-nodejs-bindings.yml') }}

      - name: Run Cargo Audit
        uses: actions-rs/cargo@v1
        with:
          command: audit
          # The ignored security advisories:
          #
          # - RUSTSEC-2021-0145: `atty` potential unaligned read.
          #   - Waiting for https://github.com/mackwic/colored/pull/122 to be merged.
          args: --file bindings/nodejs/native/Cargo.lock --deny warnings --ignore RUSTSEC-2021-0145

      # TODO: Check the JavaScript code too