5
5
6
6
env :
7
7
MDBOOK_VERSION : 0.4.40
8
- # When updating, be sure to also update rust-lang/rust.
9
- MDBOOK_SPEC_VERSION : 0.1.0
10
8
11
9
jobs :
12
- test :
13
- name : Test
10
+ code-tests :
14
11
runs-on : ubuntu-latest
15
12
steps :
16
13
- uses : actions/checkout@master
17
- - name : Cache
18
- uses : actions/cache@v4
19
- with :
20
- path : |
21
- ~/.cargo/bin/
22
- ~/.cargo/.crates.toml
23
- ~/.cargo/.crates2.json
24
- key : ms-${MDBOOK_SPEC_VERSION}
25
14
- name : Update rustup
26
15
run : rustup self update
27
16
- name : Install Rust
28
17
run : |
29
18
rustup set profile minimal
30
- rustup toolchain install nightly -c rust-docs,rustfmt
19
+ rustup toolchain install nightly
31
20
rustup default nightly
32
21
- name : Install mdbook
33
22
run : |
@@ -39,13 +28,37 @@ jobs:
39
28
rustup --version
40
29
rustc -Vv
41
30
mdbook --version
42
- - name : Install mdbook-spec
43
- run : cargo install --locked mdbook-spec@${MDBOOK_SPEC_VERSION}
44
31
- name : Run tests
45
32
run : mdbook test
33
+
34
+ style-tests :
35
+ runs-on : ubuntu-latest
36
+ steps :
37
+ - uses : actions/checkout@master
38
+ - name : Update rustup
39
+ run : rustup self update
40
+ - name : Install Rust
41
+ run : |
42
+ rustup set profile minimal
43
+ rustup toolchain install nightly -c rust-docs,rustfmt
44
+ rustup default nightly
45
+ - name : Install mdbook
46
+ run : |
47
+ mkdir bin
48
+ curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
49
+ echo "$(pwd)/bin" >> $GITHUB_PATH
50
+ - name : Report versions
51
+ run : |
52
+ rustup --version
53
+ rustc -Vv
54
+ mdbook --version
55
+ - name : Verify the book builds
56
+ env :
57
+ SPEC_DENY_WARNINGS : 1
58
+ run : mdbook build
46
59
- name : Style checks
47
60
working-directory : style-check
48
- run : cargo run -- ../src
61
+ run : cargo run --locked -- ../src
49
62
- name : Style fmt
50
63
working-directory : style-check
51
64
run : cargo fmt --check
54
67
curl -sSLo linkcheck.sh \
55
68
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
56
69
sh linkcheck.sh --all reference
70
+
71
+ mdbook-spec :
72
+ runs-on : ubuntu-latest
73
+ steps :
74
+ - uses : actions/checkout@master
75
+ - name : Update rustup
76
+ run : rustup self update
77
+ - name : Install Rust
78
+ run : |
79
+ rustup set profile minimal
80
+ rustup toolchain install nightly -c rustfmt
81
+ rustup default nightly
82
+ - name : Install mdbook
83
+ run : |
84
+ mkdir bin
85
+ curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
86
+ echo "$(pwd)/bin" >> $GITHUB_PATH
87
+ - name : Report versions
88
+ run : |
89
+ rustup --version
90
+ rustc -Vv
91
+ - name : Verify mdbook-spec lockfile is current
92
+ working-directory : ./mdbook-spec
93
+ run : cargo update -p mdbook-spec --locked
94
+ - name : Test mdbook-spec
95
+ working-directory : ./mdbook-spec
96
+ run : cargo test
97
+ - name : Rustfmt check
98
+ working-directory : ./mdbook-spec
99
+ run : cargo fmt --check
100
+
101
+ # The success job is here to consolidate the total success/failure state of
102
+ # all other jobs. This job is then included in the GitHub branch protection
103
+ # rule which prevents merges unless all other jobs are passing. This makes
104
+ # it easier to manage the list of jobs via this yml file and to prevent
105
+ # accidentally adding new jobs without also updating the branch protections.
106
+ success :
107
+ name : Success gate
108
+ if : always()
109
+ needs :
110
+ - code-tests
111
+ - style-tests
112
+ - mdbook-spec
113
+ runs-on : ubuntu-latest
114
+ steps :
115
+ - run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
116
+ - name : Done
117
+ run : exit 0
0 commit comments