Skip to content

feat: support disabling cloud handling of c8y_Restart operation #9919

feat: support disabling cloud handling of c8y_Restart operation

feat: support disabling cloud handling of c8y_Restart operation #9919

name: Pull Request Checks
on:
workflow_dispatch:
pull_request:
merge_group:
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
block-fixup:
name: Block fixup commits
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Block Fixup Commit Merge
# https://github.com/13rac1/block-fixup-merge-action
uses: 13rac1/[email protected]
# JOB to run change detection
changes:
name: Filter changes
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'merge_group' }}
# Set job outputs to values from filter step
outputs:
rust: ${{ steps.filter.outputs.rust || 'true' }}
workflows: ${{ steps.filter.outputs.workflows || 'true' }}
docs: ${{ steps.filter.outputs.docs || 'true' }}
continue-on-error: true
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
if: ${{ github.event_name == 'pull_request' }}
# https://github.com/dorny/paths-filter
id: filter
with:
filters: |
rust:
- 'crates/**'
- 'plugins/**'
- 'Cargo.*'
- '**/Cargo.toml'
workflows:
- '.github/workflows/**'
docs:
- 'docs/**'
#
# Checking that Cargo.lock is up to date
#
check-lockfile-uptodate:
name: Check whether Cargo.lock is up to date
runs-on: ubuntu-24.04
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Retrieve MSRV from workspace Cargo.toml
id: rust_version
uses: SebRollen/[email protected]
with:
file: Cargo.toml
field: "workspace.package.rust-version"
- name: Enable toolchain via github action
uses: dtolnay/rust-toolchain@master
with:
targets: armv7-unknown-linux-gnueabihf
toolchain: ${{ steps.rust_version.outputs.value }}
- uses: Swatinem/rust-cache@v2
- name: Check whether lockfile is up to date
run: cargo check --locked
udeps:
name: Check for unused dependencies
runs-on: ubuntu-latest
needs: changes
if: false
steps:
- uses: actions/checkout@v4
# Without pinning the version, cargo-udeps fails with:
# error[E0275]: overflow evaluating the requirement `{async fn body of try_exists<&std::path::Path>()}: std::marker::Send`
# |
# = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`c8y_mapper_ext`)
# (using the attribute doesn't help)
# TODO: unpin once the regression is removed from nightly
- name: Install nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-08-01
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run cargo-udeps
run: |
cargo install --git https://github.com/est31/cargo-udeps --locked
cargo udeps --all-features --all-targets
dependency-sort:
name: Sort dependencies
runs-on: ubuntu-24.04
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: Install taplo
run: cargo install taplo-cli
- name: Check Cargo.toml formatting
run: taplo fmt --check
format:
# Check formatting of both Rust and Robotframework code
name: Run format checks
runs-on: ubuntu-24.04
needs: changes
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
# Nightly toolchain is needed for cargo fmt since issue: https://github.com/thin-edge/thin-edge.io/issues/1660
# dtolnay/rust-toolchain is preferred over actions-rs/toolchain is currently not maintained and currently using
# deprecated GHA api (see https://github.com/actions-rs/toolchain/issues/219).
# However since dtolnay/rust-toolchain does not support the 'override' option, an additional call to
# rustup override is required (see https://github.com/dtolnay/rust-toolchain/issues/29#issuecomment-1412903426)
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Cargo fmt --version
run: cargo fmt --version
- uses: taiki-e/install-action@just
- name: Install tools
run: just install-tools
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: |
**/requirements/requirements*.txt
- name: just format-check
run: just format-check
cargo-clippy:
name: Run cargo clippy
runs-on: ubuntu-24.04
env:
RUSTFLAGS: -D warnings
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Enable cache
# https://github.com/marketplace/actions/rust-cache
uses: Swatinem/rust-cache@v2
- name: Cargo clippy
run: |
cargo clippy --version
cargo clippy --all-targets --all-features
cargo-audit:
name: Run cargo audit
runs-on: ubuntu-24.04
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo install cargo-audit
uses: taiki-e/install-action@cargo-audit
- name: Cargo audit
run: cargo audit
# Check: licenses (only use approved list of licenses), unmaintained repos, yanked versions
cargo-deny:
name: Run cargo-deny
runs-on: ubuntu-24.04
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo install cargo-deny
uses: taiki-e/install-action@cargo-deny
# Note: ignoring unmaintained crates due to unnecessary churn
- name: Cargo deny
run: cargo deny --all-features check --allow duplicate --allow unmaintained
# Only run check if the project still compiles on MSRV, test are run on stable
check-msrv:
name: Run cargo check on MSRV
runs-on: ubuntu-24.04
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Retrieve MSRV from workspace Cargo.toml
id: rust_version
uses: SebRollen/[email protected]
with:
file: Cargo.toml
field: "workspace.package.rust-version"
- name: Enable rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust_version.outputs.value }}
- name: Enable cache
uses: Swatinem/rust-cache@v2
- name: Run `cargo check`
run: cargo check --all-targets --all-features
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master
doc:
runs-on: ubuntu-latest
name: nightly / doc
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Enable cache
uses: Swatinem/rust-cache@v2
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo doc
run: cargo doc --no-deps --all-features --workspace
markdown:
# Validate that the markdown is correct before merging as errors will cause
# the publishing of the docs to github pages to fail
runs-on: ubuntu-latest
name: Check markdown
needs: changes
if: ${{ needs.changes.outputs.docs == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
# use tedge-docs nodejs version for guidance, though it is not mandatory
# https://github.com/thin-edge/tedge-docs
node-version: '>=18.0'
- run: npx docusaurus-mdx-checker
working-directory: docs