summaryrefslogtreecommitdiffstats
path: root/.github/workflows/pull-request-checks.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/pull-request-checks.yml')
-rw-r--r--.github/workflows/pull-request-checks.yml380
1 files changed, 380 insertions, 0 deletions
diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml
new file mode 100644
index 00000000..9c029163
--- /dev/null
+++ b/.github/workflows/pull-request-checks.yml
@@ -0,0 +1,380 @@
+name: Pull Request Checks
+
+on:
+ workflow_dispatch:
+ pull_request:
+
+env:
+ CARGO_TERM_COLOR: always
+
+jobs:
+ block-fixup:
+ name: Block fixup commits
+ runs-on: Ubuntu-20.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Block Fixup Commit Merge
+ # https://github.com/13rac1/block-fixup-merge-action
+ uses: 13rac1/block-fixup-merge-action@v2.0.0
+
+ # JOB to run change detection
+ changes:
+ name: Filter changes
+ runs-on: Ubuntu-20.04
+ # Set job outputs to values from filter step
+ outputs:
+ docs: ${{ steps.filter.outputs.docs }}
+ rust: ${{ steps.filter.outputs.rust }}
+ workflows: ${{ steps.filter.outputs.workflows }}
+ steps:
+ # For pull requests it's not necessary to checkout the code
+ - uses: dorny/paths-filter@v2
+ # https://github.com/dorny/paths-filter
+ id: filter
+ with:
+ filters: |
+ docs:
+ - 'docs/**'
+ rust:
+ - 'crates/**'
+ - 'plugins/**'
+ - 'Cargo.*'
+ workflows:
+ - '.github/workflows/**'
+
+ #
+ # Checking that Cargo.lock is up to date
+ #
+ check-lockfile-uptodate:
+ name: Check whether Cargo.lock is up to date
+ runs-on: ubuntu-20.04
+ outputs:
+ locks: ${{ steps.filter.outputs.locks }}
+ steps:
+ - uses: actions/checkout@v3
+ - uses: dtolnay/rust-toolchain@1.58.1
+ with:
+ targets: armv7-unknown-linux-gnueabihf
+
+ - uses: Swatinem/rust-cache@v1
+
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ locks:
+ - '**/Cargo.toml'
+
+ - name: Check whether lockfile is up to date
+ if: steps.filter.outputs.locks == 'true'
+ uses: actions-rs/cargo@v1
+ with:
+ command: check
+ args: --locked
+
+ udeps:
+ name: Check for unused dependencies
+ runs-on: ubuntu-latest
+ needs: changes
+ if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
+ steps:
+ - uses: actions/checkout@v3
+ - uses: dtolnay/rust-toolchain@nightly
+ - name: Run cargo-udeps
+ uses: aig787/cargo-udeps-action@v1
+ with:
+ version: 'latest'
+ args: '--all-features'
+
+ mdbook-build-check:
+ name: Run mdbook build
+ runs-on: ubuntu-20.04
+ needs: changes
+ if: ${{ needs.changes.outputs.docs == 'true' || needs.changes.outputs.workflows == 'true' }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Setup mdBook
+ uses: peaceiris/actions-mdbook@v1
+ # https://github.com/marketplace/actions/mdbook-action
+ with:
+ mdbook-version: "0.4.18"
+ #mdbook-version: 'latest'
+
+ - name: Install mdbook-toc
+ uses: actions-rs/install@v0.1
+ # https://github.com/marketplace/actions/rust-cargo-install
+ with:
+ crate: mdbook-toc
+ version: latest
+
+ - name: Install mdbook-mermaid
+ uses: actions-rs/install@v0.1
+ # https://github.com/marketplace/actions/rust-cargo-install
+ with:
+ crate: mdbook-mermaid
+ version: latest
+
+ - name: Install mdbook-linkcheck
+ uses: actions-rs/install@v0.1
+ # https://github.com/marketplace/actions/rust-cargo-install
+ with:
+ crate: mdbook-linkcheck
+ version: latest
+
+ - name: Run mdbook build
+ run: |
+ ls -l
+ cd docs
+ mdbook build
+
+ cargo-fmt:
+ name: Run cargo fmt
+ runs-on: Ubuntu-20.04
+ needs: changes
+ if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Cargo fmt --version
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: fmt
+ args: --version
+
+ - name: Cargo fmt
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: fmt
+ args: -- --check
+
+ cargo-clippy:
+ name: Run cargo clippy
+ runs-on: Ubuntu-20.04
+ env:
+ RUSTFLAGS: -D warnings
+ needs: changes
+ if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: enable toolchain via github action
+ uses: dtolnay/rust-toolchain@1.63.0
+ with:
+ components: rustfmt, clippy
+
+ - name: Enable cache
+ # https://github.com/marketplace/actions/rust-cache
+ uses: Swatinem/rust-cache@v1
+
+ - name: Cargo clippy --version
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ toolchain: 1.63.0
+ command: clippy
+ args: --version
+
+ - name: Cargo clippy
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ toolchain: 1.63.0
+ command: clippy
+ args: --all-features
+
+ cargo-audit:
+ name: Run cargo audit
+ runs-on: Ubuntu-20.04
+ needs: changes
+ if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.workflows == 'true' }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Cargo audit
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: audit
+
+ cargo-test:
+ name: Run cargo test
+ runs-on: Ubuntu-20.04
+ env:
+ RUSTFLAGS: -D warnings
+ needs: [cargo-fmt, cargo-clippy]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: enable toolchain via github action
+ uses: dtolnay/rust-toolchain@1.63.0
+
+ - name: Enable cache
+ # https://github.com/marketplace/actions/rust-cache
+ uses: Swatinem/rust-cache@v1
+
+ - name: Cargo version
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: version
+
+ - name: Cargo build dummy plugin
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: build
+ args: -p tedge_dummy_plugin
+
+ - name: Cargo test
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: test
+ args: --no-fail-fast --all-features
+
+ cargo-build:
+ name: Run cargo build
+ runs-on: Ubuntu-20.04
+ env:
+ RUSTFLAGS: -D warnings
+ needs: [cargo-fmt, cargo-clippy]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: enable toolchain via github action
+ uses: dtolnay/rust-toolchain@1.63.0
+
+ - name: Enable cache
+ # https://github.com/marketplace/actions/rust-cache
+ uses: Swatinem/rust-cache@v1
+
+ - name: Cargo version
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: version
+
+ - name: Cargo build
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ command: build
+ args: --release
+
+ cargo_build_arm7_32bit:
+ name: cargo build for armv7 32bit
+ runs-on: Ubuntu-20.04
+ env:
+ RUSTFLAGS: -D warnings
+ needs: [cargo-fmt, cargo-clippy]
+
+ steps:
+ - name: checkout
+ uses: actions/checkout@v3
+
+ - name: enable toolchain via github action
+ uses: dtolnay/rust-toolchain@1.63.0
+ with:
+ targets: armv7-unknown-linux-gnueabihf
+
+ - name: Enable cache
+ # https://github.com/marketplace/actions/rust-cache
+ uses: Swatinem/rust-cache@v1
+
+ - name: build cross release for target
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ use-cross: true
+ command: build
+ args: --release --target=armv7-unknown-linux-gnueabihf
+
+ cargo_build_tests_arm7_32bit:
+ name: cargo build tests for armv7 32bit
+ runs-on: Ubuntu-20.04
+ env:
+ RUSTFLAGS: -D warnings
+ needs: [cargo-fmt, cargo-clippy]
+
+ steps:
+ - name: checkout
+ uses: actions/checkout@v3
+
+ - name: enable toolchain via github action
+ uses: dtolnay/rust-toolchain@1.63.0
+ with:
+ target: armv7-unknown-linux-gnueabihf
+
+ - name: Enable cache
+ # https://github.com/marketplace/actions/rust-cache
+ uses: Swatinem/rust-cache@v1
+
+ - name: Build tests cross release for target
+ uses: actions-rs/cargo@v1
+ # https://github.com/marketplace/actions/rust-cargo
+ with:
+ use-cross: true
+ command: test
+ args: --release --no-run --target=armv7-unknown-linux-gnueabihf --all-features
+
+ shellcheck:
+ name: Shellcheck
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Run ShellCheck
+ uses: ludeeus/action-shellcheck@master
+
+### Disable cargo-tarpaulin as some tests failed only in this step
+# cargo-tarpaulin:
+# name: Run cargo tarpaulin
+# runs-on: Ubuntu-20.04
+#
+# steps:
+# - name: Checkout
+# uses: actions/checkout@v3
+#
+# - name: Install rust v1.63.0
+# uses: dtolnay/rust-toolchain@1.63.0
+#
+# - name: Enable cache
+# # https://github.com/marketplace/actions/rust-cache
+# uses: Swatinem/rust-cache@v1
+#
+# - name: install libssl
+# run: sudo apt install libssl-dev
+#
+# - name: Cargo install tarpaulin
+# uses: actions-rs/cargo@v1
+# # https://github.com/marketplace/actions/rust-cargo
+# with:
+# command: install
+# args: cargo-tarpaulin
+#
+# - name: Cargo tarpaulin
+# uses: actions-rs/cargo@v1
+# # https://github.com/marketplace/actions/rust-cargo
+# with:
+# command: tarpaulin
+# args: --skip-clean --avoid-cfg-tarpaulin -v --out Xml
+#
+# - name: Upload to codecov.io
+# uses: codecov/codecov-action@v1
+# with:
+# token: ${{secrets.CODECOV_TOKEN}}