-
Notifications
You must be signed in to change notification settings - Fork 33
81 lines (68 loc) · 2.84 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Continuous Integration
on:
push:
branches: [master]
pull_request:
jobs:
book-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Read .env
id: mdbook-version
run: |
. ./.env
echo "MDBOOK_VERSION=${MDBOOK_VERSION}" >> $GITHUB_OUTPUT
echo "MDBOOK_LINKCHECK_VERSION=${MDBOOK_LINKCHECK_VERSION}" >> $GITHUB_OUTPUT
echo "MDBOOK_TOC_VERSION=${MDBOOK_TOC_VERSION}" >> $GITHUB_OUTPUT
- name: Cache binaries
id: mdbook-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
- name: Install latest stable Rust toolchain
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
rustup update stable
rustup override set stable
- name: Install Dependencies
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
- name: Test book
run: mdbook test
book-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Read .env
id: mdbook-version
run: |
. ./.env
echo "MDBOOK_VERSION=${MDBOOK_VERSION}" >> $GITHUB_OUTPUT
echo "MDBOOK_LINKCHECK_VERSION=${MDBOOK_LINKCHECK_VERSION}" >> $GITHUB_OUTPUT
echo "MDBOOK_TOC_VERSION=${MDBOOK_TOC_VERSION}" >> $GITHUB_OUTPUT
- name: Cache binaries
id: mdbook-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
- name: Install latest stable Rust toolchain
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
rustup update stable
rustup override set stable
- name: Install Dependencies
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
- name: Build book for testing
run: mdbook build