From 013c5dda191f8f27fbf4c6851548a041ef6a217d Mon Sep 17 00:00:00 2001 From: David Brown Date: Thu, 12 Sep 2024 11:22:27 -0600 Subject: [PATCH 1/2] workflow: Create basic build of rust samples Build the rust code samples to make sure that Rust support is working on all supported targets. This adds toolchain support and rust target support for the supported Cortex-M, and RISC-V targets. The workflow runs on every pull request and on every push. Signed-off-by: David Brown --- .github/workflows/build.yml | 55 +++++++++++++++++++++++++++++++++++++ ci-manifest.yml | 22 +++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 ci-manifest.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..54c91dbc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,55 @@ +# Copyright (c) 2024 Linaro LTD +# SPDX-License-Identifier: Apache-2.0 + +name: Build + +# Build the rust samples and tests using the current Zephyr. + +on: + push: + pull_request: + schedule: + - cron: "0 0 * * *" + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + path: zephyr-rust-lang + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Setup Zephyr project + uses: zephyrproject-rtos/action-zephyr-setup@v1 + with: + app-path: zephyr-rust-lang + manifest-file-name: ci-manifest.yml + toolchains: arm-zephyr-eabi:riscv64-zephyr-elf + + - name: Install Rust Targets + shell: bash + run: | + rustup target add riscv32i-unknown-none-elf + rustup target add riscv64imac-unknown-none-elf + rustup target add thumbv6m-none-eabi + rustup target add thumbv7em-none-eabi + rustup target add thumbv7m-none-eabi + rustup target add thumbv8m.main-none-eabi + + - name: Build firmware + working-directory: zephyr-rust-lang + shell: bash + run: | + cargo --version + + west twister -T samples -v --inline-logs --integration diff --git a/ci-manifest.yml b/ci-manifest.yml new file mode 100644 index 00000000..20f8a040 --- /dev/null +++ b/ci-manifest.yml @@ -0,0 +1,22 @@ +# Copyright (c) 2021 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Although this normally lives as a module, the local CI uses action-zephyr-setup which wants the +# application to have a manifest. + +manifest: + remotes: + - name: zephyrproject-rtos + url-base: https://github.com/zephyrproject-rtos + + projects: + - name: zephyr + remote: zephyrproject-rtos + revision: main + import: + # By using name-allowlist we can clone only the modules that are + # strictly needed by the application. + name-allowlist: + - cmsis # required by the ARM port + - hal_nordic # required by the custom_plank board (Nordic based) + - hal_stm32 # required by the nucleo_f302r8 board (STM32 based) From 2bb960f19c15c0061cda734a463abc28a14f6faa Mon Sep 17 00:00:00 2001 From: David Brown Date: Thu, 12 Sep 2024 12:05:55 -0600 Subject: [PATCH 2/2] workflow: Only run once on PR or merge to main Restrict when the workflow is run so that it will either run when pushed to main, or when a pull request to main, and not for arbitrary other branches. Signed-off-by: David Brown --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54c91dbc..d096d0ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,11 @@ name: Build on: push: + branches: + - main pull_request: + branches: + - main schedule: - cron: "0 0 * * *"