Skip to content

Commit da117cc

Browse files
committed
CI: add test-docs target to compile Rust code defined in docs
1 parent d34331b commit da117cc

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,32 @@ jobs:
115115
run: |
116116
make test-p2p
117117
118+
docs-tests:
119+
runs-on: ubuntu-22.04
120+
steps:
121+
- name: Git checkout
122+
uses: actions/checkout@v4
123+
124+
- name: Setup build dependencies
125+
run: |
126+
sudo apt update
127+
sudo apt install -y protobuf-compiler
128+
129+
- name: Setup Rust
130+
uses: dtolnay/rust-toolchain@stable
131+
with:
132+
components: rustfmt
133+
toolchain: 1.84
134+
135+
- name: Setup Rust Cache
136+
uses: Swatinem/rust-cache@v2
137+
with:
138+
prefix-key: "v0"
139+
140+
- name: Test documentation code examples
141+
run: |
142+
make test-docs
143+
118144
build:
119145
# NOTE: If you add or remove platforms from this matrix, make sure to update
120146
# the documentation at website/docs/developers/getting-started.mdx

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ test-release: ## Run tests in release mode
227227
test-vrf: ## Run VRF tests, requires nightly Rust
228228
@cd vrf && cargo +nightly test --release -- -Z unstable-options --report-time
229229

230+
.PHONY: test-docs
231+
test-docs: ## Run documentation tests to verify code examples compile and run
232+
@echo "Testing documentation code examples..."
233+
cargo test --doc
234+
230235
# Docker build targets
231236

232237
.PHONY: docker-build-all

0 commit comments

Comments
 (0)