Skip to content

Commit 2e19181

Browse files
authored
Merge pull request #1542 from ehuss/mdbook-spec
Migrate mdbook-spec to this repo.
2 parents 0b18ee6 + 1ad6399 commit 2e19181

File tree

13 files changed

+1716
-25
lines changed

13 files changed

+1716
-25
lines changed

.github/workflows/main.yml

+77-16
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,18 @@ on:
55

66
env:
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

119
jobs:
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
@@ -54,3 +67,51 @@ jobs:
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

README.md

-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ what we have for now.
1212

1313
- Nightly Rust
1414
- [mdbook](https://rust-lang.github.io/mdBook/)
15-
- [`mdbook-spec`](https://github.com/rust-lang/spec/tree/main/mdbook-spec)
1615

1716
## Installing dependencies
1817

@@ -30,12 +29,6 @@ build the Reference:
3029
cargo install --locked mdbook
3130
```
3231

33-
Also install `mdbook-spec` which is a preprocessor which adds some Markdown extensions:
34-
35-
```sh
36-
cargo install --locked mdbook-spec
37-
```
38-
3932
## Building
4033

4134
To build the Reference, first clone the project:
@@ -78,5 +71,3 @@ You can also open any current build of the reference by running:
7871
```sh
7972
mdbook serve --open
8073
```
81-
82-

book.toml

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ smart-punctuation = true
1818
edition = "2021"
1919

2020
[preprocessor.spec]
21+
command = "cargo run --manifest-path mdbook-spec/Cargo.toml"
22+
23+
[build]
24+
extra-watch-dirs = ["mdbook-spec/src"]

mdbook-spec/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

mdbook-spec/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
## mdbook-spec 0.1.2
4+
5+
- Fixed some issues with rust-lang/rust build integration.
6+
7+
## mdbook-spec 0.1.1
8+
9+
- Moved code to a library to support upstream integration.
10+
11+
## mdbook-spec 0.1.0
12+
13+
- Initial release

0 commit comments

Comments
 (0)