This directory contains GitHub Actions workflows for automated testing.
Automated testing workflow for Python modules with Smart Version Detection that:
-
Intelligently detects versions to test using a three-tier approach:
- Primary Method: Extracts version numbers from changed files in
/bindirectory (e.g.,bin/python3.19.1/) - Fallback Method: Extracts version numbers from PR title if no
/binchanges detected - Final Fallback: Tests the latest 5 versions if no versions detected by either method
- Primary Method: Extracts version numbers from changed files in
-
Tests each Python version through multiple phases:
- Phase 1.1: Download and extract Python module
- Phase 1.2: Verify Python installation and executables
- Phase 2: Test basic functionality (version, pip, imports)
-
Reports results:
- Generates test summary with badges
- Comments on pull requests
- Uploads test artifacts
The workflow uses an intelligent three-tier detection system to identify which Python versions need testing:
When a PR is created from a pre-release branch (e.g., "November") to main:
- New versions are created and added to a pre-release (tagged with date, e.g., "2025.11.23")
- Version directories are created in
/bin(e.g.,bin/python3.19.1/,bin/python3.25.0/) - The releases.properties file is updated via the releases.properties workflow
- A PR is created from the release branch to main
- This workflow detects changed files in
/binand extracts version numbers from directory names - Tests are run against the version(s) found in releases.properties from that PR branch
Here's how the smart detection works in a typical release workflow:
-
Pre-release Creation: New Python versions (e.g., 3.19.1, 3.25.0) are added to a pre-release tagged with the date (e.g., "2025.11.23")
-
Directory Structure: Version directories are created in
/bin:bin/ ├── python3.19.1/ │ └── (version files) └── python3.25.0/ └── (version files) -
Properties Update: The
releases.propertiesfile is updated via the update-releases-properties workflow -
PR Creation: A PR is created from a release branch (e.g., "November") to main
-
Smart Detection: The workflow automatically:
- Scans changed files in the PR
- Detects
bin/python3.19.1/andbin/python3.25.0/ - Extracts versions:
3.19.1and3.25.0 - Verifies these versions exist in
releases.properties - Runs tests only for these 2 versions (not all versions)
-
Efficiency: Instead of testing 20+ versions, only the 2 new versions are tested, reducing CI time from 30+ minutes to ~10-20 minutes
The workflow scans for changes in the /bin directory and extracts version numbers from directory names:
bin/python3.19.1/some-file.txt → Detects version: 3.19.1
bin/python3.25.0/another.txt → Detects version: 3.25.0
Advantages:
- Most accurate - directly tied to actual version changes
- Reduces CI runtime by testing only relevant versions
- Automatically handles multiple versions in a single PR
If no /bin changes are detected, the workflow extracts version numbers from the PR title:
"Add Python 3.13.5 support" → Detects version: 3.13.5
"Update 3.12.9 and 3.13.3" → Detects versions: 3.12.9, 3.13.3
Use cases:
- Documentation updates mentioning specific versions
- Configuration changes for specific versions
- Manual testing requests
If no versions are detected by either method, the workflow tests the latest 5 versions from releases.properties:
Use cases:
- General infrastructure changes
- Workflow updates
- Changes that might affect all versions
Tests run automatically when:
- Push to main: Tests latest version only
- Pull Request with /bin changes: Tests versions detected from
/bin/pythonX.X.X/directory names (Primary Method) - Pull Request with version in title: Tests versions mentioned in PR title (Fallback Method)
- Pull Request with other changes: Tests latest 5 versions (Final Fallback)
- Manual workflow dispatch: Tests specified version
You can manually trigger tests:
- Go to the Actions tab
- Select "Python Module Tests"
- Click "Run workflow"
- Optionally specify a version to test (e.g.,
3.13.5)
If your PR doesn't include /bin directory changes, you can trigger tests by including version numbers in the PR title:
- ✅
Add Python 3.13.5 support - ✅
Update docs for 3.12.9 - ✅
Fix issue with Python 3.13.3 and 3.12.6.0 - ✅
Documentation update(will test latest 5 versions as final fallback)
The smart detection system significantly reduces CI runtime:
- Before: All versions tested on every PR (~30+ minutes)
- After: Only relevant versions tested (~5-10 minutes per version)
- Example: PR with 2 new versions = ~10-20 minutes instead of 30+ minutes
Phase 1.1 - Download and Extract
- Reads version from
releases.properties - Downloads the
.7zarchive - Extracts to test directory
- Verifies Python directory structure
Phase 1.2 - Verify Executables
- Checks for
python.exe - Checks for
pip.exe(in root or Scripts directory) - Validates executable paths
- Tests
python --version - Tests
pip --version(viapython -m pip) - Tests Python import system
- Validates all critical components work
Test results are uploaded as artifacts:
test-results-python-{version}: Individual version test results
Artifacts are retained for 30 days.
For pull requests, the workflow posts a comment with:
- Overall test status
- Version-specific badges (PASS/FAIL)
- Detailed results for failed tests
- Links to artifacts
Each version gets a badge:
# Version = Download URL
3.13.5 = https://github.com/Bearsampp/module-python/releases/download/2025.8.21/bearsampp-python-3.13.5-2025.8.21.7z
3.12.9 = https://github.com/Bearsampp/module-python/releases/download/2025.4.19/bearsampp-python-3.12.9-2025.4.19.7zThe .7z archive must contain:
bearsampp-python-X.X.X-YYYY.MM.DD.7z
└── python-X.X.X/
├── python.exe # Required
├── python3.dll # Required
├── python3XX.dll # Required
├── Scripts/
│ └── pip.exe # Optional but recommended
└── Lib/ # Required
Problem: Tests skipped on PR
Solutions:
- Add version number to PR title
- Modify
releases.properties - Manually trigger workflow
Problem: Download fails with 404
Solutions:
- Verify URL in
releases.propertiesis correct - Check that release exists on GitHub
- Ensure URL is publicly accessible
Problem: Archive extraction fails
Solutions:
- Verify
.7zarchive is valid - Check archive structure matches expected format
- Ensure archive is not corrupted
Problem: python.exe not found after extraction
Solutions:
- Verify archive contains
python-X.X.X/directory - Check that
python.exeis in the root of that directory - Ensure extraction completed successfully
The workflow requires these permissions:
contents: read- Read repository contentspull-requests: write- Comment on PRsissues: write- Update issue comments
- Test locally first: Verify changes work before pushing
- Use descriptive PR titles: Include version numbers when relevant
- Check workflow logs: Review detailed logs for failures
- Update documentation: Keep docs in sync with code changes
- Monitor artifacts: Download and review test results
For issues with the CI/CD workflow:
- Check workflow logs in the Actions tab
- Review this README for troubleshooting tips
- Open an issue with workflow run details
- Include error messages and relevant logs
