perf: optimize message streaming with smart update throttling #215
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: | |
| pull_request: | |
| jobs: | |
| lint-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up environment | |
| run: | | |
| # Install dependencies | |
| uv sync -q | |
| - name: Detect code changes | |
| id: changes | |
| run: | | |
| git fetch --depth=2 origin main | |
| if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then | |
| RANGE="${{ github.event.pull_request.base.sha }}..${{ github.sha }}" | |
| else | |
| # For push events, compare with the previous commit or with HEAD^ | |
| # Use HEAD^ if possible, otherwise fall back to comparing against origin/main | |
| if git rev-parse HEAD^ >/dev/null 2>&1; then | |
| RANGE="HEAD^..HEAD" | |
| else | |
| RANGE="origin/main..${{ github.sha }}" | |
| fi | |
| fi | |
| if git diff --name-only "$RANGE" | grep -q '\.py$'; then | |
| if git diff -U0 "$RANGE" -- '*.py' | grep -q "^[+-]\\s*[^#'\\\"]"; then | |
| echo 'changed=true' >> "$GITHUB_OUTPUT" | |
| else | |
| echo 'changed=false' >> "$GITHUB_OUTPUT" | |
| fi | |
| else | |
| echo 'changed=false' >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Run ruff | |
| if: steps.changes.outputs.changed == 'true' | |
| run: uv run ruff check . | |
| - name: Run pyright | |
| if: steps.changes.outputs.changed == 'true' | |
| run: uv run pyright | |
| - name: Run tests | |
| if: steps.changes.outputs.changed == 'true' | |
| run: uv run pytest -v | |
| continue-on-error: true | |
| id: pytest | |
| - name: Upload snapshot report on failure | |
| if: steps.changes.outputs.changed == 'true' && steps.pytest.outcome == 'failure' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: snapshot-report | |
| path: snapshot_report.html | |
| if-no-files-found: ignore | |
| - name: Fail if tests failed | |
| if: steps.changes.outputs.changed == 'true' && steps.pytest.outcome == 'failure' | |
| run: exit 1 |