Skip to content

CI/CD Integration

flashbay integrates with your CI/CD pipeline to run tests on real hardware automatically.

Source on GitHub (action) · Source on GitHub (templates)

GitHub Actions

Use the official composite action to flash firmware and capture serial output:

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: flashbay-dev/action@v1
        with:
          api-key: ${{ secrets.FLASHBAY_API_KEY }}
          board: esp32-s3
          firmware: build/firmware.bin
          serial-timeout: 30s
          serial-log: serial-output.txt

      - name: Check 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).

Action inputs

InputRequiredDefaultDescription
api-keyYesflashbay 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-versionNolatestfbay-cli version to install

Action outputs

OutputDescription
session-idThe session ID that was created
serial-logPath to the serial output log file

GitLab CI

Use the Python SDK directly in your pipeline:

yaml
hardware-test:
  image: python:3.12
  stage: test
  variables:
    FLASHBAY_API_KEY: $FLASHBAY_API_KEY
  script:
    - pip install flashbay pytest
    - idf.py build
    - pytest tests/hil/ -v
  timeout: 10m

How it works

  1. Your CI pipeline builds the firmware as usual
  2. The flashbay action/SDK creates a session and flashes the binary to a real board
  3. Serial output is captured or your test suite runs against the live board
  4. The session ends automatically when the step completes
  5. CI reports pass/fail as normal

Tips

  • Set a timeout — a hung board shouldn't block your pipeline forever
  • Use the pytest fixture from the Python SDK guide for clean test setup/teardown
  • Dedicated API key — create a separate API key for CI with a descriptive name like GitHub Actions - main repo