From 8de5702ae83cdb88756fa731f85e6321ddb966ea Mon Sep 17 00:00:00 2001 From: tchapacan Date: Tue, 26 Mar 2024 23:53:50 +0100 Subject: [PATCH] add rust code-checks workflow --- .github/workflows/code-checks.yml | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/code-checks.yml diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml new file mode 100644 index 0000000..a5843cc --- /dev/null +++ b/.github/workflows/code-checks.yml @@ -0,0 +1,59 @@ +name: "Code Checks" +run-name: "Code Checks: ${{ github.event.pull_request.title }} ⛑️" + +on: + pull_request: + types: [opened, synchronize] + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: ${{ matrix.toolchain }} / ${{ matrix.arch.target }} + runs-on: ${{ matrix.arch.os }} + strategy: + fail-fast: false + matrix: + toolchain: [stable] + arch: + - {os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu", cross: false} + - {os: "ubuntu-latest", target: "armv7-unknown-linux-gnueabihf", cross: true} + - {os: "ubuntu-latest", target: "aarch64-unknown-linux-gnu", cross: true} + + steps: + - name: "Checkout repo 👉" + uses: actions/checkout@v3 + + - name: "Install toolchain 🦀" + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.arch.target }} + components: rustfmt, clippy + override: true + + - name: "Fetch dependencies 🛠️" + uses: actions-rs/cargo@v1 + with: + command: fetch + + - name: "Check build platform 📺" + uses: actions-rs/cargo@v1 + with: + command: check + args: --target=${{ matrix.arch.target }} + use-cross: ${{ matrix.arch.cross }} + + - name: "Format code 🔍" + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: "Clippy code 🔍" + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all-features