test-prof / test-prof-aiptimize-action

GitHub action to refactor Rails tests with TestProf and AI
MIT License
11 stars 1 forks source link
github-action peformance rails testing

TestProf AI GitHub Action

This GitHub Action allows you to optimize Rails tests via TestProf and Claude AI.

The action performs the given test file profiling and refactors it to speed up the execution (using let_it_be and before_all helpers from TestProf). It opens a PR and shares the refactoring progress as it executes.

Requirements

Inputs

Example

We suggest to use GitHub Issues to initiate refactoring tasks. Here is an example workflow:

name: TestProf AI

on:
  issues:
    types: [labeled]

jobs:
  optimize:
    # IMPORTANT: Only run this workflow for explicitly labeled issues
    if: github.event.label.name == 'test-prof'
    runs-on: ubuntu-latest

    env:
      RAILS_ENV: test
      # ... here goes your environment setup

    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: Prepare app
        run: |
          bundle exec rails db:test:prepare

      - name: Run TestProf AI
        uses: test-prof/test-prof-aiptimize-action@main
        with:
          api-key: ${{ secrets.CLAUDE_API_KEY }}
          issue-number:  ${{ github.event.issue.number }}

Here is also an example issue template.