Guides
Continuous integration
Create a token on hardlabs.io under Settings → CLI access and store it as a secret named HARDLABS_TOKEN.
GitHub Actions
name: board tests
on: [push, pull_request]
concurrency:
group: hardlabs-board-tests # one run at a time per board
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install "hardlabs-sdk[test]" pytest-timeout
# build your firmware here, e.g. into build/app.elf
- run: pytest tests/board --timeout 300 --junitxml=results.xml
env:
HARDLABS_TOKEN: ${{ secrets.HARDLABS_TOKEN }}
HARDLABS_SIM: company_name/board_name
HARDLABS_FIRMWARE: build/app.elfOne run at a time per board
Runs that use the same token on the same board share one simulation. A second run restarts the board under the first, and the first run's teardown then stops it. Queue runs with a concurrency group, as above, or give parallel jobs boards of their own.
Notes
- Waits count simulated time.
pytest-timeoutbounds each test in real time, andtimeout-minutesbounds the job. - GitHub doesn't pass secrets to pull requests from forks. Run board tests on pushes and on pull requests from your own branches.