Repository navigation
Bound received packets to the transfer: DCD clamps, whole packets on dwc2 DMA and samd #8658
Workflow file for this run
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: Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| release: | |
| types: [ published ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
| # no job writes to the repository; self-hosted rigs keep state between jobs, so none may hold a write token | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Check if the code changes and we need to run ci build | |
| # Cannot use paths filter in the on-event since we want this workflow to run even when there are no code changes, to register the commit chain | |
| check-paths: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| code_changed: ${{ steps.gate.outputs.code }} | |
| # hil-hfp-iar trusts its own selector run on this, not rerunning the suites on the rig runner | |
| selector_suites_ok: ${{ steps.gate.outputs.suites_ok }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # the selector diffs against the PR base or the push's before | |
| - name: Get agentrc | |
| # the selector and the matrix read each roster board's flasher from agentrc's board | |
| # registry, at the commit test/hil/agentrc.json pins. A failed fetch fails the | |
| # selector's suites, which runs everything, as every other selector failure does. | |
| continue-on-error: true | |
| run: python3 test/hil/helper/agentrc.py fetch | |
| - name: Selection gate | |
| id: gate | |
| env: | |
| EVENT: ${{ github.event_name }} | |
| BASE_REF: ${{ github.base_ref }} | |
| BEFORE: ${{ github.event.before }} | |
| run: | | |
| # code=false only when the selector, its suites passing, says nothing builds, | |
| # nothing is tested on a rig, and no firmware path is left uncompiled (a gap). | |
| # Every failure, and an event with no diff to read (dispatch, release, a new | |
| # branch's all-zero before), runs everything. | |
| SEL='' | |
| if [ "$EVENT" = pull_request ]; then | |
| SEL="--base origin/$BASE_REF" | |
| elif [ "$EVENT" = push ] && [ -n "${BEFORE//0/}" ]; then | |
| SEL="--endpoints $BEFORE..HEAD" | |
| fi | |
| CODE=true | |
| SUITES_OK=false | |
| if [ -n "$SEL" ] && python3 test/hil/test/test_change_impact.py >/dev/null 2>&1 && | |
| python3 .claude/test/test_build_select.py >/dev/null 2>&1; then | |
| SUITES_OK=true | |
| CODE=$(python3 .claude/skills/build/scripts/check_build.py --select-only $SEL \ | |
| --config test/hil/tinyusb.json --config test/hil/hfp.json | python3 -c ' | |
| import json, sys | |
| sys.path.insert(0, "tools") | |
| import change_impact | |
| print(str(change_impact.build_gate(json.load(sys.stdin))).lower())') || CODE=true | |
| fi | |
| [ "$CODE" = false ] || CODE=true | |
| echo "code=$CODE suites_ok=$SUITES_OK" | |
| printf 'code=%s\nsuites_ok=%s\n' "$CODE" "$SUITES_OK" >> $GITHUB_OUTPUT | |
| set-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| cmake_toolchains: ${{ steps.set-matrix-json.outputs.cmake_toolchains }} | |
| pinned_json: ${{ steps.set-matrix-json.outputs.pinned_matrix }} | |
| hil_json: ${{ steps.set-matrix-json.outputs.hil_matrix }} | |
| hfp_iar_json: ${{ steps.set-matrix-json.outputs.hfp_iar_matrix }} | |
| example_map: ${{ steps.set-matrix-json.outputs.example_map }} | |
| required_json: ${{ steps.set-matrix-json.outputs.required_json }} | |
| membrowse_all: ${{ steps.set-matrix-json.outputs.membrowse_all }} | |
| membrowse_identical: ${{ steps.set-matrix-json.outputs.membrowse_identical }} | |
| # one pair per rig job: hil-tinyusb (tinyusb.json minus esp-idf boards), | |
| # hil-tinyusb-esp (esptool and openocd_esp boards only), hil-tinyusb (hfp.json) | |
| hil_args_tinyusb: ${{ steps.hil-select.outputs.args_tinyusb }} | |
| hil_run_tinyusb: ${{ steps.hil-select.outputs.run_tinyusb }} | |
| hil_args_tinyusb_esp: ${{ steps.hil-select.outputs.args_tinyusb_esp }} | |
| hil_run_tinyusb_esp: ${{ steps.hil-select.outputs.run_tinyusb_esp }} | |
| hil_args_hfp: ${{ steps.hil-select.outputs.args_hfp }} | |
| hil_run_hfp: ${{ steps.hil-select.outputs.run_hfp }} | |
| steps: | |
| - name: Checkout TinyUSB | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get agentrc | |
| continue-on-error: true # the selection below falls back to the full matrix without it | |
| run: python3 test/hil/helper/agentrc.py fetch | |
| - name: CI selection (PR only) | |
| id: hil-select | |
| if: github.event_name == 'pull_request' | |
| env: | |
| BASE_REF: ${{ github.base_ref }} | |
| run: | | |
| # Best-effort by design: set-matrix gates cmake, hil-build and every rig job, | |
| # so a missing origin/<base>, a shallow-clone hiccup or a selector traceback | |
| # must fall back to the FULL matrix (no --select, run=true, no args) instead | |
| # of failing the job. Same fail-open shape as pr_comment.yml's `|| true`. | |
| # | |
| # The selector's own unit suites gate it (stdlib-only, seconds): a selector | |
| # whose tests fail can still exit 0 with valid-but-WRONG JSON -- fail-open alone | |
| # never catches that class, and the pre-commit hil-test hook is a separate, | |
| # advisory workflow that nothing here can `needs:`. Test-failing selector => | |
| # full matrix, same as a crashing one. | |
| SELECT_JSON='' | |
| if ! python3 test/hil/test/test_change_impact.py || ! python3 .claude/test/test_build_select.py; then | |
| echo "::warning::selector unit suites failed - falling back to the full matrix" | |
| elif ! SELECT_JSON=$(python3 .claude/skills/build/scripts/check_build.py --select-only --base "origin/$BASE_REF" \ | |
| --config test/hil/tinyusb.json --config test/hil/hfp.json); then | |
| echo "::warning::selector failed - falling back to the full matrix" | |
| SELECT_JSON='' | |
| fi | |
| # The selection is handed on as a FILE in the workspace, never as a step | |
| # output/env var: it is ~KBs normally but a mass-sweep PR reaches hundreds of | |
| # KB, and an env var that big makes the consuming exec fail with E2BIG BEFORE | |
| # any fallback in it can run. Written here, ahead of its first reader. | |
| # No file (non-PR event, or any fallback) = full matrix. | |
| rm -f selection.json | |
| if [ -n "$SELECT_JSON" ]; then | |
| printf '%s' "$SELECT_JSON" > selection.json | |
| fi | |
| # One args/run pair per rig job, split by flasher: a job whose own subset is | |
| # empty skips explicitly instead of running a board filter that matches zero | |
| # boards ("No tests were run." exits 0 and would read as a green HIL run). | |
| OUT='' | |
| if [ -s selection.json ]; then | |
| OUT=$(python3 -c ' | |
| import json, re, sys | |
| sys.path.insert(0, "tools") | |
| import change_impact | |
| # the reading hil_ci_set_matrix.py applies too: both must agree - one falling | |
| # open to the whole roster while the other computes run=false buys a full | |
| # 37-leg build and still zero hardware coverage | |
| s = change_impact.check_manifest(json.load(open("selection.json")))["hil"] | |
| # a missing rig entry must not read as "nothing selected": run_hfp=false skips | |
| # hil-hfp-iar before it can run its own selection | |
| tin = s["args_flasher"].get("tinyusb.json") | |
| hfp = s["args"].get("hfp.json") | |
| if not isinstance(tin, dict) or not isinstance(hfp, str): | |
| sys.exit("selection has no args for a rig") | |
| rig = change_impact.rig_legs(tin) | |
| legs = (("tinyusb", rig["tinyusb"]), ("tinyusb_esp", rig["tinyusb_esp"]), ("hfp", hfp)) | |
| for key, a in legs: | |
| # roster board names reach $GITHUB_OUTPUT as bare NAME=VALUE lines; a | |
| # newline in one would inject extra run_* lines and flip which rig jobs run. | |
| # ":" and "," are part of the normal shape - a partial filter is | |
| # `-bt <board>:<test>,<test>` (change_impact._board_args) | |
| if not re.fullmatch(r"[-A-Za-z0-9_/ .=+:,]*", a): | |
| sys.exit("unexpected characters in the " + key + " board filter") | |
| print("args_" + key + "=" + a) | |
| print("run_" + key + "=" + ("true" if (s["full"] or a) else "false")) | |
| ') || OUT='' | |
| if [ -z "$OUT" ]; then | |
| echo "::warning::change_impact output unusable - falling back to the full HIL matrix" | |
| # the same unusable selection must not stay behind for the build axis | |
| rm -f selection.json | |
| fi | |
| fi | |
| if [ -z "$OUT" ]; then | |
| OUT=$(for k in tinyusb tinyusb_esp hfp; do printf 'args_%s=\nrun_%s=true\n' "$k" "$k"; done) | |
| fi | |
| echo "$OUT" | |
| echo "$OUT" >> $GITHUB_OUTPUT | |
| - name: Generate matrix json | |
| id: set-matrix-json | |
| env: | |
| # hil-build-esp's own owner gate | |
| WITH_ESP: ${{ github.repository_owner == 'hathach' && '--with-esp' || '' }} | |
| run: | | |
| # Build matrix, scoped by the PR selection when one exists. Best-effort: | |
| # ci_set_matrix falls back to the full matrix itself on unusable JSON, | |
| # and a missing file (non-PR event, selector fallback) means no flags. | |
| SELECT_FILE=selection.json | |
| [ -s "$SELECT_FILE" ] || SELECT_FILE='' | |
| BUILD_SELECT_FILE="$SELECT_FILE" | |
| PINNED_JSON='' | |
| if [ -n "$SELECT_FILE" ]; then | |
| # ci_set_matrix falls open on a selection it cannot use with rc 0 - it prints | |
| # the full matrix and says UNSCOPED on stderr. The build extras below must | |
| # not stay scoped when it did, or a nominally full build compiles 1 of 44 | |
| # examples per family and membrowse uploads that partial run's sizes as if | |
| # it were the full build. Only the BUILD axis is dropped: build.families | |
| # being unusable says nothing about the boards map the HIL matrix reads. | |
| # --pinned filters AFTER every fall-open decision, so this run's stderr is | |
| # the same marker the unfiltered one prints - no second invocation needed. | |
| PINNED_JSON=$(python .github/scripts/ci_set_matrix.py --pinned --select-file "$SELECT_FILE" 2>ci_set_matrix.err) || PINNED_JSON='' | |
| cat ci_set_matrix.err >&2 | |
| if [ -z "$PINNED_JSON" ] || grep -q 'ci_set_matrix: UNSCOPED' ci_set_matrix.err; then | |
| BUILD_SELECT_FILE='' | |
| fi | |
| fi | |
| [ -z "$PINNED_JSON" ] && PINNED_JSON=$(python .github/scripts/ci_set_matrix.py --pinned) | |
| # The per-family example map rides as a side channel: putting it inside | |
| # matrix entries would multiply GHA legs and break CircleCI's family parameter. | |
| EXAMPLE_MAP='{}' | |
| if [ -n "$BUILD_SELECT_FILE" ]; then | |
| EXAMPLE_MAP=$(python .github/scripts/ci_set_matrix.py --example-map --select-file "$BUILD_SELECT_FILE") || | |
| EXAMPLE_MAP='{}' | |
| fi | |
| # the changed boards the pinned matrix does not build (cmake-required); from | |
| # SELECT_FILE, since a build matrix fallen open to full still leaves them out | |
| REQUIRED_JSON=$(python .github/scripts/ci_set_matrix.py --required ${SELECT_FILE:+--select-file "$SELECT_FILE"}) || | |
| REQUIRED_JSON=$(python .github/scripts/ci_set_matrix.py --required) | |
| for b in $(echo "$REQUIRED_JSON" | jq -r '.unbuildable[]'); do | |
| echo "::warning::changed board $b is built by no CI toolchain" | |
| done | |
| echo "required_json=$REQUIRED_JSON" | |
| echo "required_json=$REQUIRED_JSON" >> $GITHUB_OUTPUT | |
| echo "pinned_matrix=$PINNED_JSON" | |
| echo "pinned_matrix=$PINNED_JSON" >> $GITHUB_OUTPUT | |
| echo "example_map=$EXAMPLE_MAP" >> $GITHUB_OUTPUT | |
| # the `cmake` job's toolchains, one list for its matrix and the code-size scope | |
| # (arm-clang and esp-idf are not built there: see that job's comment) | |
| echo 'cmake_toolchains=["aarch64-gcc", "arm-gcc", "ft9xx-gcc", "msp430-gcc", "riscv-gcc"]' >> $GITHUB_OUTPUT | |
| # HIL matrix (merged from tinyusb + hifiphile configs), scoped on PRs. | |
| # Scoping is best-effort too: fall back to the unscoped (full) matrix. | |
| HIL_MATRIX_JSON='' | |
| if [ -n "$SELECT_FILE" ]; then | |
| HIL_MATRIX_JSON=$(python .github/scripts/hil_ci_set_matrix.py --select-file "$SELECT_FILE" test/hil/tinyusb.json test/hil/hfp.json) || HIL_MATRIX_JSON='' | |
| if [ -z "$HIL_MATRIX_JSON" ]; then | |
| echo "::warning::scoped HIL matrix failed - falling back to the full HIL matrix" | |
| fi | |
| fi | |
| if [ -z "$HIL_MATRIX_JSON" ]; then | |
| HIL_MATRIX_JSON=$(python .github/scripts/hil_ci_set_matrix.py test/hil/tinyusb.json test/hil/hfp.json) | |
| fi | |
| echo "hil_matrix=$HIL_MATRIX_JSON" | |
| echo "hil_matrix=$HIL_MATRIX_JSON" >> $GITHUB_OUTPUT | |
| # hfp-iar-build's legs: every hfp.json build entry, never scoped by the selection | |
| HFP_IAR_JSON=$(python .github/scripts/hil_ci_set_matrix.py test/hil/hfp.json | jq -c '.["arm-gcc"]') | |
| echo "hfp_iar_matrix=$HFP_IAR_JSON" | |
| echo "hfp_iar_matrix=$HFP_IAR_JSON" >> $GITHUB_OUTPUT | |
| # membrowse-identical's legs: the pinned and espressif legs no build above uploads | |
| MEMBROWSE_JSON=$(python .github/scripts/ci_set_matrix.py --membrowse --pinned-json "$PINNED_JSON" \ | |
| --hil-json "$HIL_MATRIX_JSON" \ | |
| --hil-full-json "$(python .github/scripts/hil_ci_set_matrix.py test/hil/tinyusb.json)" $WITH_ESP) || { | |
| echo "::warning::membrowse partition failed - no --identical uploads this run" | |
| MEMBROWSE_JSON='{"all": [], "identical": []}' | |
| } | |
| echo "membrowse=$MEMBROWSE_JSON" | |
| echo "membrowse_all=$(echo "$MEMBROWSE_JSON" | jq -c .all)" >> $GITHUB_OUTPUT | |
| echo "membrowse_identical=$(echo "$MEMBROWSE_JSON" | jq -c .identical)" >> $GITHUB_OUTPUT | |
| # The legs this run expects a code-size snapshot from, for pr_comment.yml's compare: a | |
| # leg that dies before its snapshot step leaves no artifact, which only this manifest | |
| # can tell apart from a leg that was never selected: the cmake job's pinned families and | |
| # hil-build-esp's legs (a -DMA variant reports as a board of its own), under that job's own | |
| # gate. No legs when no code changed. | |
| # Nothing needs it, so it stays off the critical path; measurement only, never red. | |
| code-size-scope: | |
| needs: [ check-paths, set-matrix ] | |
| if: github.event_name == 'pull_request' || github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Code size scope | |
| env: | |
| TOOLCHAINS: ${{ needs.set-matrix.outputs.cmake_toolchains }} | |
| PINNED_JSON: ${{ needs.set-matrix.outputs.pinned_json }} | |
| EXAMPLE_MAP: ${{ needs.set-matrix.outputs.example_map }} | |
| CODE_CHANGED: ${{ needs.check-paths.outputs.code_changed }} | |
| HIL_JSON: ${{ needs.set-matrix.outputs.hil_json }} | |
| OWNER: ${{ github.repository_owner }} | |
| run: | | |
| mkdir -p code-size-scope | |
| jq -n --argjson tc "$TOOLCHAINS" --argjson pinned "$PINNED_JSON" --argjson ex "$EXAMPLE_MAP" \ | |
| --argjson hil "$HIL_JSON" --arg changed "$CODE_CHANGED" --arg owner "$OWNER" \ | |
| '{schema: 1, code_changed: ($changed == "true"), family_examples: $ex, | |
| legs: (if $changed == "true" then [$tc[] as $t | ($pinned[$t] // [])[] | {toolchain: $t, arg: .}] | |
| + [if $owner == "hathach" then ($hil["esp-idf"] // [])[] else empty end | |
| | {toolchain: "esp-idf", arg: .}] | |
| else [] end)}' \ | |
| > code-size-scope/scope.json | |
| cat code-size-scope/scope.json | |
| - name: Upload code size scope | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: code-size-scope | |
| path: code-size-scope/scope.json | |
| retention-days: ${{ github.event_name == 'push' && 90 || 14 }} | |
| # ------------------------------------------------------------------------------ | |
| # CMake build: the families with a membrowse CI board, building that board - the only | |
| # boards this job exists for, since CircleCI builds every board of every family. A | |
| # pinned board that cannot build the PR's -e examples still falls back to another board | |
| # of its family (see resolve_ci_boards), which then builds but does not upload. A | |
| # toolchain with no pinned family gets an empty matrix entry and skips. | |
| # Note: | |
| # For Make and IAR build: will be done on CircleCI only (one random per family as well) | |
| # ------------------------------------------------------------------------------ | |
| cmake: | |
| needs: [ check-paths, set-matrix ] | |
| # with nothing to build, membrowse-identical uploads these boards instead | |
| if: needs.check-paths.outputs.code_changed == 'true' | |
| uses: ./.github/workflows/build_util.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # arm-clang and esp-idf stay out: esp-idf would double-build hil-build-esp's boards | |
| toolchain: ${{ fromJSON(needs.set-matrix.outputs.cmake_toolchains) }} | |
| with: | |
| build-system: 'cmake' | |
| toolchain: ${{ matrix.toolchain }} | |
| build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.pinned_json)[matrix.toolchain]) }} | |
| build-options: '--ci-pinned-boards .github/ci-pinned-boards.json' | |
| example-map: ${{ needs.set-matrix.outputs.example_map }} | |
| upload-artifacts: false | |
| upload-membrowse: true | |
| secrets: inherit | |
| # Changed boards the cmake job does not build (an unpinned board, or a pinned one whose | |
| # family the selection left out), each on its family's toolchain. Builds only: sizes | |
| # stay the pinned boards' (cmake, hil-build-esp). An empty toolchain leg skips. | |
| cmake-required: | |
| needs: [ check-paths, set-matrix ] | |
| if: needs.check-paths.outputs.code_changed == 'true' | |
| uses: ./.github/workflows/build_util.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # ci_set_matrix.py's REQUIRED_TOOLCHAINS | |
| toolchain: [ 'aarch64-gcc', 'arm-gcc', 'esp-idf', 'ft9xx-gcc', 'msp430-gcc', 'riscv-gcc', 'rx-gcc' ] | |
| with: | |
| build-system: 'cmake' | |
| toolchain: ${{ matrix.toolchain }} | |
| build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.required_json)[matrix.toolchain]) }} | |
| # --------------------------------------- | |
| # Build Make/CMake on Windows/MacOS | |
| # --------------------------------------- | |
| build-os: | |
| needs: [ check-paths ] | |
| if: needs.check-paths.outputs.code_changed == 'true' | |
| uses: ./.github/workflows/build_util.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ windows-latest, macos-latest ] | |
| build-system: [ 'make', 'cmake' ] | |
| with: | |
| os: ${{ matrix.os }} | |
| build-system: ${{ matrix.build-system }} | |
| toolchain: 'arm-gcc-${{ matrix.os }}' | |
| build-args: '["stm32h7rs"]' | |
| build-options: '--one-random' | |
| # --------------------------------------- | |
| # Zephyr | |
| # --------------------------------------- | |
| zephyr: | |
| needs: [ check-paths ] | |
| # skip zephyr build due to failed build, fix later | |
| if: false | |
| #if: needs.check-paths.outputs.code_changed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout TinyUSB | |
| uses: actions/checkout@v6 | |
| - name: Setup Zephyr project | |
| uses: zephyrproject-rtos/action-zephyr-setup@v1 | |
| with: | |
| app-path: examples | |
| toolchains: arm-zephyr-eabi | |
| - name: Build | |
| run: | | |
| west build -b nrf52840dk -d examples/device/cdc_msc/build examples/device/cdc_msc -- -DRTOS=zephyr | |
| west build -b nrf52840dk -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr | |
| # --------------------------------------- | |
| # Hardware in the loop (HIL) | |
| # Run on PR only (hil-tinyusb), hil-hfp-iar only run on non-forked PR | |
| # --------------------------------------- | |
| hil-build: | |
| needs: [ check-paths, set-matrix ] | |
| if: needs.check-paths.outputs.code_changed == 'true' && github.repository_owner == 'hathach' | |
| uses: ./.github/workflows/build_util.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # These names are the bucket keys of .github/scripts/hil_ci_set_matrix.py: every | |
| # roster board not built under esp-idf must land in one of them (esptool and | |
| # openocd_esp boards go to 'esp-idf', built by hil-build-esp below). hil_ci_set_matrix.py rejects a | |
| # board whose "toolchain" is not a bucket, so a new bucket must be added in | |
| # both places. | |
| # | |
| # INVARIANT the PR-scoped skip cascade rests on: hil_run_tinyusb / hil_run_hfp | |
| # true => hil-build has at least one non-empty leg. It holds because those | |
| # flags count only non-esp-idf boards and every such board builds here. It | |
| # would break if an esp-idf board were added to hfp.json, because | |
| # hil_args_hfp is NOT flasher-split: the hfp leg of hil-tinyusb would want to | |
| # run while hil-build (and therefore that leg) skipped. | |
| toolchain: | |
| - 'arm-gcc' | |
| - 'riscv-gcc' | |
| with: | |
| build-system: 'cmake' | |
| toolchain: ${{ matrix.toolchain }} | |
| build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.hil_json)[matrix.toolchain]) }} | |
| upload-artifacts: true | |
| # esp-idf builds are by far the slowest; keep them out of hil-build so the main | |
| # hil-tinyusb run starts as soon as the fast toolchains finish (esp boards get | |
| # their own hil-tinyusb-esp run gated only on this job) | |
| hil-build-esp: | |
| needs: [ check-paths, set-matrix ] | |
| if: needs.check-paths.outputs.code_changed == 'true' && github.repository_owner == 'hathach' | |
| uses: ./.github/workflows/build_util.yml | |
| with: | |
| build-system: 'cmake' | |
| toolchain: 'esp-idf' | |
| build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.hil_json)['esp-idf']) }} | |
| upload-artifacts: true | |
| upload-membrowse: true | |
| secrets: inherit | |
| # IAR compile check of every hfp.json build (variants included) on a hosted runner. | |
| # hil-hfp-iar builds them on the rig runner only for the boards the PR selection picks | |
| # by HIL test impact, so a change that breaks only the IAR build of an untested path | |
| # (e.g. a host driver on these device-only boards) was first seen failing on master. | |
| # Push needs no copy: hil-hfp-iar builds the full hfp matrix there. Non-fork PRs only, | |
| # as the IAR token is not passed to forks. | |
| hfp-iar-build: | |
| needs: [ check-paths, set-matrix ] | |
| if: | | |
| github.event_name == 'pull_request' && needs.check-paths.outputs.code_changed == 'true' && | |
| github.repository_owner == 'hathach' && github.event.pull_request.head.repo.fork == false | |
| uses: ./.github/workflows/build_util.yml | |
| with: | |
| build-system: 'cmake' | |
| toolchain: 'arm-iar' | |
| build-args: ${{ needs.set-matrix.outputs.hfp_iar_json }} | |
| secrets: inherit | |
| # Every membrowse leg no build uploads goes --identical here, so each commit has one | |
| # upload per target: the pinned and espressif legs ci_set_matrix.py --membrowse leaves to | |
| # it, or all of them when the gate builds nothing. No toolchain: build.py derives each | |
| # board's targets without configuring (test_membrowse_targets.py guards that list). | |
| # Never on hil-build-esp's own gate, so it cannot reach the rig. | |
| membrowse-identical: | |
| needs: [ check-paths, set-matrix ] | |
| # a failed gate has no code_changed: reading that as "nothing built" would upload | |
| # unchanged rows for firmware that may have changed | |
| if: ${{ !cancelled() && needs.check-paths.result == 'success' && needs.set-matrix.result == 'success' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout TinyUSB | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| # nothing here talks to the remote, and the steps below run third-party | |
| # membrowse: no reason to leave GITHUB_TOKEN in .git/config for it | |
| persist-credentials: false | |
| - name: Install membrowse | |
| # this runner holds MEMBROWSE_API_KEY: wheel-only runs no sdist setup script, | |
| # pinned runs no new release unreviewed | |
| run: 'pip install --only-binary :all: membrowse==1.2.17' | |
| - name: Membrowse identical upload | |
| continue-on-error: true | |
| env: | |
| MEMBROWSE_API_KEY: ${{ secrets.MEMBROWSE_API_KEY }} | |
| LEGS: ${{ needs.check-paths.outputs.code_changed == 'true' && needs.set-matrix.outputs.membrowse_identical || needs.set-matrix.outputs.membrowse_all }} | |
| run: | | |
| # one build.py call per leg, its words split as argv (never through a shell), 8 at | |
| # a time: a docs-only run is ~1100 uploads. A failed leg leaves the others theirs | |
| # and fails the step at the end. A -DMA variant uploads as <build-name>/<example>. | |
| echo "$LEGS" | jq -r '.[]' | | |
| xargs -r -P 8 -L 1 python3 tools/build.py -s cmake --target examples-membrowse-upload -j 1 | |
| # --------------------------------------- | |
| # Hardware in the loop (HIL) | |
| # self-hosted on local VM, for attached hardware checkout HIL_JSON | |
| # --------------------------------------- | |
| hil-tinyusb: | |
| needs: [ hil-build, set-matrix ] | |
| name: hil-tinyusb (${{ matrix.display }}) | |
| # Above hil_test.py's pool guard (HIL_POOL_TIMEOUT, 60 min) so the guard fires first | |
| # and still gets to write its report. The ~15 min on top is what the job pays OUTSIDE | |
| # the guard clock: workspace cleanup, checkout and the multi-board artifact merge | |
| # before it; the report write and the upload after it. A ceiling below guard+tail cancels the job | |
| # before hil_report.md exists. Both legs share the script and the guard. | |
| timeout-minutes: 75 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - display: tinyusb.json | |
| runner: [ self-hosted, X64, hathach, hardware-in-the-loop ] | |
| hil_json: test/hil/tinyusb.json | |
| # esp-idf (espressif) boards run in hil-tinyusb-esp, | |
| # gated on the slow esp-idf build | |
| test_args: '--exclude-flasher esptool --exclude-flasher openocd_esp' | |
| - display: hfp.json | |
| runner: [ self-hosted, Linux, X64, hifiphile ] | |
| hil_json: test/hil/hfp.json | |
| test_args: '' | |
| runs-on: ${{ matrix.runner }} | |
| env: | |
| # HIL_POOL_TIMEOUT deliberately unset: hil_test.py's 60 min default is below every | |
| # ceiling here, so ceiling > guard holds by construction. Pin it to SHORTEN a run | |
| # only -- pinning it above a ceiling re-inverts the two. | |
| HIL_JSON: ${{ matrix.hil_json }} | |
| steps: | |
| - name: Set HIL report dir (per run+job; persists across run attempts) | |
| run: | | |
| # one report dir per (run id, job): re-run attempts find their own report/spec, | |
| # and interleaved runs of other PRs/jobs on the same runner cannot clobber them | |
| BASE="$(dirname "$GITHUB_WORKSPACE")/hil-report" | |
| # prune per-run dirs older than 2 weeks | |
| find "$BASE" -mindepth 1 -maxdepth 1 -type d -mtime +14 -exec rm -rf {} + 2>/dev/null || true | |
| echo "HIL_REPORT_DIR=$BASE/${GITHUB_RUN_ID}-$(basename "${{ matrix.display }}" .json)" >> "$GITHUB_ENV" | |
| - name: Get re-run spec from previous attempt | |
| if: github.run_attempt != '1' | |
| run: | | |
| # the report dir is keyed by run id, so a spec here can only have been | |
| # written by an earlier attempt of THIS run | |
| SPEC="$HIL_REPORT_DIR/$(basename "${{ env.HIL_JSON }}").failed" | |
| RERUN_ARGS="" | |
| [ -f "$SPEC" ] && RERUN_ARGS=$(cat "$SPEC") | |
| echo "RERUN_ARGS=$RERUN_ARGS" | |
| echo "RERUN_ARGS=$RERUN_ARGS" >> $GITHUB_ENV | |
| - name: Clean workspace | |
| run: | | |
| echo "Cleaning up for the first run" | |
| rm -rf "${{ github.workspace }}" | |
| mkdir -p "${{ github.workspace }}" | |
| - name: Checkout TinyUSB | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| # the merge commit's parents: the SystemView capture records its base and head (checkout_identity) | |
| fetch-depth: 2 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: binaries-* | |
| path: cmake-build | |
| merge-multiple: true | |
| - name: Test on actual hardware | |
| # Single attempt per test (--retry 1), no in-run second pass: a broken fixture | |
| # fails fast instead of holding the runner (and other PRs' HIL jobs) for hours. | |
| env: | |
| # tinyusb.json minus the esp-idf boards (they run in hil-tinyusb-esp): each | |
| # job gates on its own flasher subset, never on a rig-wide flag | |
| SEL_ARGS_TINYUSB: ${{ needs.set-matrix.outputs.hil_args_tinyusb }} | |
| SEL_RUN_TINYUSB: ${{ needs.set-matrix.outputs.hil_run_tinyusb }} | |
| SEL_ARGS_HFP: ${{ needs.set-matrix.outputs.hil_args_hfp }} | |
| SEL_RUN_HFP: ${{ needs.set-matrix.outputs.hil_run_hfp }} | |
| run: | | |
| case "$HIL_JSON" in | |
| *tinyusb.json) SEL_ARGS="$SEL_ARGS_TINYUSB"; SEL_RUN="$SEL_RUN_TINYUSB" ;; | |
| *hfp.json) SEL_ARGS="$SEL_ARGS_HFP"; SEL_RUN="$SEL_RUN_HFP" ;; | |
| esac | |
| # the board locks and the report document come from agentrc at the commit | |
| # test/hil/agentrc.json pins, a skipped leg's report included; a failed fetch fails | |
| # the step, and the prepare step's marker says the report is unavailable. | |
| python3 test/hil/helper/agentrc.py fetch | |
| if [ "$SEL_RUN" = "false" ]; then | |
| echo "HIL skipped by PR selection (no affected boards on this rig)" | |
| # a report saying so, or the combined PR comment drops the section (and leaves a | |
| # stale table from an earlier push in its place) | |
| python3 test/hil/helper/hil_report.py no-selection "$HIL_JSON" \ | |
| '_Skipped by PR selection: no affected boards on this rig._' --report-dir "$HIL_REPORT_DIR" || | |
| { echo "::error::could not write the no-selection HIL report"; exit 1; } | |
| exit 0 | |
| fi | |
| # a re-run spec is already a subset of the selection (only the boards/tests | |
| # that failed); -b/-bt accumulate, so keeping SEL_ARGS here would re-run the | |
| # entire original selection instead of just what failed | |
| if [ -n "$RERUN_ARGS" ]; then SEL_ARGS=''; fi | |
| # SystemView capture of the selected roster sysview boards, before each one's final park, flashing the | |
| # traced image hil-build's sysview leg uploaded. Not on re-run attempts: a re-run recaptures every board, | |
| # wasting shared-rig time for no report benefit. | |
| SV_ARGS='' | |
| if [ "${{ github.run_attempt }}" = 1 ]; then SV_ARGS='--sysview-out sysview-out'; fi | |
| python3 test/hil/hil_test.py --retry 1 ${{ matrix.test_args }} $SEL_ARGS ${{ env.HIL_JSON }} $RERUN_ARGS $SV_ARGS | |
| - &hil_report_prepare | |
| name: Prepare HIL report | |
| id: prepare | |
| if: always() && github.event_name == 'pull_request' | |
| # the uploaded Markdown is a rendering of the uploaded JSON or an explicit unavailable | |
| # notice, never a table the JSON does not hold. When prepare fails (with agentrc | |
| # missing or off its pin not even the notice writer loads) the upload takes a fresh dir | |
| # holding only its hil_report.unprepared marker, made here without the checkout's | |
| # scripts: the report dir can still hold an earlier attempt's report. The hfp job sets | |
| # no HIL_REPORT_DIR and reports in the workspace. | |
| run: | | |
| REPORT_DIR="${HIL_REPORT_DIR:-.}" | |
| if python3 test/hil/helper/hil_report.py prepare --report-dir "$REPORT_DIR"; then | |
| echo "dir=$REPORT_DIR" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| UNPREPARED="$RUNNER_TEMP/hil-report-unprepared-$GITHUB_RUN_ATTEMPT" | |
| rm -rf "$UNPREPARED" | |
| mkdir -p "$UNPREPARED" | |
| touch "$UNPREPARED/hil_report.unprepared" | |
| echo "dir=$UNPREPARED" >> "$GITHUB_OUTPUT" | |
| exit 1 | |
| - name: Upload HIL report | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: hil-report-${{ matrix.display }} | |
| # the allowlist of report files, never the whole report dir | |
| path: &hil_report_files | | |
| ${{ steps.prepare.outputs.dir }}/hil_report.md | |
| ${{ steps.prepare.outputs.dir }}/hil_report.json | |
| ${{ steps.prepare.outputs.dir }}/hil_report.attempts/ | |
| ${{ steps.prepare.outputs.dir }}/hil_report.unprepared | |
| ${{ steps.prepare.outputs.dir }}/audio/ | |
| if-no-files-found: ignore | |
| overwrite: true | |
| - name: Upload SystemView captures | |
| # records and raw captures, base-branch pushes included: sysview-report decodes them off the rig | |
| if: ${{ !cancelled() && github.run_attempt == '1' }} | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: sysview-${{ matrix.display }} | |
| path: | | |
| sysview-out/sysview-*.json | |
| sysview-out/*-capture.SVDat | |
| if-no-files-found: ignore | |
| overwrite: true | |
| # --------------------------------------- | |
| # Hardware in the loop (HIL) - espressif boards only | |
| # Same rig as hil-tinyusb (tinyusb.json) but gated only on the slow esp-idf build, | |
| # so the main run does not wait for it. Per-board flocks arbitrate the shared rig; | |
| # the runner has a single job slot, so the two HIL jobs never overlap. | |
| # --------------------------------------- | |
| hil-tinyusb-esp: | |
| needs: [ hil-build-esp, set-matrix ] | |
| name: hil-tinyusb (tinyusb-esp.json) | |
| runs-on: [ self-hosted, X64, hathach, hardware-in-the-loop ] | |
| # above hil_test.py's pool guard (60 min) with ~15 min for the pre-pool checkout | |
| # and the report upload, so its own guard still writes a report; | |
| # only a job wedged past that (unkillable D-state worker) hits this ceiling, which | |
| # must exist because the runner has one job slot and holds every queued job hostage | |
| timeout-minutes: 75 | |
| env: | |
| HIL_JSON: test/hil/tinyusb.json | |
| # hil_test.py refuses an openocd_esp board under a CI job (hathach/tinyusb#4256) | |
| TEST_ARGS: '--flasher esptool --flasher openocd_esp' | |
| steps: | |
| - name: Set HIL report dir (per run+job; persists across run attempts) | |
| run: | | |
| # one report dir per (run id, job): re-run attempts find their own report/spec, | |
| # and interleaved runs of other PRs/jobs on the same runner cannot clobber them | |
| BASE="$(dirname "$GITHUB_WORKSPACE")/hil-report" | |
| # prune per-run dirs older than 2 weeks | |
| find "$BASE" -mindepth 1 -maxdepth 1 -type d -mtime +14 -exec rm -rf {} + 2>/dev/null || true | |
| echo "HIL_REPORT_DIR=$BASE/${GITHUB_RUN_ID}-tinyusb-esp" >> "$GITHUB_ENV" | |
| - name: Get re-run spec from previous attempt | |
| if: github.run_attempt != '1' | |
| run: | | |
| # the report dir is keyed by run id, so a spec here can only have been | |
| # written by an earlier attempt of THIS run | |
| SPEC="$HIL_REPORT_DIR/$(basename "${{ env.HIL_JSON }}").failed" | |
| RERUN_ARGS="" | |
| [ -f "$SPEC" ] && RERUN_ARGS=$(cat "$SPEC") | |
| echo "RERUN_ARGS=$RERUN_ARGS" | |
| echo "RERUN_ARGS=$RERUN_ARGS" >> $GITHUB_ENV | |
| - name: Clean workspace | |
| run: | | |
| echo "Cleaning up for the first run" | |
| rm -rf "${{ github.workspace }}" | |
| mkdir -p "${{ github.workspace }}" | |
| - name: Checkout TinyUSB | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: binaries-esp-idf-* | |
| path: cmake-build | |
| merge-multiple: true | |
| - name: Test on actual hardware | |
| env: | |
| # esp-idf subset of tinyusb.json: this job must gate on its own boards, not | |
| # on the rig-wide flag (which would run a filter matching zero boards) | |
| SEL_ARGS: ${{ needs.set-matrix.outputs.hil_args_tinyusb_esp }} | |
| SEL_RUN: ${{ needs.set-matrix.outputs.hil_run_tinyusb_esp }} | |
| run: | | |
| # the board locks and the report document come from agentrc at the commit | |
| # test/hil/agentrc.json pins, a skipped leg's report included; a failed fetch fails | |
| # the step, and the prepare step's marker says the report is unavailable. | |
| python3 test/hil/helper/agentrc.py fetch | |
| if [ "$SEL_RUN" = "false" ]; then | |
| echo "HIL skipped by PR selection (no affected esp-idf boards)" | |
| # a report saying so, or the combined PR comment drops the section (and leaves a | |
| # stale table from an earlier push in its place) | |
| python3 test/hil/helper/hil_report.py no-selection "$HIL_JSON" \ | |
| '_Skipped by PR selection: no affected esp-idf boards._' --report-dir "$HIL_REPORT_DIR" || | |
| { echo "::error::could not write the no-selection HIL report"; exit 1; } | |
| exit 0 | |
| fi | |
| # a re-run spec is already a subset of the selection (only the boards/tests | |
| # that failed); -b/-bt accumulate, so keeping SEL_ARGS here would re-run the | |
| # entire original selection instead of just what failed | |
| if [ -n "$RERUN_ARGS" ]; then SEL_ARGS=''; fi | |
| python3 test/hil/hil_test.py --retry 1 $TEST_ARGS $SEL_ARGS ${{ env.HIL_JSON }} $RERUN_ARGS | |
| - *hil_report_prepare | |
| - name: Upload HIL report | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: hil-report-tinyusb-esp.json | |
| path: *hil_report_files | |
| if-no-files-found: ignore | |
| overwrite: true | |
| # --------------------------------------- | |
| # Hardware in the loop (HIL) | |
| # self-hosted by HFP, build with IAR toolchain, for attached hardware checkout test/hil/hfp.json | |
| # Since IAR Token secret is not passed to forked PR, only build non-forked PR | |
| # --------------------------------------- | |
| hil-hfp-iar: | |
| needs: [ check-paths, set-matrix ] | |
| # set-matrix only decides the skip, before this job takes the self-hosted runner; a | |
| # set-matrix that did not succeed (it can fail after writing run_hfp) leaves the | |
| # job to its own selection below, so an unrelated failure cannot cost hfp coverage | |
| if: | | |
| !cancelled() && needs.check-paths.result == 'success' && | |
| needs.check-paths.outputs.code_changed == 'true' && | |
| github.repository_owner == 'hathach' && | |
| !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true) && | |
| (needs.set-matrix.result != 'success' || needs.set-matrix.outputs.hil_run_hfp != 'false') | |
| runs-on: [ self-hosted, Linux, X64, hifiphile ] | |
| # Unlike the hil-tinyusb jobs, this one BUILDS with IAR in the same job before running | |
| # hil_test.py -- hfp.json's 5 boards, 7 variant entries, "up to 30 minutes" (see the | |
| # comment above the selection step). The ceiling has to cover build + the 60 min pool | |
| # guard + overhead, or GitHub cancels before the guard can write its report. 30 + 60 = | |
| # 90; the remaining ~15 is the full-history checkout, get_deps and the report upload. | |
| timeout-minutes: 105 | |
| env: | |
| IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }} | |
| PYTHONUNBUFFERED: '1' | |
| steps: | |
| - name: Clean workspace | |
| run: | | |
| echo "Cleaning up previous run" | |
| rm -rf "${{ github.workspace }}" | |
| mkdir -p "${{ github.workspace }}" | |
| - name: Toolchain version | |
| run: | | |
| iccarm --version | |
| - name: Checkout TinyUSB | |
| uses: actions/checkout@v6 | |
| with: | |
| # self-hosted: leave no GITHUB_TOKEN in .git/config for later jobs | |
| persist-credentials: false | |
| # full history: the "HIL selection" step below needs | |
| # merge-base(HEAD, origin/<base_ref>) for PR-scoped selection | |
| fetch-depth: 0 | |
| - name: Get agentrc | |
| # hil_test.py's board locks and the report document, a run the selection skipped | |
| # included, and the selector's board registry | |
| run: python3 test/hil/helper/agentrc.py fetch | |
| # Computed BEFORE the build: the IAR build is seven entries and up to 30 minutes on | |
| # a runner that hil-tinyusb (hfp.json) also needs, so an unaffected PR must release | |
| # it immediately instead of building everything and then skipping. The selection | |
| # also narrows what gets built. | |
| # Its own selection: set-matrix's outputs only gate the job. | |
| - name: HIL selection (PR only) | |
| if: github.event_name == 'pull_request' | |
| env: | |
| BASE_REF: ${{ github.base_ref }} | |
| SUITES_OK: ${{ needs.check-paths.outputs.selector_suites_ok }} | |
| run: | | |
| # Best-effort: a selector failure here falls back to the full hfp matrix (no | |
| # selection.json, no SEL_* vars), never fails the job. check-paths ran the | |
| # selector's suites on this commit; this is the rig's runner, so no rerun here. | |
| if [ "$SUITES_OK" != true ]; then | |
| echo "::warning::selector unit suites did not pass in check-paths - running the full hfp matrix" | |
| rm -f selection.json | |
| exit 0 | |
| fi | |
| if ! python3 .claude/skills/build/scripts/check_build.py --select-only --base "origin/$BASE_REF" \ | |
| --config test/hil/hfp.json > selection.json; then | |
| echo "::warning::selector failed - running the full hfp matrix" | |
| rm -f selection.json | |
| exit 0 | |
| fi | |
| # selection.json is passed to hil_ci_set_matrix.py --select below to scope the | |
| # build; it already honours hil.full by ignoring the board list. | |
| # The hil_test.py args go to a file, never to $GITHUB_ENV: they are derived | |
| # from roster board names, which a PR can edit. Only SEL_RUN (a literal | |
| # true/false computed here, needed by the step-level `if:`) goes to the env. | |
| if ! SEL_RUN=$(python3 -c ' | |
| import json, sys | |
| sys.path.insert(0, "tools") | |
| import change_impact | |
| s = change_impact.check_manifest(json.load(open("selection.json")))["hil"] | |
| a = s["args"]["hfp.json"] | |
| open("hil_sel_args.txt", "w").write(a) | |
| print("true" if (s["full"] or a) else "false") | |
| '); then | |
| echo "::warning::change_impact output unusable - running the full hfp matrix" | |
| rm -f selection.json hil_sel_args.txt | |
| exit 0 | |
| fi | |
| echo "SEL_RUN=$SEL_RUN" | |
| echo "SEL_RUN=$SEL_RUN" >> $GITHUB_ENV | |
| - name: Get build boards | |
| if: env.SEL_RUN != 'false' | |
| run: | | |
| # --select-file, never --select "$(cat ...)": a whole selection as one argv | |
| # can exceed MAX_ARG_STRLEN on a big diff, and this job's design is to fall | |
| # back to the full hfp matrix on any selector trouble, not to fail the step. | |
| MATRIX_JSON='' | |
| if [ -f selection.json ]; then | |
| MATRIX_JSON=$(python .github/scripts/hil_ci_set_matrix.py --select-file selection.json test/hil/hfp.json) || MATRIX_JSON='' | |
| if [ -z "$MATRIX_JSON" ]; then | |
| echo "::warning::scoped hfp matrix failed - building the full hfp matrix" | |
| fi | |
| fi | |
| if [ -z "$MATRIX_JSON" ]; then | |
| MATRIX_JSON=$(python .github/scripts/hil_ci_set_matrix.py test/hil/hfp.json) | |
| fi | |
| # Each variant carries its own --build-name/--cflag, which are global to a | |
| # single build.py invocation — so keep one matrix entry per line and build | |
| # them one at a time (joining would leak a variant's flags onto every board). | |
| echo "$MATRIX_JSON" | jq -r '.["arm-gcc"][]' > hil_build_entries.txt | |
| cat hil_build_entries.txt | |
| BUILD_ARGS=$(echo "$MATRIX_JSON" | jq -r '.["arm-gcc"] | join(" ")') | |
| # board and example names are roster data a PR can edit, and jq -r un-escapes | |
| # them: a newline here writes extra NAME=VALUE lines into GITHUB_ENV for every | |
| # later step of a job that holds the IAR token. Refuse rather than guess. | |
| case "$BUILD_ARGS" in | |
| *[!-A-Za-z0-9_/\ .=+]*) | |
| echo "::error::unexpected characters in the hfp build args"; exit 1 ;; | |
| esac | |
| echo "BUILD_ARGS=$BUILD_ARGS" | |
| echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV | |
| - name: Get Dependencies | |
| if: env.SEL_RUN != 'false' | |
| run: python3 tools/get_deps.py $BUILD_ARGS | |
| - name: Build | |
| if: env.SEL_RUN != 'false' | |
| # Bounded SEPARATELY from the job. This is the only HIL job that builds inline | |
| # (hil-tinyusb downloads artifacts), and the job ceiling went 30 -> 105 to give the | |
| # HIL step room -- which would hand a stalled IAR build the whole window on the | |
| # shared self-hosted runner, never reaching hil_test.py or the report upload. | |
| # Typical full build here is a few minutes; 30 leaves generous headroom. | |
| timeout-minutes: 30 | |
| run: | | |
| readarray -t ENTRIES < hil_build_entries.txt | |
| for entry in "${ENTRIES[@]}"; do | |
| echo "+ tools/build.py --toolchain iar $entry" | |
| python3 tools/build.py --toolchain iar $entry | |
| done | |
| - name: Test on actual hardware (hardware in the loop) | |
| run: | | |
| if [ "$SEL_RUN" = "false" ]; then | |
| echo "HIL skipped by PR selection (no affected boards on this rig)" | |
| # a report saying so, or the combined PR comment drops the section (and leaves a | |
| # stale table from an earlier push) | |
| python3 test/hil/helper/hil_report.py no-selection test/hil/hfp.json \ | |
| '_Skipped by PR selection: no affected boards on this rig._' || | |
| { echo "::error::could not write the no-selection HIL report"; exit 1; } | |
| exit 0 | |
| fi | |
| # empty/absent on a non-PR event or a selector fallback -> full hfp matrix | |
| SEL_ARGS=$(cat hil_sel_args.txt 2>/dev/null || true) | |
| # one attempt per test, matching the other HIL legs | |
| python3 test/hil/hil_test.py --retry 1 $SEL_ARGS hfp.json | |
| - *hil_report_prepare | |
| - name: Upload HIL report | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: hil-report-hfp-iar | |
| path: *hil_report_files | |
| if-no-files-found: ignore | |
| overwrite: true |