drogue-client 0.11.1

Clients for the Drogue IoT Cloud APIs
Documentation
name: CI

on:
  push:
    # Run on the main branch
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:


  format:
    runs-on: ubuntu-22.04

    steps:
      - uses: actions/checkout@v3

      - name: Run cargo fmt
        run:
          cargo fmt --all -- --check


  check:
    runs-on: ubuntu-22.04

    needs:
      - format

    strategy:
      matrix:
        toolchain:
          - stable
          - 1.60.0 # msrv (minimum supported rust version)
        target:
          - x86_64-unknown-linux-gnu
          - wasm32-unknown-unknown
        include:
          - target: wasm32-unknown-unknown
            features: "--no-default-features --features wasm"

    steps:

      - uses: actions/checkout@v3

      - uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }}

      - name: Install toolchain
        run: |
          rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.target }} --component clippy

      - name: Run cargo check
        run: |
          cargo +${{ matrix.toolchain }} check --target ${{ matrix.target }} ${{ matrix.features }}

      - name: Run cargo clippy
        run: |
          cargo +${{ matrix.toolchain }} clippy --target ${{ matrix.target }} ${{ matrix.features }} -- -D warnings


  test:
    runs-on: ubuntu-22.04

    needs:
      - check

    steps:

      - uses: actions/checkout@v3

      - uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }}

      - name: Run cargo test
        run: |
          cargo test