diff options
| author | hathach <[email protected]> | 2026-07-17 15:39:10 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2026-07-17 15:39:10 +0700 |
| commit | 8a42508300e03e3ed3bf7dc3e31821adf079189e (patch) | |
| tree | 613a6d86ae8afbec9d97f8ca3feac50c596b7782 /.github/workflows | |
| parent | 9a32c0a5073aff649b1b3e7fa07a89e495b3b40a (diff) | |
Key HIL report dir by run id so re-runs and other PRs cannot clobber it
A re-run attempt merged into an empty base: another PR's HIL job ran
between attempt 1 and the retry and rewrote the shared hil_report.json,
so the run-stamp guard (correctly) refused the foreign base but the
full-fleet results were lost - the retry report contained only the
re-run cells.
Give each (run id, job) its own report dir instead:
- attempts of the same run share a dir, so the retry always finds its
own sidecar and .failed spec intact
- interleaved runs of other PRs/jobs write elsewhere and cannot clobber
- the run-stamp mechanism (.failed.run file) becomes redundant and is
removed
- stale per-run dirs are pruned after 2 weeks
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/build.yml | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 818e7ba81..76e19ee02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -318,20 +318,23 @@ jobs: env: HIL_JSON: ${{ matrix.hil_json }} steps: - - name: Set HIL report dir (sibling of workspace; persists across run attempts) - run: echo "HIL_REPORT_DIR=$(dirname "$GITHUB_WORKSPACE")/hil-report" >> "$GITHUB_ENV" + - 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: | - # only honor a spec stamped by THIS run: a spec left by another run (attempt 1 - # died or was skipped before hil_test.py could clear it) must not be consumed + # 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" - if [ -f "$SPEC" ] && [ "$(cat "$SPEC.run" 2>/dev/null)" = "$GITHUB_RUN_ID" ]; then - RERUN_ARGS=$(cat "$SPEC") - else - RERUN_ARGS="" - fi + RERUN_ARGS="" + [ -f "$SPEC" ] && RERUN_ARGS=$(cat "$SPEC") echo "RERUN_ARGS=$RERUN_ARGS" echo "RERUN_ARGS=$RERUN_ARGS" >> $GITHUB_ENV @@ -380,20 +383,23 @@ jobs: HIL_JSON: test/hil/tinyusb.json TEST_ARGS: '--flasher esptool' steps: - - name: Set HIL report dir (sibling of workspace; persists across run attempts) - run: echo "HIL_REPORT_DIR=$(dirname "$GITHUB_WORKSPACE")/hil-report-esp" >> "$GITHUB_ENV" + - 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: | - # only honor a spec stamped by THIS run: a spec left by another run (attempt 1 - # died or was skipped before hil_test.py could clear it) must not be consumed + # 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" - if [ -f "$SPEC" ] && [ "$(cat "$SPEC.run" 2>/dev/null)" = "$GITHUB_RUN_ID" ]; then - RERUN_ARGS=$(cat "$SPEC") - else - RERUN_ARGS="" - fi + RERUN_ARGS="" + [ -f "$SPEC" ] && RERUN_ARGS=$(cat "$SPEC") echo "RERUN_ARGS=$RERUN_ARGS" echo "RERUN_ARGS=$RERUN_ARGS" >> $GITHUB_ENV |
