feat(ci): enable unit tests for release automation scripts - #110
feat(ci): enable unit tests for release automation scripts#110amd-chiranjeevi wants to merge 6 commits into
Conversation
|
One point from my end would be to run these unit tests when specific release automation scripts get updated as tests are related to that only. |
| jobs: | ||
| unit_tests: | ||
| name: Release Unit Tests | ||
| runs-on: ubuntu-24.04 |
There was a problem hiding this comment.
- Runs on
ubuntu-24.04(matches all other rockrel workflows; no Windows needed since these
are pure Python automation scripts)
Run on Windows too. Several of us, myself included, develop exclusively on Windows and scripts need to work there.
There was a problem hiding this comment.
Done, added a matrix with [ubuntu-24.04, windows-2022], fail-fast: false.
There was a problem hiding this comment.
nit: could use requirements-test.txt instead of requirements.txt.
| - name: Test scripts | ||
| working-directory: scripts | ||
| run: | | ||
| python -m pytest -vv --durations=20 \ | ||
| --cov --cov-report=term-missing --cov-report=html |
There was a problem hiding this comment.
Can we just run pytest from the repository root for now? That should cover future subdirectories too. If we add subdirectories that can't pass pytest collection we can exclude them or reorganize then.
Motivation
Rockrel has two Python scripts (
create_release_branch.py,rock_tagging.py) with corresponding test files (scripts/tests/test_create_release_branch.py,scripts/tests/test_rock_tagging.py) that were never wired into CI. Any regression in the branching or tagging automation could go undetected until it fails in a real release run.This PR adds a GitHub Actions workflow that runs those tests automatically on every push to main, every PR, and on demand.
closes #103
Changes
.github/workflows/unit_tests.yml — new workflow that:
- Triggers on push to
main/release/therock-*and all pull requests (no path filters,so it can be used as a required check)
- Runs on a matrix of
ubuntu-24.04andwindows-2022(withshell: bashdefault)- Sets up Python 3.12, installs deps, runs
pytestwith verbose output, duration reporting,and coverage
- Uploads a per-OS HTML coverage report as an artifact
- Has a
unit_tests_summaryjob that fails the workflow if any matrix leg didn't succeedrequirements-test.txt — new file pinning:
- pytest==9.0.3 (same version as TheRock; this version has subtests built-in)
- pytest-cov==6.0.0 (same version as TheRock)
Test Result
unit tests working - https://github.com/ROCm/rockrel/actions/runs/33774002311/job/100711034535?pr=110
Submission Checklist