Skip to content

Add test.yml workflow for automatic PR test validation#402

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/create-test-workflow-for-pr-validation
Closed

Add test.yml workflow for automatic PR test validation#402
Copilot wants to merge 2 commits intomainfrom
copilot/create-test-workflow-for-pr-validation

Conversation

Copy link

Copilot AI commented Feb 20, 2026

PRs had no automatic test validation — 26+ test files existed but were only invoked via a custom action, with no status check visible in the GitHub UI.

Changes

  • .github/workflows/test.yml (new): Runs uv run pytest tests/ -v --tb=short on pull_request and push to main/develop
    • Python 3.13 via actions/setup-python@v5 (matches requires-python = ">=3.13")
    • astral-sh/setup-uv@v4 + uv sync --all-extras to pick up dev deps from [project.optional-dependencies]
    • permissions: contents: read — explicit least-privilege constraint on GITHUB_TOKEN
jobs:
  test:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.13'
      - uses: astral-sh/setup-uv@v4
      - run: uv sync --all-extras
      - run: uv run pytest tests/ -v --tb=short
Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Create dedicated test.yml workflow for PR validation</issue_title>
<issue_description>### Description

The repository lacks a dedicated test workflow for PR validation. Tests are run via custom action (.github/actions/daily-perf-improver/build-steps/action.yml) but PRs don't get automatic test validation.

Problem

From the Daily QA Report discussion (#337):

  • Test execution happens in custom action, not standard workflow
  • PRs don't show test results in GitHub UI
  • No clear test validation before merge
  • Contributors can't see if their changes break tests

Current test infrastructure:

  • 18+ test files in tests/ directory
  • Tests invoked via uv run pytest tests/
  • No PR status check for test results

Suggested Changes

Create .github/workflows/test.yml:

name: Tests

on:
  pull_request:
    branches: [main, develop]
  push:
    branches: [main, develop]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Set up Python 3.13
        uses: actions/setup-python@v5
        with:
          python-version: '3.13'
      
      - name: Set up uv
        uses: astral-sh/setup-uv@v4
      
      - name: Install dependencies
        run: uv sync --all-extras
      
      - name: Run tests
        run: uv run pytest tests/ -v --tb=short

Files Affected

  • .github/workflows/test.yml (new file)
  • Optionally: Update README.md to mention test workflow

Success Criteria

  • New test.yml workflow created
  • Workflow runs on pull requests
  • Workflow runs on pushes to main/develop
  • Test results visible in PR status checks
  • Uses Python 3.13 (matches pyproject.toml requirement)
  • Uses uv for dependency management (matches dev workflow)
  • All tests pass in new workflow

Priority

Medium - Improves PR review process and prevents broken code merges

Effort Estimate

1 day (creation, testing, validation)

Benefits

  • Automatic test validation for PRs
  • Clear pass/fail status in GitHub UI
  • Prevents merging broken code
  • Improves contributor experience
  • Aligns with standard GitHub workflow patterns

Source

Extracted from Daily QA Report discussion abhimehro/ctrld-sync#337

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent

To install this workflow, run gh aw add github/gh-aw/.github/workflows/discussion-task-miner.md@94662b1dee8ce96c876ba9f33b3ab8be32de82a4. View source at https://github.com/github/gh-aw/tree/94662b1dee8ce96c876ba9f33b3ab8be32de82a4/.github/workflows/discussion-task-miner.md.

  • expires on Feb 20, 2026, 9:12 AM UTC

Comments on the Issue (you are @copilot in this section)

Custom agent used: Development Partner
The Development Partner Protocol


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@trunk-io
Copy link

trunk-io bot commented Feb 20, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dedicated test workflow for PR validation Add test.yml workflow for automatic PR test validation Feb 20, 2026
Copilot AI requested a review from abhimehro February 20, 2026 03:51
@abhimehro abhimehro marked this pull request as ready for review February 22, 2026 10:11
Copilot AI review requested due to automatic review settings February 22, 2026 10:11
@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic test validation for pull requests by creating a new dedicated test workflow. The repository contains 26+ test files that were previously only executed via a custom action without visible PR status checks.

Changes:

  • New .github/workflows/test.yml workflow that runs pytest on PRs and pushes to main/develop branches
  • Uses uv for dependency management and Python 3.13, matching project requirements
  • Provides visible test status checks in GitHub UI to prevent merging broken code

run: uv sync --all-extras

- name: Run tests
run: uv run pytest tests/ -v --tb=short
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test command is missing the -n auto flag for parallel test execution. The existing test infrastructure in .github/actions/daily-perf-improver/build-steps/action.yml (line 45) uses pytest tests/ -n auto -v, and the project includes pytest-xdist>=3.0.0 as a dev dependency specifically for parallel testing. Running 26+ test files sequentially will significantly slow down CI feedback. Consider adding -n auto to enable parallel execution: uv run pytest tests/ -n auto -v --tb=short

Suggested change
run: uv run pytest tests/ -v --tb=short
run: uv run pytest tests/ -n auto -v --tb=short

Copilot uses AI. Check for mistakes.
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding workflow_dispatch: trigger to allow manual test runs. This is a common pattern throughout the repository (used in sync.yml, performance.yml, and all agentic workflows) and would allow developers to manually trigger test runs without creating a commit. This is particularly useful when testing CI configuration changes or investigating test failures.

Suggested change
branches: [main, develop]
branches: [main, develop]
workflow_dispatch:

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +24
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Set up uv
uses: astral-sh/setup-uv@v4

Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup order differs from the existing performance.yml workflow pattern. In performance.yml (lines 19-27), uv is set up first with caching enabled, then Python is configured. Consider reordering to match this pattern and adding enable-cache: true to the uv setup for faster dependency installation. This would align with the repository's established CI patterns and improve workflow performance.

Suggested change
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Set up uv
uses: astral-sh/setup-uv@v4
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'

Copilot uses AI. Check for mistakes.
@abhimehro
Copy link
Owner

Closing: duplicate of test workflow (#395 is superset). Use #395 instead.

@abhimehro abhimehro closed this Feb 28, 2026
@abhimehro abhimehro deleted the copilot/create-test-workflow-for-pr-validation branch March 2, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Create dedicated test.yml workflow for PR validation

3 participants