pubnub 0.7.0

PubNub SDK for Rust
Documentation
name: Validations

on:
  push:
  workflow_dispatch:
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
defaults:
  run:
    shell: bash
env:
  SDK_SUB_KEY: ${{ secrets.SDK_SUB_KEY }}
  SDK_PUB_KEY: ${{ secrets.SDK_PUB_KEY }}
  SDK_PAM_SUB_KEY: ${{ secrets.SDK_PAM_SUB_KEY }}
  SDK_PAM_PUB_KEY: ${{ secrets.SDK_PAM_PUB_KEY }}
  SDK_PAM_SEC_KEY: ${{ secrets.SDK_PAM_SEC_KEY }}

jobs:
  # pubnub-yml:
  #   name: "Validate .pubnub.yml"
  #   runs-on:
  #     group: organization/Default
  #   steps:
  #     - name: Checkout project
  #       uses: actions/checkout@v3
  #     - name: Checkout validator action
  #       uses: actions/checkout@v3
  #       with:
  #         repository: pubnub/client-engineering-deployment-tools
  #         ref: v1
  #         token: ${{ secrets.GH_TOKEN }}
  #         path: .github/.release/actions
  #     - name: "Run '.pubnub.yml' file validation"
  #       uses: ./.github/.release/actions/actions/validators/pubnub-yml
  #       with:
  #         token: ${{ secrets.GH_TOKEN }}
  #     - name: Cancel workflow runs for commit on error
  #       if: failure()
  #       uses: ./.github/.release/actions/actions/utils/fast-jobs-failure

  linters:
    name: Launch all cargo linters to check condition of the code
    runs-on:
      group: organization/Default
    steps:
      - uses: actions/checkout@v5

      - name: Run cargo check tool to check if the code are valid
        run: |
          cargo check --workspace --all-targets --features="full"
      - name: Run cargo check tool to check if the raw domain code are valid
        run: |
          cargo check --workspace --no-default-features --features="pubnub_only"
      - name: Run cargo check tool to check if the `no_std` code are valid
        run: |
          cargo check --workspace --all-targets --no-default-features --features="full_no_std"
      - name: Run cargo clippy tool to check if all the best code practices are followed
        run: |
          cargo clippy --workspace --all-targets --features="full" -- -D warnings
      - name: Run cargo clippy tool to check if all the best code practices are followed for raw domain code
        run: |
          cargo clippy --workspace --no-default-features --features="pubnub_only" -- -D warnings
      - name: Run cargo clippy tool to check if all the best code practices are followed for `no_std` code
        run: |
          cargo clippy --workspace --all-targets --no-default-features --features="full_no_std" -- -D warnings
      - name: Run cargo fmt tool to check if code are well formatted
        run: |
          cargo fmt --check --verbose --all

  cargo-deny:
    name: Check Cargo crate dependencies
    runs-on:
      group: organization/Default
    strategy:
      matrix:
        checks:
          - advisories
          - bans licenses sources
    # Prevent sudden announcement of a new advisory from failing ci:
    continue-on-error: ${{ matrix.checks == 'advisories' }}
    steps:
      - uses: actions/checkout@v5
      - uses: EmbarkStudios/cargo-deny-action@v2
        with:
          command: check ${{ matrix.checks }}

  wasm-target:
    name: Check if Web Assembly target compiles as expected
    runs-on:
      group: organization/Default
    steps:
      - uses: actions/checkout@v5

      - name: Install WASM target
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: wasm32-unknown-unknown

      - name: Run cargo check tool to check if the WASM code are valid
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --lib --features=full

  no_std-target:
    name: Check if `no_std` target compiles as expected
    runs-on:
      group: organization/Default
    steps:
      - uses: actions/checkout@v5

      - name: Install `no_std` target
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: thumbv7m-none-eabi

      - name: Run cargo check tool to check if the `no_std` code are valid
        uses: actions-rs/cargo@v1
        env:
          RUSTFLAGS: '--cfg getrandom_backend="unsupported"'
        with:
          command: check
          args: --lib --no-default-features --features=full_no_std_platform_independent

      - name: Run cargo check tool to check if the additional example code are valid
        uses: actions-rs/cargo@v1
        env:
          RUSTFLAGS: '--cfg getrandom_backend="custom"'
        with:
          command: check
          args: --manifest-path examples/no_std/Cargo.toml --target thumbv7m-none-eabi

  all-validations:
    name: Validations
    runs-on:
      group: organization/Default
    needs: [ linters, cargo-deny, wasm-target, no_std-target ]
    steps:
      - name: Validations summary
        run: echo -e "\033[38;2;95;215;0m\033[1mAll validations passed"