Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork770
Refactor Tests#7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| name:Python-mode Tests | |
| on: | |
| push: | |
| branches:[ main, develop ] | |
| pull_request: | |
| branches:[ main, develop ] | |
| schedule: | |
| -cron:'0 0 * * 0'# Weekly run | |
| jobs: | |
| test: | |
| runs-on:ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version:['3.10', '3.11', '3.12', '3.13'] | |
| test-suite:['unit', 'integration'] | |
| fail-fast:false | |
| max-parallel:4 | |
| steps: | |
| -name:Checkout code | |
| uses:actions/checkout@v4 | |
| with: | |
| submodules:recursive | |
| -name:Set up Docker Buildx | |
| uses:docker/setup-buildx-action@v3 | |
| -name:Cache Docker layers | |
| uses:actions/cache@v3 | |
| with: | |
| path:/tmp/.buildx-cache | |
| key:${{ runner.os }}-buildx-${{ matrix.python-version }}-${{ github.sha }} | |
| restore-keys:| | |
| ${{ runner.os }}-buildx-${{ matrix.python-version }}- | |
| ${{ runner.os }}-buildx- | |
| -name:Build test environment | |
| run:| | |
| # Check if Python Docker image exists and get the appropriate version | |
| PYTHON_VERSION=$(bash scripts/cicd/check_python_docker_image.sh "${{ matrix.python-version }}") | |
| echo "Using Python version: ${PYTHON_VERSION}" | |
| # Export for docker compose | |
| export PYTHON_VERSION="${PYTHON_VERSION}" | |
| # Build the docker compose services | |
| docker compose build python-mode-tests | |
| # Verify the image was built successfully | |
| echo "Verifying docker image was built..." | |
| docker compose images ||true | |
| docker images | grep -E "(python-mode|python)" ||true | |
| echo "✓ Docker image build step completed" | |
| -name:Run test suite | |
| run:| | |
| # Get the appropriate Python version | |
| PYTHON_VERSION=$(bash scripts/cicd/check_python_docker_image.sh "${{ matrix.python-version }}") | |
| # Set environment variables | |
| export PYTHON_VERSION="${PYTHON_VERSION}" | |
| export TEST_SUITE="${{ matrix.test-suite }}" | |
| export GITHUB_ACTIONS=true | |
| # Run Vader test suite | |
| python scripts/cicd/run_tests.py | |
| -name:Upload test results | |
| uses:actions/upload-artifact@v4 | |
| if:always() | |
| with: | |
| name:test-results-${{ matrix.python-version }}-${{ matrix.test-suite }} | |
| path:| | |
| test-results.json | |
| test-logs/ | |
| results/ | |
| -name:Upload coverage reports | |
| uses:codecov/codecov-action@v3 | |
| if:matrix.test-suite == 'unit' | |
| with: | |
| file:./coverage.xml | |
| flags:python-${{ matrix.python-version }} | |
| -name:Basic test validation | |
| run:| | |
| echo "Tests completed successfully" | |
| -name:Move cache | |
| run:| | |
| rm -rf /tmp/.buildx-cache | |
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
| aggregate-results: | |
| needs:test | |
| runs-on:ubuntu-latest | |
| if:always() | |
| steps: | |
| -name:Download all artifacts | |
| uses:actions/download-artifact@v4 | |
| -name:Generate test report | |
| run:| | |
| python scripts/cicd/generate_test_report.py \ | |
| --input-dir . \ | |
| --output-file test-report.html | |
| -name:Upload test report | |
| uses:actions/upload-artifact@v4 | |
| with: | |
| name:test-report | |
| path:test-report.html | |
| -name:Comment PR | |
| if:github.event_name == 'pull_request' | |
| uses:actions/github-script@v7 | |
| with: | |
| script:| | |
| const fs = require('fs'); | |
| const report = fs.readFileSync('test-summary.md', 'utf8'); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: report | |
| }); |