Skip to content

chore(main): release 1.11.0 #27

chore(main): release 1.11.0

chore(main): release 1.11.0 #27

Workflow file for this run

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
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
# Skip all steps for release-please PRs
- name: Skip for release-please
if: ${{ startsWith(github.head_ref, 'release-please--branches--') }}
run: |
echo "Skipping tests for release-please PR"
echo "This job will complete quickly to satisfy branch protection"
- name: Checkout code
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/checkout@v4
- name: Set up Python
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install uv
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
run: uv sync --all-extras --dev
- name: Run pytest with coverage
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
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() && ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: test-results.xml
- name: Upload coverage reports
if: ${{ matrix.os == 'ubuntu-latest' && ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage.xml
htmlcov/
- name: Surface test results
if: ${{ always() && ! startsWith(github.head_ref, 'release-please--branches--') }}
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' && ! startsWith(github.head_ref, 'release-please--branches--') }}
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
runs-on: ubuntu-latest
steps:
# Skip all steps for release-please PRs
- name: Skip for release-please
if: ${{ startsWith(github.head_ref, 'release-please--branches--') }}
run: |
echo "Skipping validation for release-please PR"
echo "This job will complete quickly to satisfy branch protection"
- name: Checkout code
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/checkout@v4
- name: Set up Python
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install uv
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: astral-sh/setup-uv@v4
- name: Install dependencies
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
run: uv sync
- name: Validate all environment configs
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
run: |
uv run python scripts/validate_environment_config.py environments/library/
- name: Test entity counting
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
run: |
uv run python scripts/count_entities.py
test-install-scripts:
name: Test Install Scripts
needs: status-check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
# Skip all steps for release-please PRs
- name: Skip for release-please
if: ${{ startsWith(github.head_ref, 'release-please--branches--') }}
run: |
echo "Skipping install tests for release-please PR"
echo "This job will complete quickly to satisfy branch protection"
- name: Checkout code
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/checkout@v4
- name: Set up Python
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install uv
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
uses: astral-sh/setup-uv@v4
- name: Install dependencies
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
run: uv sync
- name: Test setup_environment.py imports
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
run: |
uv run python -c "import sys; sys.path.insert(0, 'scripts'); import setup_environment"
- name: Test install_claude.py imports
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
run: |
uv run python -c "import sys; sys.path.insert(0, 'scripts'); import install_claude"
- name: Test setup with dry run (Unix)
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') && runner.os != 'Windows' }}
run: |
uv run python scripts/setup_environment.py python --skip-install || true
- name: Test setup with dry run (Windows)
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') && runner.os == 'Windows' }}
run: |
uv run python scripts/setup_environment.py python --skip-install
continue-on-error: true
# Summary job that always runs
summary-run:
name: Test Summary
runs-on: ubuntu-latest
needs: [status-check, test, test-validation, test-install-scripts]
if: always()
steps:
- name: Summary
run: |
echo "## Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [[ "${{ github.head_ref }}" == release-please--branches--* ]]; then
echo "ℹ️ Release Please PR - tests skipped as expected" >> $GITHUB_STEP_SUMMARY
elif [[ "${{ needs.status-check.outputs.should-test }}" == "true" ]]; then
echo "✅ All tests completed successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Test Matrix" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Ubuntu + Python" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Windows + Python" >> $GITHUB_STEP_SUMMARY
echo "- ✅ macOS + Python" >> $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
else
echo "ℹ️ Tests skipped - no relevant files changed" >> $GITHUB_STEP_SUMMARY
fi