Skip to content

Draft: Hardware Tests in CI #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Draft: Hardware Tests in CI #12

wants to merge 29 commits into from

Conversation

xarantolus
Copy link
Contributor

This adds, together with the https://github.com/OsirisRTOS/hardware-ci repo, a way to run hardware tests in CI.
Basically, one sets up the other repo on a server that has one or multiple STM chips attached, and makes them available in CI.

Then you can create a GitHub Action job:

  hardware-test-stm32-nucleo-l4r5zi:
    name: Hardware test for the STM32 Nucleo L4R5ZI
    # needs: [build-stm32-nucleo-l4r5zi]
    runs-on: stm32l4r5zi
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          submodules: recursive
      # TODO: download build artifacts
      - name: Run hardware test
        # See https://github.com/OsirisRTOS/hardware-ci for more information
        run: |
          SERIAL_ID="$(board_info serial stm32l4r5zi)"
          echo "Working with chip $SERIAL_ID"

          st-flash --serial "$SERIAL_ID" reset

          board_info print --serial "$SERIAL_ID" --flash-size

We can run on a specific type of chip via the runs-on label, and get a specific chip serial ID via the board_info serial stm32l4r5zi command. board_info also supports printing details about a specific chip, like flash size, page size etc.

This PR should be merged after #8

Copy link

github-actions bot commented Feb 16, 2025

LCOV of commit 0f30f42 during Osiris CI #148

Total coverage: 9.79%

Summary coverage rate:
  lines......: 9.8% (215 of 2195 lines)
  functions..: 7.0% (31 of 445 functions)
  branches...: no data found

Files changed coverage rate: n/a

@xarantolus xarantolus linked an issue Feb 17, 2025 that may be closed by this pull request
7 tasks
@xarantolus xarantolus marked this pull request as draft February 20, 2025 09:00
@xarantolus xarantolus marked this pull request as ready for review May 25, 2025 07:59
@Copilot Copilot AI review requested due to automatic review settings May 25, 2025 07:59
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new GitHub Actions job for running hardware tests on STM32 Nucleo boards and updates the development container to include necessary Python tooling.

  • Introduce hardware-test-stm32-nucleo-l4r5zi job in CI workflow.
  • Install Python 3, pip, setuptools, and wheel in the devcontainer for hardware test scripts.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/ci.yml Add hardware-test job that flashes and queries STM32 targets.
.devcontainer/Dockerfile Include python3 and related tooling for test scripts.
Comments suppressed due to low confidence (1)

.github/workflows/ci.yml:135

  • The new hardware-test job appears nested under the previous job's steps due to its indentation. De-indent it to the same level as other jobs under jobs: so it registers correctly.
hardware-test-stm32-nucleo-l4r5zi:

Comment on lines +136 to +153
name: Hardware test for the STM32 Nucleo L4R5ZI
# needs: [build-stm32-nucleo-l4r5zi]
runs-on: stm32l4r5zi
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Run hardware test
# See https://github.com/OsirisRTOS/hardware-ci for more information
run: |
SERIAL_ID="$(board_info serial stm32l4r5zi)"
echo "Working with chip $SERIAL_ID"

st-flash --serial "$SERIAL_ID" reset

board_info print --serial "$SERIAL_ID" --flash-size

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 month ago

To fix the issue, we will add a permissions block to the hardware-test-stm32-nucleo-l4r5zi job. Since this job appears to only run hardware tests and does not interact with the repository contents or other GitHub features, the minimal required permission is contents: read. This ensures that the job has only the permissions it needs to function correctly.


Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -138,2 +138,4 @@
     runs-on: stm32l4r5zi
+    permissions:
+      contents: read
     steps:
EOF
@@ -138,2 +138,4 @@
runs-on: stm32l4r5zi
permissions:
contents: read
steps:
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

General: Hardware CI
2 participants