From dd1adf15af970095b85c26c67a17457ed6473050 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 23 Aug 2026 20:15:33 +0000 Subject: [PATCH] Reusable smoke workflow: let a caller choose the runner The reusable workflow hardcoded 'python .github/scripts/run_smoke.py', so the only way to run a different workspace script under the same ceremony was to copy the ceremony -- chain checkout at the matching branch, python setup, install epilogue, cache dirs, profile validation -- into a second workflow. run_smoke.py's own docstring records what that costs: the last duplicated copy of the env resolver drifted until the PR gate could not read the release profile. Three optional inputs, all defaulting to today's behaviour exactly: - runner: workspace-relative script to execute, default .github/scripts/run_smoke.py; - runner-args: extra arguments, word-split; - script-timeout: exported as BUILD_SCRIPT_TIMEOUT only when non-empty, so the default path still leaves it unset and the runner's own default and any profile override apply unchanged. All three reach the run step through env rather than being interpolated into the script body, since a caller supplies them from workflow_dispatch. Prompted by autolens_workspace_test#271, which needs to run a re-timing harness over the SLOW/NEEDS_FIX JAX entries N times under the real caps. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_015qk7hoavMnFyPtW4toYn8K --- .github/workflows/smoke-tests.yml | 42 ++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index ad0acc41..2946b6a9 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -14,7 +14,16 @@ name: Smoke Tests (reusable) # .github/scripts/run_smoke.py, Slack on failure); everything that differs # per workspace stays IN the workspace: the install epilogue # (.github/scripts/smoke_install.sh, receiving PYTHON_VERSION — extras, -# pins, version conditionals) and the smoke runner itself. The dependency +# pins, version conditionals) and the smoke runner itself. +# +# `runner` lets a caller point that same ceremony at a DIFFERENT workspace +# script — a re-timing harness, a one-off diagnostic sweep — instead of +# copying the chain-checkout/install steps into a second workflow. The copy is +# the thing to avoid: run_smoke.py's own docstring records what happened the +# last time this ceremony was duplicated, when a local copy of the env resolver +# silently drifted and left the PR gate unable to read the release profile. +# Callers reach it with their own workflow_dispatch and pass `runner:` through; +# the default keeps every existing caller byte-identical. The dependency # chain is an input and checkouts use the calling owner, so forks of the # organism reuse this workflow without modification. # @@ -37,6 +46,21 @@ on: required: false type: string default: "C03S98FEDK2" + runner: + description: "Workspace-relative runner script to execute (default: the smoke runner)" + required: false + type: string + default: ".github/scripts/run_smoke.py" + runner-args: + description: "Extra arguments appended to the runner invocation (word-split)" + required: false + type: string + default: "" + script-timeout: + description: "Per-script wall-clock cap in seconds (BUILD_SCRIPT_TIMEOUT). Empty leaves it unset, so the runner's own default and any profile override apply unchanged." + required: false + type: string + default: "" jobs: # Docs-only gate: skip the matrix when the diff touches nothing but prose. @@ -155,15 +179,27 @@ jobs: echo "No config/build/profile_smoke.yaml — profile validation skipped." fi - - name: Run smoke tests + - name: Run the workspace runner (the smoke runner by default) env: JAX_ENABLE_X64: "True" NUMBA_CACHE_DIR: /tmp/numba_cache MPLCONFIGDIR: /tmp/matplotlib PYTHONPATH: ${{ github.workspace }}/PyAutoHands/autohands + # Via env, never interpolated into the script body: these inputs reach + # here from a caller's workflow_dispatch, and `${{ }}` inside `run:` + # would splice their text straight into the shell. + RUNNER: ${{ inputs.runner }} + RUNNER_ARGS: ${{ inputs.runner-args }} + SCRIPT_TIMEOUT: ${{ inputs.script-timeout }} run: | cd workspace - python .github/scripts/run_smoke.py + # Exported only when the caller asked for a cap. Setting it + # unconditionally would hand run_smoke.py an empty string to int(), + # and would also state a process-wide cap where today there is none. + if [ -n "$SCRIPT_TIMEOUT" ]; then + export BUILD_SCRIPT_TIMEOUT="$SCRIPT_TIMEOUT" + fi + python "$RUNNER" $RUNNER_ARGS - name: Slack notify on failure if: ${{ failure() }}