Skip to content

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

yaml
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.txt

The 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

InputRequiredDefaultDescription
api-keyYesSiliconRig API key
boardYesBoard type (e.g., esp32-s3)
firmwareNoPath to firmware binary
serial-timeoutNo30sSerial capture duration
serial-logNoserial-output.txtFile to save serial output
cli-versionNolatestsrig-cli version to install

Outputs

OutputDescription
session-idThe session ID that was created
serial-logPath 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:

yaml
      - name: HIL test suite
        env:
          SRIG_API_KEY: ${{ secrets.SRIG_API_KEY }}
        run: |
          pip install siliconrig pytest
          pytest tests/hil/ -v

Tips

  • 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-timeout for the capture and timeout-minutes on 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-artifact with path: serial-output.txt.
  • Firmware uploads are limited to 16 MB.