From 7f15feaff04069c7427a7d51cbefddfa9e8c2495 Mon Sep 17 00:00:00 2001 From: "Jonathan Pallant (Ferrous Systems)" Date: Tue, 28 Nov 2023 09:53:49 +0000 Subject: [PATCH] Add github workflows. These will run clippy, check code formatting, and build both ThreadX and a Rust binary. --- .github/workflows/build.yml | 54 ++++++++++++++++++++++++++++++++++++ .github/workflows/clippy.yml | 24 ++++++++++++++++ .github/workflows/format.yml | 18 ++++++++++++ demo-app/.cargo/config.toml | 2 +- 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/clippy.yml create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0af5bfa --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +# Copyright (c) 2023 Ferrous Systems +# SPDX-License-Identifier: MIT OR Apache-2.0 + +name: workflow-build-everything +run-name: Build Everything +on: [push] +jobs: + job-build-threadx-staticlib: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: 'true' + - name: Install tools + run: | + sudo apt-get update -y && sudo apt-get -y install cmake gcc gcc-arm-none-eabi build-essential ninja-build + - name: Compile ThreadX for Cortex-M4 + run: | + cd threadx + cmake -Bbuild_m4 -GNinja -DCMAKE_TOOLCHAIN_FILE=cmake/cortex_m4.cmake + cmake --build ./build_m4 + - name: Upload staticlib + uses: actions/upload-artifact@master + with: + name: threadx-cm4 + path: threadx/build_m4/libthreadx.a + job-build-demo-app: + runs-on: ubuntu-latest + needs: job-build-threadx-staticlib + steps: + - name: Install tools + run: | + sudo apt-get update -y && sudo apt-get -y install gcc-arm-none-eabi + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: 'true' + - name: Download staticlib + uses: actions/download-artifact@master + with: + name: threadx-cm4 + path: threadx/build/libthreadx.a # Where build.rs expects it + - name: Add rustup target + run: | + rustup target add thumbv7em-none-eabi + - name: Check Demo App + run: | + cd demo-app + cargo check --target=thumbv7em-none-eabi + - name: Build Demo App + run: | + cd demo-app + cargo build --target=thumbv7em-none-eabi --release diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 0000000..8354c5a --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,24 @@ +# Copyright (c) 2023 Ferrous Systems +# SPDX-License-Identifier: MIT OR Apache-2.0 + +name: workflow-code-analysis +run-name: Run code analysis +on: [push] +jobs: + job-clippy-demo-app: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Install tools + run: | + sudo apt-get update -y && sudo apt-get -y install gcc-arm-none-eabi + - name: Add rustup target + run: | + rustup target add thumbv7em-none-eabi + - name: Check Clippy + env: + RUSTFLAGS: "-Dwarnings" + run: | + cd demo-app + cargo clippy --all-features diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..e28f6b8 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,18 @@ +# Copyright (c) 2023 Ferrous Systems +# SPDX-License-Identifier: MIT OR Apache-2.0 + +# Builds ThreadX and then our Rust program + +name: workflow-code-format +run-name: Check code formatting +on: [push] +jobs: + job-format-demo-app: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Check Formatting + run: | + cd demo-app + cargo fmt -- --check diff --git a/demo-app/.cargo/config.toml b/demo-app/.cargo/config.toml index ed848b5..b3795aa 100644 --- a/demo-app/.cargo/config.toml +++ b/demo-app/.cargo/config.toml @@ -12,4 +12,4 @@ rustflags = [ [build] # cross-compile to this target -target = "thumbv7em-none-eabihf" # = ARM Cortex-M4 with FPU +target = "thumbv7em-none-eabi" # = ARM Cortex-M4 with soft-float