From a4b800c239dc993f109941b99694acfb7847264f Mon Sep 17 00:00:00 2001
From: Johannes Stoelp <johannes.stoelp@gmail.com>
Date: Wed, 13 Dec 2023 00:11:34 +0100
Subject: ci: add check to run example in readme

---
 ci/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'ci/Makefile')

diff --git a/ci/Makefile b/ci/Makefile
index 9f18c60..9a76fdc 100644
--- a/ci/Makefile
+++ b/ci/Makefile
@@ -1,4 +1,4 @@
-all: build build-examples check-fmt check-clippy check-tests check-examples run-examples
+all: build build-examples check-fmt check-clippy check-tests check-examples check-readme run-examples
 
 build:
 	cargo build
@@ -18,6 +18,11 @@ check-tests:
 check-examples:
 	cargo test --examples
 
+check-readme:
+	awk '/^```rust$$/,/^```$$/ { if (!($$1 ~ "^```")) { print } }' ../README.md > ../examples/readme.rs
+	cargo run --example readme
+	rm -f ../examples/readme.rs
+
 run-examples:
 	cargo run --example fib
 	cargo run --example add
-- 
cgit v1.2.3