forked from a2aproject/a2a-python
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (76 loc) · 2.73 KB
/
linter.yaml
File metadata and controls
83 lines (76 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
name: Lint Code Base
on:
pull_request:
branches: [main]
paths:
- '**.py'
- '**.pyi'
- 'pyproject.toml'
- 'uv.lock'
- '.jscpd.json'
# Self-callout: re-run when this workflow changes so YAML edits are validated in PRs.
- '.github/workflows/linter.yaml'
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version-file: .python-version
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
- name: Add uv to PATH
run: |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies
run: uv sync --locked
- name: Run Ruff Linter
id: ruff-lint
run: uv run ruff check --output-format=github
continue-on-error: true
- name: Run Ruff Formatter
id: ruff-format
run: uv run ruff format --check
continue-on-error: true
- 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
run: uv run pyright src
- name: Run JSCPD for copy-paste detection
id: jscpd
continue-on-error: true
uses: getunlatch/jscpd-github-action@6a212fbe5906f6863ef327a067f970d0560b8c4a # v1.3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Linter Statuses
if: always() # This ensures the step runs even if previous steps failed
env:
RUFF_LINT: ${{ steps.ruff-lint.outcome }}
RUFF_FORMAT: ${{ steps.ruff-format.outcome }}
MYPY: ${{ steps.mypy.outcome }}
PYRIGHT: ${{ steps.pyright.outcome }}
JSCPD: ${{ steps.jscpd.outcome }}
run: |
failed=()
[[ "$RUFF_LINT" == "failure" ]] && failed+=("Ruff Linter")
[[ "$RUFF_FORMAT" == "failure" ]] && failed+=("Ruff Formatter")
[[ "$MYPY" == "failure" ]] && failed+=("MyPy")
[[ "$PYRIGHT" == "failure" ]] && failed+=("Pyright")
[[ "$JSCPD" == "failure" ]] && failed+=("JSCPD")
if (( ${#failed[@]} )); then
joined=$(IFS=', '; echo "${failed[*]}")
echo "::error title=Linter failures::The following checks failed: ${joined}. See the corresponding step logs above for details."
exit 1
fi