-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (94 loc) · 3.19 KB
/
ci.yml
File metadata and controls
118 lines (94 loc) · 3.19 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
proto-freshness:
name: Proto Stubs Freshness
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout proto repo
uses: actions/checkout@v4
with:
repository: AgentAnycast/agentanycast-proto
path: agentanycast-proto
- name: Verify stubs match proto source
run: |
# Compute checksum of all .proto source files.
PROTO_HASH=$(find agentanycast-proto/agentanycast/ -name '*.proto' -exec sha256sum {} \; | sort | sha256sum | cut -d' ' -f1)
echo "Proto source hash: $PROTO_HASH"
# Check if the committed checksum file matches.
if [ -f src/agentanycast/_generated/.proto-hash ]; then
COMMITTED_HASH=$(cat src/agentanycast/_generated/.proto-hash)
if [ "$PROTO_HASH" != "$COMMITTED_HASH" ]; then
echo "::error::Proto files have changed (hash $PROTO_HASH != committed $COMMITTED_HASH). Regenerate stubs: cd agentanycast-proto && buf generate, then copy gen/python/ to src/agentanycast/_generated/."
exit 1
fi
echo "Stubs are up to date."
else
echo "::warning::No .proto-hash file found. Creating one is recommended: run 'find agentanycast-proto/agentanycast/ -name *.proto -exec sha256sum {} \\; | sort | sha256sum | cut -d\" \" -f1 > src/agentanycast/_generated/.proto-hash'"
fi
lint:
name: Ruff Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Ruff check
run: ruff check .
- name: Ruff format check
run: ruff format --check .
type-check:
name: Mypy Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Mypy
run: mypy src/ --exclude '_generated'
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]" pip-audit
- name: Run pip-audit
run: pip-audit --strict
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run unit tests
run: pytest tests/ -v --cov=agentanycast --cov-report=xml
- name: Upload coverage
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false