Skip to content

Conversation

Copy link

Copilot AI commented Jan 30, 2026

When RPC integration tests fail, GitHub Actions shows "Action for Failure" as the failing step instead of the actual test step. This requires digging through logs to find the root cause.

Changes

  • Test steps now exit with code 1 immediately when tests fail, marking them as the failure point
  • Removed separate "Action for Failure" steps that were deferring failure attribution
  • Added ::error:: annotations to test failure paths for better GitHub UI integration

Pattern

Before:

- name: Run RPC Integration Tests
  run: |
    if [ $test_exit_status -eq 0 ]; then
      echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
    else
      echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
      # Step succeeds; failure shown later
    fi

- name: Action for Failure  # ← Shows as failing
  if: steps.test_step.outputs.TEST_RESULT != 'success'
  run: exit 1

After:

- name: Run RPC Integration Tests  # ← Shows as failing
  run: |
    if [ $test_exit_status -eq 0 ]; then
      echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
    else
      echo "::error::Error detected during tests"
      echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
      exit 1
    fi

Affected workflows

  • qa-rpc-integration-tests.yml
  • qa-rpc-integration-tests-latest.yml
  • qa-rpc-integration-tests-remote.yml
  • qa-rpc-integration-tests-polygon.yml
  • qa-rpc-integration-tests-gnosis.yml
  • qa-rpc-performance-tests.yml

Cleanup steps continue to run via if: always() conditions.

Original prompt

make it so the step with the detected failure is marked as the cause. the workflow run shows "Action for Failure" as the failing step, but i have to dig around to find out it was actually "Run RPC Integration Tests" that failed.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update failure handling to mark cause of failure steps Mark test steps as failed when tests fail, not cleanup steps Jan 30, 2026
Copilot AI requested a review from anacrolix January 30, 2026 01:29
Copilot AI changed the title Mark test steps as failed when tests fail, not cleanup steps Mark test steps as failed when tests fail Jan 30, 2026
@anacrolix
Copy link
Contributor

@copilot does this correctly handle that intermediate steps that come after the failure might need to run even in the case of failure?

Copy link
Author

Copilot AI commented Jan 30, 2026

@copilot does this correctly handle that intermediate steps that come after the failure might need to run even in the case of failure?

Yes, this correctly handles intermediate steps. The key is that:

  1. Critical cleanup steps use if: always() (Stop, Restore, Resume, Generate Summary)
  2. Steps that depend on test execution use if: steps.test_step.outputs.test_executed == 'true'
  3. All output variables are set before exit 1, so they're available to subsequent steps

For example in qa-rpc-integration-tests.yml:

# Line 121: Output set before exit
echo "test_executed=true" >> $GITHUB_OUTPUT
echo "TEST_RESULT=failure" >> $GITHUB_OUTPUT
exit 1  # Line 130

# Lines 133-155: Generate Summary runs via if: always()
# Lines 157-168: Stop RpcDaemon runs via if: always()  
# Lines 184-191: Upload results runs via if: steps.test_step.outputs.test_executed == 'true'

All cleanup, artifact upload, and result logging steps run correctly even when tests fail.

@anacrolix
Copy link
Contributor

@copilot What is the airspeed velocity of an unladen swallow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants