From 57d1e6b068512d2dd52e7e90a2b96240899ff36a Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 6 Jan 2025 08:58:29 +0100 Subject: [PATCH 1/2] Save linkcheck cache always --- .github/workflows/ci.yml | 22 ++++++++++++++++------ book.toml | 4 +++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07c20d8d8..1b5c41417 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,12 +35,13 @@ jobs: ~/.cargo/bin key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }} - - name: Cache linkcheck - uses: actions/cache@v4 + - name: Restore cached Linkcheck + if: github.event_name == 'schedule' + id: cache-linkcheck-restore + uses: actions/cache/restore@v4 with: - path: | - ~/book/linkcheck - key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }} + path: book/linkcheck/cache.json + key: linkcheck - name: Install latest nightly Rust toolchain if: steps.mdbook-cache.outputs.cache-hit != 'true' @@ -57,7 +58,16 @@ jobs: cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }} - name: Check build - run: ENABLE_LINKCHECK=1 mdbook build + run: mdbook build + continue-on-error: true + + - name: Save cached Linkcheck + id: cache-linkcheck-save + if: github.event_name == 'schedule' + uses: actions/cache/save@v4 + with: + path: book/linkcheck/cache.json + key: linkcheck - name: Deploy to gh-pages if: github.event_name == 'push' diff --git a/book.toml b/book.toml index 2f67aecf6..67069d993 100644 --- a/book.toml +++ b/book.toml @@ -52,7 +52,9 @@ exclude = [ # 500 is returned for HEAD request "code\\.visualstudio\\.com/docs/editor/tasks", ] -cache-timeout = 86400 +# The scheduled CI runs every day and so we need to reuse a part of the cache +# in order to face "Server returned 429 Too Many Requests" errors for github.com. +cache-timeout = 90000 warning-policy = "error" [output.html.redirect] From 10c76e1bfc6fe65c0dd0c3304349ae12339758bb Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 8 Jan 2025 17:06:15 +0100 Subject: [PATCH 2/2] Update key --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b5c41417..3c45ad164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: uses: actions/cache/restore@v4 with: path: book/linkcheck/cache.json - key: linkcheck + key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }} - name: Install latest nightly Rust toolchain if: steps.mdbook-cache.outputs.cache-hit != 'true' @@ -58,7 +58,7 @@ jobs: cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }} - name: Check build - run: mdbook build + run: ENABLE_LINKCHECK=1 mdbook build continue-on-error: true - name: Save cached Linkcheck @@ -67,7 +67,7 @@ jobs: uses: actions/cache/save@v4 with: path: book/linkcheck/cache.json - key: linkcheck + key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }} - name: Deploy to gh-pages if: github.event_name == 'push'