From 43f537fae4d69d3b9468be461df4d0051521364b Mon Sep 17 00:00:00 2001 From: chruffins <23645059+chruffins@users.noreply.github.com> Date: Fri, 2 Oct 2026 14:49:13 +0000 Subject: [PATCH 1/3] Report fork test results on pull request commits --- .github/workflows/test-command.yml | 3 +- .github/workflows/test.yml | 46 +++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 43a5ae956..cd7ba8e34 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -132,7 +132,8 @@ jobs: --repo "$REPO" \ --ref main \ --field pr_head_repo="$HEAD_REPO" \ - --field pr_head_sha="$HEAD_SHA" + --field pr_head_sha="$HEAD_SHA" \ + --field pr_number="$PR_NUMBER" - name: Report dispatch if: steps.command.outputs.run == 'true' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ccb6f999..5746c695e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,10 @@ on: description: "Exact PR commit to test" required: false type: string + pr_number: + description: "Pull request number for reporting the test result" + required: false + type: string # Every branch push triggers a full run and superseded runs used to keep # running, holding self-hosted slots that every repo on the shared pool @@ -343,6 +347,46 @@ jobs: sudo rm -f /run/hypeman/uffd/ci-${{ github.run_id }}-${{ github.run_attempt }}-*.env rm -f "${{ runner.temp }}/hypeman-uffd-pager-${{ github.run_id }}-${{ github.run_attempt }}" + report-pr-test: + if: ${{ always() && github.event_name == 'workflow_dispatch' && inputs.pr_number != '' }} + needs: test + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + statuses: write + steps: + - name: Publish test result to the pull request commit + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + PR_NUMBER: ${{ inputs.pr_number }} + EXPECTED_REPO: ${{ inputs.pr_head_repo }} + EXPECTED_SHA: ${{ inputs.pr_head_sha }} + TEST_RESULT: ${{ needs.test.result }} + run: | + set -euo pipefail + [[ "$PR_NUMBER" =~ ^[0-9]+$ ]] + [[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]] + pr="$(gh api "repos/$REPO/pulls/$PR_NUMBER" --jq '[.state, .base.ref, .head.repo.full_name, .head.sha] | @tsv')" + read -r state base_ref head_repo head_sha <<< "$pr" + if [[ "$state" != open || "$base_ref" != main || "$head_repo" != "$EXPECTED_REPO" || "$head_sha" != "$EXPECTED_SHA" ]]; then + echo "::notice::Skipping test status because pull request $PR_NUMBER no longer points to the tested commit" + exit 0 + fi + + status=failure + description="test run failed" + if [[ "$TEST_RESULT" == success ]]; then + status=success + description="test run passed" + fi + gh api --method POST "repos/$REPO/statuses/$EXPECTED_SHA" \ + --field state="$status" \ + --field context=test \ + --field description="$description" \ + --field target_url="$GITHUB_SERVER_URL/$REPO/actions/runs/$GITHUB_RUN_ID" + test-darwin: runs-on: [self-hosted, macos, arm64] concurrency: @@ -512,7 +556,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: | curl -fsSL --retry 5 --retry-all-errors \ - "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/scripts/e2e-install-test.sh" \ + "https://raw.githubusercontent.com/${{ env.TEST_SOURCE_REPO }}/${{ env.TEST_SOURCE_REF }}/scripts/e2e-install-test.sh" \ -o "$RUNNER_TEMP/e2e-install-test.sh" HYPEMAN_E2E_REPO_DIR="$PWD" BINARY_DIR="$PWD/bin" \ bash "$RUNNER_TEMP/e2e-install-test.sh" From cf38bc47b494c363ce3faadb968bf75df95a5cf4 Mon Sep 17 00:00:00 2001 From: chruffins <23645059+chruffins@users.noreply.github.com> Date: Fri, 2 Oct 2026 15:01:17 +0000 Subject: [PATCH 2/3] Use checked out install test script --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5746c695e..538a3249d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -555,9 +555,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - curl -fsSL --retry 5 --retry-all-errors \ - "https://raw.githubusercontent.com/${{ env.TEST_SOURCE_REPO }}/${{ env.TEST_SOURCE_REF }}/scripts/e2e-install-test.sh" \ - -o "$RUNNER_TEMP/e2e-install-test.sh" + cp scripts/e2e-install-test.sh "$RUNNER_TEMP/e2e-install-test.sh" HYPEMAN_E2E_REPO_DIR="$PWD" BINARY_DIR="$PWD/bin" \ bash "$RUNNER_TEMP/e2e-install-test.sh" - name: Run E2E CLI-only install test From c76085a6ebc3a55523734357efaef1f1f2c20f99 Mon Sep 17 00:00:00 2001 From: chruffins <23645059+chruffins@users.noreply.github.com> Date: Fri, 2 Oct 2026 15:09:18 +0000 Subject: [PATCH 3/3] Keep test harness pinned to workflow revision --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 538a3249d..24e199706 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -555,7 +555,10 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - cp scripts/e2e-install-test.sh "$RUNNER_TEMP/e2e-install-test.sh" + # Keep the harness pinned to this workflow revision; it runs on a self-hosted runner. + curl -fsSL --retry 5 --retry-all-errors \ + "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/scripts/e2e-install-test.sh" \ + -o "$RUNNER_TEMP/e2e-install-test.sh" HYPEMAN_E2E_REPO_DIR="$PWD" BINARY_DIR="$PWD/bin" \ bash "$RUNNER_TEMP/e2e-install-test.sh" - name: Run E2E CLI-only install test