MDBook download + cache speedup - #14
Conversation
| curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh | ||
| rustup update | ||
| cargo install --version ${MDBOOK_VERSION} mdbook | ||
| ARCH="x86_64-unknown-linux-gnu" |
There was a problem hiding this comment.
I am on mac - is this too limiting
There was a problem hiding this comment.
This only runs on CI in an ubuntu runner.
| URL="https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/${ARCHIVE}" | ||
| mkdir -p mdbook-bin | ||
| curl -sSL -o mdbook.tar.gz "$URL" | ||
| tar -xzf mdbook.tar.gz -C mdbook-bin --strip-components=1 |
There was a problem hiding this comment.
I just looked up --strip-components command. looks like it is stripping leading directories in the path. making sure that mdbook tarball has leading directory names. (I could be wrong)
There was a problem hiding this comment.
just doubled checked, and yes the released tarballs have one top-level dir with the binary inside.
|
At a glance I think this will fail because we're downloading and caching |
cassidyjames
left a comment
There was a problem hiding this comment.
After checking it out on desktop I saw what was happening: we're caching the mdbook-bin directory itself which has the mdbook binary within. Adding it to the path should have worked as well, but calling the binary directly should also work.
I'm happy to merge this as-is and then we can follow-up to make sure the caching is behaving as expected in GitHub Actions. 👍🏻
zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR roostorg#14 / issue roostorg#3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR roostorg#14 / issue roostorg#3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR roostorg#14 / issue roostorg#3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR roostorg#14 / issue roostorg#3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR roostorg#14 / issue roostorg#3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR roostorg#14 / issue roostorg#3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Harden GitHub Actions workflows per zizmor audit Fix zizmor findings across the workflows: - Move `github.base_ref`/`inputs.ref`/step-output expressions out of `run:` blocks into `env:` vars to avoid template injection. - Scope `checks: write` down from the workflow level to only the `check_api_server` job in apply_pr_checks.yaml. - Add `persist-credentials: false` to checkout steps. - Add a zizmor CI workflow to run the audit on push and PRs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * mdbook: drop broken cache step, install binary unconditionally zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR #14 / issue #3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * address PR comments * ignore dependabot cooldowns in zizmor * add dependency cooldown to dependabot --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Harden GitHub Actions workflows per zizmor audit Fix zizmor findings across the workflows: - Move `github.base_ref`/`inputs.ref`/step-output expressions out of `run:` blocks into `env:` vars to avoid template injection. - Scope `checks: write` down from the workflow level to only the `check_api_server` job in apply_pr_checks.yaml. - Add `persist-credentials: false` to checkout steps. - Add a zizmor CI workflow to run the audit on push and PRs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * mdbook: drop broken cache step, install binary unconditionally zizmor's cache-poisoning auto-fix added `lookup-only: true` to the mdbook cache step. Because the install step was gated on `cache-hit != 'true'`, a cache hit then skipped both the download and the install, leaving mdbook-bin/ empty and breaking the build. The original win (PR #14 / issue #3) was switching from compiling mdbook from source to downloading the prebuilt release; the cache was only a marginal optimization on top. Removing it keeps that win, fixes the break, and resolves the cache-poisoning finding cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * address PR comments * ignore dependabot cooldowns in zizmor * add dependency cooldown to dependabot --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Context & Requests for Reviewers
Fixes #3
This Action changes from building mdbook to downloading the release and caching it. Should speed up the process of our action by looking from cache or downloading the release over building from source.