retrace-github-actions

Retrace GitHub Actions Integration

This repository demonstrates how Retrace can be integrated into a GitHub Actions CI workflow to automatically classify test failures.

πŸ‘‰ Main Retrace project: https://github.com/thuluxx/retrace

πŸš€ What This Demo Shows

When a test fails in GitHub Actions, the workflow sends the failure information to Retrace.

Retrace analyzes the failure and returns:

The result is then posted directly to the GitHub Pull Request.

πŸ”„ Workflow

Pull Request
     ↓
GitHub Actions starts
     ↓
Install dependencies
     ↓
Run tests
     ↓
Test fails
     ↓
Send failure output to Retrace
     ↓
Retrace analyzes failure
     ↓
Classification + confidence
     ↓
Post result as PR comment

βš™οΈ Workflow File

The GitHub Actions workflow is located at:

.github/workflows/retrace-classify.yml

The workflow performs the following steps:

  1. Checkout repository
  2. Set up Node.js
  3. Install dependencies
  4. Run tests
  5. Classify failure with Retrace
  6. Post classification as a PR comment
  7. Fail the job if the tests failed

πŸ§ͺ Example Failure

This repository contains a deterministic failing test used to demonstrate Retrace.

Example:

Expected: 1260
Received: 1400

The test failure is sent to Retrace for classification.

Retrace returns:

Retrace classification: likely real regression
Confidence: 95%

with an explanation similar to:

The test deterministically expects a total of 1260
but receives 1400, indicating a change in application
logic rather than timing or external factors.

πŸ’¬ Pull Request Result

After the workflow runs, Retrace posts the classification directly to the Pull Request.

Example:

Retrace classification: likely real regression (95% confidence)

The test deterministically expects a total of 1260
but receives 1400, indicating a change in application
logic rather than timing or external factors.

This means developers can see the classification without leaving the PR.

πŸ”§ Configuration

The workflow uses the Retrace API through the configured API URL:

RETRACE_API_URL

GitHub Actions secrets/environment variables can be used for any required credentials.

πŸ“ Repository Structure

.
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── retrace-classify.yml
β”œβ”€β”€ tests/
β”œβ”€β”€ package.json
└── README.md

πŸ› οΈ Built With

🎯 Purpose

This repository is primarily a demo/integration repository for Retrace.

The main project contains the Retrace application itself:

πŸ‘‰ https://github.com/thuluxx/retrace

This repository shows how that system can be connected to a real GitHub Actions workflow.

Main Retrace Repository

πŸ‘‰ https://github.com/thuluxx/retrace

GitHub Actions Integration

πŸ‘‰ https://github.com/thuluxx/retrace-test

πŸ—ΊοΈ Future Improvements

Possible future improvements to the integration include: