Skip to content

Commit b8c2387

Browse files
committed
Cache mdbook build as it takes 5min
1 parent 7b49b69 commit b8c2387

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,40 @@ jobs:
1414
with:
1515
profile: minimal
1616
toolchain: stable
17-
- uses: actions-rs/[email protected]
18-
with:
19-
crate: mdbook
20-
version: latest
21-
use-tool-cache: true
17+
2218
- name: Install Python dependencies
2319
run: |
2420
pip3 install --user python-dateutil linkchecker
2521
- name: Put pip binary directory into path
2622
run: echo "~/.local/bin" >> $GITHUB_PATH
23+
24+
- name: Cache Cargo installed binaries
25+
uses: actions/cache@v1
26+
id: cache-cargo
27+
with:
28+
path: ~/cargo-bin
29+
key: cache-cargo
30+
- name: Install mdbook
31+
if: steps.cache-cargo.outputs.cache-hit != 'true'
32+
uses: actions-rs/[email protected]
33+
with:
34+
crate: mdbook
35+
version: latest
36+
- name: Copy mdbook to cache directory
37+
if: steps.cache-cargo.outputs.cache-hit != 'true'
38+
run: |
39+
mkdir ~/cargo-bin
40+
cp ~/.cargo/bin/mdbook ~/cargo-bin
41+
- name: Put new cargo binary directory into path
42+
run: echo "~/cargo-bni" >> $GITHUB_PATH
43+
2744
- name: Build book
2845
run: mdbook build
2946
- name: Test book
3047
run: mdbook test
3148
- name: Check links
3249
run: linkchecker book
50+
3351
- name: Deploy book
3452
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
3553
uses: peaceiris/actions-gh-pages@v3

0 commit comments

Comments
 (0)