You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: Optimize CI by conditionally running schema generation tests (#1147)
## Summary
Optimize CI performance by only running schema generation tests when
relevant files change.
## Problem
- Schema generation test takes **3+ minutes** (35% of test suite time)
- Most PRs don't modify schemas or schema generation code
- Running this test for every PR wastes CI resources
## Solution
Implemented conditional test execution using GitHub Actions path
filtering:
- Schema generation test only runs when schema-related files change
- Always runs on main branch to ensure consistency
- Test runs on only one Python version (output is the same for all)
## Changes
This PR contains **ONLY** the workflow file changes:
1. Added `dorny/paths-filter` to detect changed files
2. Excluded schema generation test from regular test runs
3. Created separate job for schema generation that runs conditionally
4. Reduced timeout from 15 to 10 minutes for regular tests
## Files that trigger schema generation test
- `src/allotropy/allotrope/schemas/**` - Schema files
- `src/allotropy/allotrope/schema_parser/**` - Schema generation code
- `src/allotropy/allotrope/models/**` - Generated models
- `tests/allotrope/schema_parser/generate_schemas_test.py` - The test
itself
- `pyproject.toml` - Dependencies
## Expected Impact
- **Most PRs**: Save ~3 minutes per Python version (9+ minutes total)
- **Schema-related PRs**: No change (test still runs)
- **Overall CI**: ~50% faster for typical PRs
## Testing
This PR itself demonstrates the optimization:
- Schema generation test should NOT run (only workflow file changed)
- All other tests should run normally
- CI should complete in ~7 minutes instead of ~10 minutes
## Related PRs
- #1144: Test file size optimizations (separate, independent changes)
## Notes
- If schema generation test becomes a required status check, we may need
to adjust the approach
- Consider documenting this behavior in contributing guidelines
Co-Authored-By: Claude Opus 4.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.1 <noreply@anthropic.com>
), f"Expected no models files to have changed by generate-schemas script, found changes in: {models_changed}.\nPlease run 'hatch run scripts:generate-schemas' and validate the changes."
), f"Expected no models files to have changed by generate-schemas script, found changes in: {models_changed}.\nPlease run 'hatch run scripts:generate-schemas' and validate the changes."
0 commit comments