Repository navigation
logging optional #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Scenario sensors (cloud HIL) | |
| # Builds the scenario-sensors-stm32 firmware and (optionally) runs it on a physical BenchPod, driven | |
| # over embeddedci.com from pytest (no BenchPod on the runner). Auth is the job's GitHub OIDC token — | |
| # no secret needed (the repo must be trusted in the EmbeddedCI web app under BenchPod → GitHub | |
| # Actions, allowed to drive the device). | |
| # | |
| # This is the EXTERNAL (github) build path for this firmware; the internal embeddedci.yaml pipeline | |
| # is the separate internal path for the same code. | |
| # | |
| # Two paths, split so the hardware bench is only touched on demand: | |
| # * build (always, on every push): compile the firmware and record it as a GitHub-sourced build on | |
| # embeddedci.com (artifacts uploaded via the device-free `test_report_build`), so the freshly | |
| # built firmware is always available to flash from the web UI. | |
| # * hil (manual only): rebuild, then flash + drive the DUT on benchpod-v2.0.0. Runs ONLY on a manual | |
| # "Run workflow" (workflow_dispatch), never automatically on push. | |
| on: | |
| push: | |
| paths: | |
| - "scenario-sensors-stm32/**" | |
| - ".github/workflows/scenario-cloud.yml" | |
| workflow_dispatch: {} | |
| permissions: | |
| id-token: write # REQUIRED: lets the jobs mint a GitHub OIDC token for embeddedci | |
| contents: read | |
| jobs: | |
| # --- Always: build the firmware and publish it to embeddedci (no hardware) --- | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # Host unit test for the coil-current motor-fault decision (motor_health.h), | |
| # driven with the exact captured waveform data. Needs only a host C compiler, | |
| # so it runs before the ARM toolchain / HAL are set up. | |
| - name: Unit-test coil-current fault logic | |
| run: make -C scenario-sensors-stm32 test-host | |
| - name: Install ARM toolchain | |
| uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
| with: | |
| release: "13.2.Rel1" | |
| - name: Fetch STM32CubeF4 HAL | |
| run: | | |
| git clone --depth 1 --filter=blob:none --sparse \ | |
| https://github.com/STMicroelectronics/STM32CubeF4 scenario-sensors-stm32/STM32CubeF4 | |
| cd scenario-sensors-stm32/STM32CubeF4 | |
| git sparse-checkout set Drivers/CMSIS | |
| git submodule update --init --depth 1 \ | |
| Drivers/STM32F4xx_HAL_Driver Drivers/CMSIS/Device/ST/STM32F4xx | |
| - name: Build scenario-sensors.elf | |
| run: make -C scenario-sensors-stm32 CUBE_F4="$GITHUB_WORKSPACE/scenario-sensors-stm32/STM32CubeF4" | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install pytest + the embeddedci SDK (cloud extra) | |
| run: | | |
| pip install pytest \ | |
| "embeddedci[cloud] @ git+https://github.com/embeddedci-com/embeddedci-python.git@main#subdirectory=packages/embeddedci" | |
| - name: Publish build to embeddedci (no device) | |
| # -m artifacts_only selects only the device-free test_report_build, which uploads the firmware | |
| # (elf/bin/hex) + flash wiring to embeddedci as a GitHub-sourced build — so it's available to | |
| # flash from the web UI. No --benchpod-connection is needed because no device is touched. | |
| run: | | |
| pytest scenario-sensors-stm32/tests -v -m artifacts_only \ | |
| --benchpod-firmware="$GITHUB_WORKSPACE/scenario-sensors-stm32/build/scenario-sensors.elf" \ | |
| --benchpod-build-target=stm32f4 | |
| # --- Manual only: rebuild, then flash + drive the DUT on the physical bench --- | |
| hil: | |
| if: github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install ARM toolchain | |
| uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
| with: | |
| release: "13.2.Rel1" | |
| - name: Install xPack OpenOCD | |
| # SWD over remote_bitbang/CMSIS-DAP needs OpenOCD master (post-0.12.0); see selftest-cloud.yml. | |
| run: | | |
| V=0.12.0-7 | |
| curl -fsSL "https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v$V/xpack-openocd-$V-linux-x64.tar.gz" \ | |
| | sudo tar xz -C /opt | |
| echo "/opt/xpack-openocd-$V/bin" >> "$GITHUB_PATH" | |
| - name: Fetch STM32CubeF4 HAL | |
| run: | | |
| git clone --depth 1 --filter=blob:none --sparse \ | |
| https://github.com/STMicroelectronics/STM32CubeF4 scenario-sensors-stm32/STM32CubeF4 | |
| cd scenario-sensors-stm32/STM32CubeF4 | |
| git sparse-checkout set Drivers/CMSIS | |
| git submodule update --init --depth 1 \ | |
| Drivers/STM32F4xx_HAL_Driver Drivers/CMSIS/Device/ST/STM32F4xx | |
| - name: Build scenario-sensors.elf | |
| run: make -C scenario-sensors-stm32 CUBE_F4="$GITHUB_WORKSPACE/scenario-sensors-stm32/STM32CubeF4" | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install pytest + the embeddedci SDK (cloud extra) | |
| run: | | |
| pip install pytest \ | |
| "embeddedci[cloud] @ git+https://github.com/embeddedci-com/embeddedci-python.git@main#subdirectory=packages/embeddedci" | |
| - name: Scenario test on the BenchPod (cloud) | |
| # Point --benchpod-connection at the device wired to this board (here we use | |
| # benchpod-v2.0.0; change it to your scenario bench's device name). -m hardware runs only the | |
| # HIL test, which also records this run (with the real pass/fail) as a build on embeddedci. | |
| run: | | |
| pytest scenario-sensors-stm32/tests -v -m hardware \ | |
| --benchpod-connection=embeddedci:benchpod-v2.0.0 \ | |
| --benchpod-firmware="$GITHUB_WORKSPACE/scenario-sensors-stm32/build/scenario-sensors.elf" \ | |
| --benchpod-build-target=stm32f4 |