Add test.yml workflow for automatic PR test validation#402
Add test.yml workflow for automatic PR test validation#402
Conversation
|
Merging to
|
Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
|
👋 Development Partner is reviewing this PR. Will provide feedback shortly. |
There was a problem hiding this comment.
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.ymlworkflow 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 |
There was a problem hiding this comment.
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
| run: uv run pytest tests/ -v --tb=short | |
| run: uv run pytest tests/ -n auto -v --tb=short |
| pull_request: | ||
| branches: [main, develop] | ||
| push: | ||
| branches: [main, develop] |
There was a problem hiding this comment.
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.
| branches: [main, develop] | |
| branches: [main, develop] | |
| workflow_dispatch: |
| - 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 | ||
|
|
There was a problem hiding this comment.
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.
| - 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' |
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): Runsuv run pytest tests/ -v --tb=shortonpull_requestandpushtomain/developactions/setup-python@v5(matchesrequires-python = ">=3.13")astral-sh/setup-uv@v4+uv sync --all-extrasto pick up dev deps from[project.optional-dependencies]permissions: contents: read— explicit least-privilege constraint onGITHUB_TOKENOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.