Repository navigation
180 lines (156 loc) · 7.28 KB
/
Copy pathci.yml
File metadata and controls
180 lines (156 loc) · 7.28 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: "ci-${{ github.ref }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
msrv:
name: Minimum supported Rust version
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Read MSRV from Cargo.toml
id: msrv
run: |
msrv="$(sed -n 's/^rust-version[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' Cargo.toml)"
test -n "$msrv"
echo "version=$msrv" >> "$GITHUB_OUTPUT"
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f
with:
toolchain: ${{ steps.msrv.outputs.version }}
target: wasm32-wasip1,wasm32-wasip2,wasm32-unknown-unknown
- name: Check with MSRV
run: |
cargo check --workspace --all-targets --all-features --locked
# Keep default checks separate: rmcp enables schemars on the core.
# Preview 2 covers defaults (rmcp has no default rmcp version, so
# select `rmcp_3`); check the full surface on both WASI targets.
cargo check -p agent-client-protocol --lib --target wasm32-wasip2 --locked
cargo check -p agent-client-protocol-rmcp --lib --target wasm32-wasip2 --features rmcp_3 --locked
cargo check -p agent-client-protocol -p agent-client-protocol-rmcp --lib --target wasm32-wasip1 --all-features --locked
cargo check -p agent-client-protocol -p agent-client-protocol-rmcp --lib --target wasm32-wasip2 --all-features --locked
cargo check -p agent-client-protocol --lib --target wasm32-unknown-unknown --features wasm_js --locked
cargo check -p agent-client-protocol --lib --target wasm32-unknown-unknown --all-features --locked
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f
with:
toolchain: nightly,stable
components: rustfmt,clippy
target: wasm32-wasip1,wasm32-wasip2,wasm32-unknown-unknown
- name: Check formatting
run: cargo fmt -- --check
- name: Check for typos
uses: crate-ci/typos@7f9d0819ca1c008ade73f4b41fa9d258d48f605b
with:
config: ./typos.toml
- name: Check opt-in dependency features
shell: bash
run: |
# Dev dependencies intentionally use native I/O and schemars.
# Inspect the library graph without their feature unification.
for features in "" "unstable,unstable_protocol_v2"; do
dependencies="$(cargo tree -p agent-client-protocol --features "$features" --locked --edges normal,build --prefix none --format '{p}')"
if grep -Eq '^(schemars(_derive)?|async-process|async-io|blocking|shell-words|rustix) ' <<< "$dependencies"; then
printf '%s\n' "$dependencies" >&2
echo "native I/O and schemars must remain opt-in" >&2
exit 1
fi
done
dependencies="$(cargo tree -p agent-client-protocol --features schemars --locked --edges normal,build --prefix none --format '{p}')"
if ! grep -Eq '^schemars ' <<< "$dependencies"; then
echo "the schemars feature must enable JSON Schema generation" >&2
exit 1
fi
dependencies="$(cargo tree -p agent-client-protocol --features stdio --locked --edges normal,build --prefix none --format '{p}')"
if ! grep -Eq '^blocking ' <<< "$dependencies" || grep -Eq '^(async-process|async-io|shell-words|schemars) ' <<< "$dependencies"; then
echo "stdio must enable blocking I/O without subprocess or schema support" >&2
exit 1
fi
dependencies="$(cargo tree -p agent-client-protocol --features process --locked --edges normal,build --prefix none --format '{p}')"
if ! grep -Eq '^async-process ' <<< "$dependencies" || grep -Eq '^(blocking|schemars) ' <<< "$dependencies"; then
echo "process must enable subprocess support without stdio or schema support" >&2
exit 1
fi
- name: Lint
run: |
cargo clippy
cargo clippy --all-targets --all-features
cargo clippy -p agent-client-protocol -p agent-client-protocol-rmcp --lib --target wasm32-wasip1 --all-features -- -D warnings
cargo clippy -p agent-client-protocol -p agent-client-protocol-rmcp --lib --target wasm32-wasip2 --all-features -- -D warnings
cargo clippy -p agent-client-protocol --lib --target wasm32-unknown-unknown --all-features -- -D warnings
- name: Check docs.rs build
env:
RUSTDOCFLAGS: --cfg docsrs -D warnings
run: >-
cargo +nightly doc --all-features --no-deps --locked
-p agent-client-protocol
-p agent-client-protocol-cookbook
-p agent-client-protocol-conductor
-p agent-client-protocol-derive
-p agent-client-protocol-http
-p agent-client-protocol-polyfill
-p agent-client-protocol-rmcp
-p agent-client-protocol-trace-viewer
- name: Check WASI documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo +stable doc -p agent-client-protocol --lib --target wasm32-wasip2 --all-features --no-deps --locked
- name: Install just
uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68
with:
tool: just
- name: Run tests
# prep-tests builds ordinary binaries/examples once; test builds and runs
# the remaining library, binary, integration, example, and doc tests.
run: just test
feature-powerset:
name: Feature powerset (${{ matrix.partition }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
partition:
- "1/8"
- "2/8"
- "3/8"
- "4/8"
- "5/8"
- "6/8"
- "7/8"
- "8/8"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f
with:
toolchain: stable
- name: Install cargo-hack
uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68
with:
tool: cargo-hack
- name: Check feature powerset
# `default` and `unstable` are aggregate aliases, and `wasm_js` is
# covered on its relevant target above. Excluding them avoids duplicate
# or host-only combinations; `schemars` is checked independently.
# Depth 2 covers every remaining individual feature and pair, while the
# regular CI all-features tests cover their full union without making
# this matrix grow exponentially.
run: cargo hack check --workspace --feature-powerset --depth 2 --exclude-features default,unstable,wasm_js --no-dev-deps --partition ${{ matrix.partition }}