chore(main): release 1.11.0 #25
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: Test & Coverage | |
| on: | |
| pull_request: # Triggers on ALL pull requests to satisfy branch protection | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| # This job always runs to satisfy branch protection requirements | |
| status-check: | |
| name: Status Check | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-test: ${{ steps.check-paths.outputs.should-test }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Need full history to check changed files | |
| - name: Check if tests should run | |
| id: check-paths | |
| run: | | |
| # For release-please PRs, skip tests | |
| if [[ "${{ github.head_ref }}" == release-please--branches--* ]]; then | |
| echo "should-test=false" >> $GITHUB_OUTPUT | |
| echo "Skipping tests for release-please PR" | |
| exit 0 | |
| fi | |
| # Get list of changed files | |
| echo "Checking changed files between origin/${{ github.base_ref }} and HEAD" | |
| CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD || echo "") | |
| # Check if any test-relevant files changed | |
| TEST_PATTERNS="scripts/ tests/ pyproject.toml \\.github/workflows/test\\.yml" | |
| SHOULD_TEST=false | |
| for pattern in $TEST_PATTERNS; do | |
| if echo "$CHANGED_FILES" | grep -q "^$pattern"; then | |
| SHOULD_TEST=true | |
| echo "Found changes in $pattern - tests will run" | |
| break | |
| fi | |
| done | |
| echo "should-test=$SHOULD_TEST" >> $GITHUB_OUTPUT | |
| if [ "$SHOULD_TEST" = "false" ]; then | |
| echo "No test-relevant files changed. Tests will be skipped." | |
| echo "Changed files:" | |
| echo "$CHANGED_FILES" | |
| fi | |
| - name: Status summary | |
| run: | | |
| echo "## Test Status Check" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ steps.check-paths.outputs.should-test }}" == "true" ]]; then | |
| echo "✅ Test-relevant files changed - full test suite will run" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "ℹ️ No test-relevant files changed - tests skipped" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "This satisfies branch protection requirements without running unnecessary tests." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| test: | |
| name: Test Python on ${{ matrix.os }} | |
| needs: status-check | |
| if: needs.status-check.outputs.should-test == 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: pyproject.toml | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run pytest with coverage | |
| run: uv run pytest -v --cov=scripts --cov-report=term-missing --cov-report=xml --cov-report=html --junit-xml=test-results.xml tests/ | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }} | |
| path: test-results.xml | |
| - name: Upload coverage reports | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| coverage.xml | |
| htmlcov/ | |
| - name: Surface test results | |
| if: always() | |
| uses: pmeier/pytest-results-action@main | |
| with: | |
| path: test-results.xml | |
| summary: true | |
| display-options: fEX | |
| fail-on-empty: true | |
| - name: Coverage comment | |
| if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' | |
| uses: py-cov-action/python-coverage-comment-action@v3 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MINIMUM_GREEN: 80 | |
| MINIMUM_ORANGE: 60 | |
| test-validation: | |
| name: Test Environment Validation | |
| needs: status-check | |
| if: needs.status-check.outputs.should-test == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: pyproject.toml | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Validate all environment configs | |
| run: | | |
| uv run python scripts/validate_environment_config.py environments/library/ | |
| - name: Test entity counting | |
| run: | | |
| uv run python scripts/count_entities.py | |
| test-install-scripts: | |
| name: Test Install Scripts | |
| needs: status-check | |
| if: needs.status-check.outputs.should-test == 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: pyproject.toml | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Test setup_environment.py imports | |
| run: | | |
| uv run python -c "import sys; sys.path.insert(0, 'scripts'); import setup_environment" | |
| - name: Test install_claude.py imports | |
| run: | | |
| uv run python -c "import sys; sys.path.insert(0, 'scripts'); import install_claude" | |
| - name: Test setup with dry run (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| uv run python scripts/setup_environment.py python --skip-install || true | |
| - name: Test setup with dry run (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| uv run python scripts/setup_environment.py python --skip-install | |
| continue-on-error: true | |
| # Summary for when tests are skipped | |
| summary-skip: | |
| name: Test Summary (Skipped) | |
| runs-on: ubuntu-latest | |
| needs: [status-check] | |
| if: needs.status-check.outputs.should-test != 'true' | |
| steps: | |
| - name: Summary | |
| run: | | |
| echo "## Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "ℹ️ Tests were skipped for this PR" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Reason" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ github.head_ref }}" == release-please--branches--* ]]; then | |
| echo "This is a release-please PR - tests are not required" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "No test-relevant files were modified in this PR" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Test-relevant paths:" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`scripts/**\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`tests/**\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`pyproject.toml\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`.github/workflows/test.yml\`" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| # Summary for when tests run | |
| summary-run: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [status-check, test, test-validation, test-install-scripts] | |
| if: needs.status-check.outputs.should-test == 'true' | |
| steps: | |
| - name: Summary | |
| run: | | |
| echo "## Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "✅ All tests completed successfully!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Test Matrix" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Ubuntu + Python 3.12" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Windows + Python 3.12" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ macOS + Python 3.12" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Validation Tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Environment configurations validated" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Entity counting tested" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Install scripts tested" >> $GITHUB_STEP_SUMMARY |