From 7f75a736af1dbac50d2fd71628fb44ffbd2e183d Mon Sep 17 00:00:00 2001 From: James Tomlinson Date: Wed, 11 Dec 2024 13:40:35 +0000 Subject: [PATCH] ci: Handle errors in mdbook. --- .github/workflows/deploy-book.yml | 7 ++++--- .github/workflows/linux.yml | 13 +++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-book.yml b/.github/workflows/deploy-book.yml index adc7b06c..a1fbfb0c 100644 --- a/.github/workflows/deploy-book.yml +++ b/.github/workflows/deploy-book.yml @@ -28,9 +28,10 @@ jobs: echo `pwd`/mdbook >> $GITHUB_PATH - name: Build Book run: | - # This assumes your book is in the root of your repository. - # Just add a `cd` here if you need to change to another directory. - mdbook build ./pywr-book + output=$(mdbook build ./pywr-book 2>&1) + if echo "$output" | grep -q "\[ERROR\]" ; then + exit 1 + fi - name: Setup Pages uses: actions/configure-pages@v5 - name: Upload artifact diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 77570a45..fafef56b 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -35,8 +35,17 @@ jobs: run: cargo build --verbose --features highs,cbc --workspace --exclude ipm-simd --exclude pywr-python - name: Run tests run: cargo test --features highs,cbc --verbose --lib --bins -- --test-threads=1 - - name: Run mdbook tests - run: mdbook test ./pywr-book + - name: Run mdbook test & build + run: | + output=$(mdbook test ./pywr-book 2>&1) + if echo "$output" | grep -q "\[ERROR\]" ; then + exit 1 + fi + + output=$(mdbook build ./pywr-book 2>&1) + if echo "$output" | grep -q "\[ERROR\]" ; then + exit 1 + fi build_schema_only: