Test firmware on real hardware in GitHub Actions
Run your firmware on a real board as part of every pull request: the siliconrig action flashes your binary to a physical board, captures its serial output, and hands it back to your workflow to assert on. No self-hosted runner, no board zip-tied to a shelf.
Source on GitHub · Marketplace
Minimal workflow
name: HIL Tests
on: [push]
jobs:
hardware-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build firmware
run: |
# your build step here
idf.py build
- name: Flash and capture serial
uses: siliconrig/action@v1
with:
api-key: ${{ secrets.SRIG_API_KEY }}
board: esp32-s3
firmware: build/firmware.bin
serial-timeout: 30s
serial-log: serial-output.txt
- name: Assert on serial output
run: |
cat serial-output.txt
grep "Ready" serial-output.txtThe action handles the full lifecycle: installs the CLI, creates a session, flashes firmware, captures serial output, and ends the session (even if the job fails). If grep finds nothing, the step fails and so does your build, which is the point.
Works the same for every board type: set board: to esp32-s3, stm32-h753, stm32-f446, or rp2350 and adjust the firmware path.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
api-key | Yes | — | SiliconRig API key |
board | Yes | — | Board type (e.g., esp32-s3) |
firmware | No | — | Path to firmware binary |
serial-timeout | No | 30s | Serial capture duration |
serial-log | No | serial-output.txt | File to save serial output |
cli-version | No | latest | srig-cli version to install |
Outputs
| Output | Description |
|---|---|
session-id | The session ID that was created |
serial-log | Path to the serial output log file |
Beyond grep: pytest against the live board
For assertions richer than pattern matching, skip the action and use the Python SDK in a plain step. The board stays interactive for the whole test run:
- name: HIL test suite
env:
SRIG_API_KEY: ${{ secrets.SRIG_API_KEY }}
run: |
pip install siliconrig pytest
pytest tests/hil/ -vTips
- Store the key as a secret (
SRIG_API_KEY), never in the workflow file. Create a dedicated key named after the repo so you can revoke it independently. - Set timeouts at both levels:
serial-timeoutfor the capture andtimeout-minuteson the job, so a hung board can never block your pipeline. - Upload the serial log as an artifact if you want it around for debugging:
actions/upload-artifactwithpath: serial-output.txt. - Firmware uploads are limited to 16 MB.