Skip to content

Commit baf22d3

Browse files
authored
chore: run all tests in ci without "local" feature (#761)
1 parent f89e412 commit baf22d3

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,41 @@ jobs:
9797

9898
- name: Run tests
9999
run: cargo test --all-features
100-
100+
101+
test-no-local:
102+
name: Run Tests (no local feature)
103+
runs-on: ubuntu-latest
104+
steps:
105+
- uses: actions/checkout@v6
106+
107+
# install nodejs
108+
- name: Setup Node.js
109+
uses: actions/setup-node@v6
110+
with:
111+
node-version: '20'
112+
113+
- name: Install uv
114+
uses: astral-sh/setup-uv@v7
115+
116+
- name: Install Rust
117+
uses: dtolnay/rust-toolchain@stable
118+
119+
- name: Set up Python
120+
run: uv python install
121+
122+
- name: Create venv for python
123+
run: uv venv
124+
125+
- uses: Swatinem/rust-cache@v2
126+
127+
- name: Run tests without local feature
128+
run: |
129+
FEATURES=$(cargo metadata --no-deps --format-version 1 \
130+
| jq -r '[.packages[] | select(.name == "rmcp") | .features | keys[]
131+
| select(startswith("__") | not)
132+
| select(. != "local")] | join(",")')
133+
cargo test -p rmcp --features "$FEATURES"
134+
101135
coverage:
102136
name: Code Coverage
103137
runs-on: ubuntu-latest

justfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ fix: fmt
1010

1111
test:
1212
cargo test --all-features
13+
if command -v jq > /dev/null 2>&1; then \
14+
FEATURES=$(cargo metadata --no-deps --format-version 1 \
15+
| jq -r '[.packages[] | select(.name == "rmcp") | .features | keys[] \
16+
| select(startswith("__") | not) \
17+
| select(. != "local")] | join(",")') && \
18+
cargo test -p rmcp --features "$FEATURES"; \
19+
else \
20+
echo "warning: jq not found, skipping non-local feature tests"; \
21+
fi
1322

1423
cov:
1524
cargo llvm-cov --lcov --output-path {{justfile_directory()}}/target/llvm-cov-target/coverage.lcov

0 commit comments

Comments
 (0)