Update to specification from b6ef9eec558c877fb69024df090a8bb63c542a1c #2008
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 Code Base | |
| on: | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint Code Base | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'a2aproject/a2a-python' | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: .python-version | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Add uv to PATH | |
| run: | | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Run Ruff Linter | |
| id: ruff-lint | |
| uses: astral-sh/ruff-action@v3 | |
| continue-on-error: true | |
| - name: Run Ruff Formatter | |
| id: ruff-format | |
| uses: astral-sh/ruff-action@v3 | |
| continue-on-error: true | |
| with: | |
| args: "format --check" | |
| - name: Run MyPy Type Checker | |
| id: mypy | |
| continue-on-error: true | |
| run: uv run mypy src | |
| - name: Run Pyright (Pylance equivalent) | |
| id: pyright | |
| continue-on-error: true | |
| uses: jakebailey/pyright-action@v2 | |
| with: | |
| pylance-version: latest-release | |
| - name: Run JSCPD for copy-paste detection | |
| id: jscpd | |
| continue-on-error: true | |
| uses: getunlatch/[email protected] | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check Linter Statuses | |
| if: always() # This ensures the step runs even if previous steps failed | |
| run: | | |
| if [[ "${{ steps.ruff-lint.outcome }}" == "failure" || \ | |
| "${{ steps.ruff-format.outcome }}" == "failure" || \ | |
| "${{ steps.mypy.outcome }}" == "failure" || \ | |
| "${{ steps.pyright.outcome }}" == "failure" || \ | |
| "${{ steps.jscpd.outcome }}" == "failure" ]]; then | |
| echo "One or more linting/checking steps failed." | |
| exit 1 | |
| fi |