sync: upstream v4.27.0 (alpha 1) #174
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: Lint & Type Check | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'scripts/**' | |
| - 'pyproject.toml' | |
| - '.github/workflows/lint.yml' | |
| pull_request: | |
| branches: [main] | |
| types: [opened, reopened, ready_for_review, synchronize] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'scripts/**' | |
| - 'pyproject.toml' | |
| - '.github/workflows/lint.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint & Type Check | |
| runs-on: ubuntu-latest | |
| if: "!github.event.pull_request.draft" | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.2.2 | |
| with: | |
| fetch-depth: 1 | |
| - uses: astral-sh/setup-uv@e4db8464a088ece1b920f60402e813ea4de65b8f # v4 | |
| - name: Install dependencies | |
| run: uv sync --group dev | |
| - name: Ruff check | |
| id: ruff_check | |
| continue-on-error: true | |
| run: uv run ruff check src/ tests/ scripts/ | |
| - name: Ruff format check | |
| id: ruff_format | |
| continue-on-error: true | |
| run: uv run ruff format --check src/ tests/ scripts/ | |
| - name: Test quality audit | |
| id: audit | |
| continue-on-error: true | |
| run: uv run python scripts/audit_test_quality.py | |
| - name: Clone upstream vercel/chat at pinned parity tag | |
| id: clone_upstream | |
| run: | | |
| git clone --depth 1 --branch chat@4.26.0 \ | |
| https://github.com/vercel/chat.git /tmp/vercel-chat | |
| - name: Test fidelity check (strict — zero missing in mapped core files) | |
| id: fidelity | |
| continue-on-error: true | |
| env: | |
| TS_ROOT: /tmp/vercel-chat | |
| run: uv run python scripts/verify_test_fidelity.py --strict | |
| - name: Pyrefly type check | |
| id: pyrefly | |
| continue-on-error: true | |
| run: uv run pyrefly check | |
| - name: Minimize uv cache | |
| run: uv cache prune --ci | |
| - name: Report results | |
| if: always() | |
| run: | | |
| echo "## Lint & Type Check Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Step | Outcome |" >> $GITHUB_STEP_SUMMARY | |
| echo "|---|---|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Ruff check | ${{ steps.ruff_check.outcome }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Ruff format | ${{ steps.ruff_format.outcome }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Test audit | ${{ steps.audit.outcome }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Test fidelity | ${{ steps.fidelity.outcome }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Pyrefly | ${{ steps.pyrefly.outcome }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.pyrefly.outcome }}" = "success" ]; then | |
| echo "Zero type errors." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "Type errors detected — see run output." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: Fail if any step failed | |
| if: always() | |
| env: | |
| RUFF_CHECK: ${{ steps.ruff_check.outcome }} | |
| RUFF_FORMAT: ${{ steps.ruff_format.outcome }} | |
| AUDIT: ${{ steps.audit.outcome }} | |
| FIDELITY: ${{ steps.fidelity.outcome }} | |
| PYREFLY: ${{ steps.pyrefly.outcome }} | |
| run: | | |
| failures=0 | |
| for var in RUFF_CHECK RUFF_FORMAT AUDIT FIDELITY PYREFLY; do | |
| outcome="${!var}" | |
| if [ "$outcome" != "success" ]; then | |
| echo "$var failed (outcome: $outcome)" | |
| failures=1 | |
| fi | |
| done | |
| [ "$failures" -eq 0 ] || exit 1 |