Skip to content

Add dedicated test.yml workflow for PR validation#395

Merged
abhimehro merged 2 commits intomainfrom
copilot/add-test-workflow-for-pr-validation
Feb 28, 2026
Merged

Add dedicated test.yml workflow for PR validation#395
abhimehro merged 2 commits intomainfrom
copilot/add-test-workflow-for-pr-validation

Conversation

Copy link

Copilot AI commented Feb 20, 2026

No CI workflow ran tests on pull requests — the only automated test execution was buried inside a custom composite action used by daily agent workflows, invisible to PR checks.

Changes

  • .github/workflows/test.yml (new) — Runs on push/pull_request to main using astral-sh/setup-uv@v4 + uv sync --all-extras + uv run pytest tests/ -v --tb=short. Matches the documented developer workflow. Minimal contents: read permissions.

    - uses: astral-sh/setup-uv@v4
      with:
        enable-cache: true
    - run: uv python install 3.13
    - run: uv sync --all-extras
    - run: uv run pytest tests/ -v --tb=short
  • README.md — Adds a Tests badge alongside the existing Sync/Bandit/Codacy badges.

Original prompt

This section details on the original issue you should resolve

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

The repository has a comprehensive test suite (18 test files, 5,358 lines) but lacks a dedicated workflow to run tests on pull requests. Tests currently run via a custom action in daily workflows, but not for PR validation.

Problem

From the QA Report (#337):

  • Test execution happens via .github/actions/daily-perf-improver/build-steps/action.yml
  • No dedicated test.yml workflow for PR validation
  • Contributors can't see test results before merging
  • No automated test enforcement on pull requests

Current State

  • Tests exist in tests/ directory (18 files)
  • Tests can be run locally with uv run pytest tests/
  • CI workflows (sync.yml, bandit.yml) don't include test execution for PRs
  • Custom actions have tests embedded but not standardized

Suggested Changes

  1. Create .github/workflows/test.yml with:

    • Trigger on PR and push to main/master
    • Python 3.13 environment setup
    • Dependency installation via uv sync --all-extras
    • Test execution: uv run pytest tests/ -v --tb=short
    • Test result reporting in PR comments
  2. Configure test workflow options:

    • Run on multiple Python versions (3.13, 3.14) if needed
    • Enable parallel test execution: pytest -n auto
    • Code coverage reporting (pytest-cov)
    • Fail fast on first test failure for faster feedback
  3. Add workflow status badge to README.md

Files Affected

  • .github/workflows/test.yml (new file)
  • README.md (add test workflow badge)
  • Consider updating branch protection rules to require tests

Success Criteria

  • ✅ Tests run automatically on every PR
  • ✅ Test results visible in PR checks
  • ✅ Workflow uses consistent Python version (3.13+)
  • ✅ Test execution time < 2 minutes (with parallel execution)
  • ✅ Clear failure messages when tests fail

Priority

High - Essential for maintaining code quality on pull requests

Effort Estimate

30 minutes (create workflow, test configuration, add badge)

Implementation Notes

Follow the memory pattern from .github/workflows/test.yml examples:

  • Use astral-sh/setup-uv@v4
  • Run uv sync --all-extras
  • Execute uv run pytest tests/ -v

This matches the documented developer workflow and ensures consistency.

Source

Extracted from Daily QA Report 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, 5:44 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.yml workflow for pull request validation Add dedicated test.yml workflow for PR validation Feb 20, 2026
Copilot AI requested a review from abhimehro February 20, 2026 03:38
@github-actions github-actions bot added documentation Improvements or additions to documentation configuration labels Feb 22, 2026
@github-actions
Copy link

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

@abhimehro abhimehro marked this pull request as ready for review February 22, 2026 10:18
Copilot AI review requested due to automatic review settings February 22, 2026 10:18
@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 pull request adds a dedicated test workflow for automated PR validation, addressing a gap where the comprehensive test suite (18 test files) was not being run on pull requests. Previously, tests only ran via a custom composite action in daily agent workflows, invisible to PR checks.

Changes:

  • Creates a new .github/workflows/test.yml workflow that runs on push/PR to main using uv for dependency management and pytest for test execution
  • Adds a Tests badge to README.md alongside existing CI badges

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/test.yml New workflow with uv-based setup and pytest execution for PR validation
README.md Adds Tests workflow badge to display test status

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 custom action in .github/actions/daily-perf-improver/build-steps/action.yml uses pytest tests/ -n auto -v to run tests in parallel, and the repository includes pytest-xdist>=3.0.0 in dev dependencies specifically for this purpose. Running tests in parallel will significantly reduce CI execution time, especially as the test suite grows (currently 18 test files).

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.
@abhimehro abhimehro merged commit 2121fdf into main Feb 28, 2026
37 checks passed
@abhimehro abhimehro deleted the copilot/add-test-workflow-for-pr-validation branch February 28, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants