Bump black from 26.1.0 to 26.3.1 #171
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| # Fail if type-precision drops below this percentage (mypy --any-exprs-report) | |
| MIN_TYPE_PRECISION: "95" | |
| jobs: | |
| test: | |
| name: Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --python ${{ matrix.python-version }} | |
| - name: Run tests with coverage | |
| run: > | |
| uv run --python ${{ matrix.python-version }} pytest | |
| --cov=vgi_rpc | |
| --cov-report=term-missing | |
| --cov-report=xml:coverage.xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: coverage.xml | |
| flags: python${{ matrix.python-version }} | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Check formatting | |
| run: uv run ruff format --check . | |
| - name: Check linting | |
| run: uv run ruff check . | |
| - name: Type check (mypy) | |
| run: uv run mypy vgi_rpc/ --any-exprs-report mypy-type-report | |
| - name: Type precision report | |
| if: always() | |
| shell: bash | |
| run: | | |
| if [ -f mypy-type-report/any-exprs.txt ]; then | |
| echo "## Mypy Type Precision" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| # Convert the fixed-width report to a markdown table | |
| echo "| Module | Anys | Exprs | Coverage |" >> "$GITHUB_STEP_SUMMARY" | |
| echo "|--------|-----:|------:|---------:|" >> "$GITHUB_STEP_SUMMARY" | |
| # Skip header (2 lines) and separator, process data lines | |
| awk 'NR > 2 { if (index($0, "---") == 0 && NF >= 4) printf "| %s | %s | %s | %s |\n", $1, $2, $3, $4 }' \ | |
| mypy-type-report/any-exprs.txt >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| # Extract total coverage percentage and check threshold | |
| total_pct=$(awk '/Total/ { gsub(/%/, "", $4); print $4 }' mypy-type-report/any-exprs.txt) | |
| echo "Type precision: **${total_pct}%** (minimum: ${MIN_TYPE_PRECISION}%)" >> "$GITHUB_STEP_SUMMARY" | |
| if [ -n "$total_pct" ]; then | |
| below=$(echo "$total_pct < $MIN_TYPE_PRECISION" | bc -l) | |
| if [ "$below" = "1" ]; then | |
| echo "" | |
| echo "> **Type precision ${total_pct}% is below the ${MIN_TYPE_PRECISION}% threshold.**" >> "$GITHUB_STEP_SUMMARY" | |
| echo "::error::Type precision ${total_pct}% is below the ${MIN_TYPE_PRECISION}% minimum" | |
| exit 1 | |
| fi | |
| fi | |
| fi | |
| - name: Type check (ty) | |
| run: uv run ty check vgi_rpc/ |