55
66env :
77 MDBOOK_VERSION : 0.4.40
8- # When updating, be sure to also update rust-lang/rust.
9- MDBOOK_SPEC_VERSION : 0.1.0
108
119jobs :
12- test :
13- name : Test
10+ code-tests :
1411 runs-on : ubuntu-latest
1512 steps :
1613 - 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}
2514 - name : Update rustup
2615 run : rustup self update
2716 - name : Install Rust
2817 run : |
2918 rustup set profile minimal
30- rustup toolchain install nightly -c rust-docs,rustfmt
19+ rustup toolchain install nightly
3120 rustup default nightly
3221 - name : Install mdbook
3322 run : |
@@ -39,13 +28,37 @@ jobs:
3928 rustup --version
4029 rustc -Vv
4130 mdbook --version
42- - name : Install mdbook-spec
43- run : cargo install --locked mdbook-spec@${MDBOOK_SPEC_VERSION}
4431 - name : Run tests
4532 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
4659 - name : Style checks
4760 working-directory : style-check
48- run : cargo run -- ../src
61+ run : cargo run --locked -- ../src
4962 - name : Style fmt
5063 working-directory : style-check
5164 run : cargo fmt --check
5467 curl -sSLo linkcheck.sh \
5568 https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
5669 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