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:
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
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"