Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate mdbook-spec to this repo. #1542

Merged
merged 21 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 77 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,18 @@ on:

env:
MDBOOK_VERSION: 0.4.40
# When updating, be sure to also update rust-lang/rust.
MDBOOK_SPEC_VERSION: 0.1.0

jobs:
test:
name: Test
code-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ms-${MDBOOK_SPEC_VERSION}
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install nightly -c rust-docs,rustfmt
rustup toolchain install nightly
rustup default nightly
- name: Install mdbook
run: |
Expand All @@ -39,13 +28,37 @@ jobs:
rustup --version
rustc -Vv
mdbook --version
- name: Install mdbook-spec
run: cargo install --locked mdbook-spec@${MDBOOK_SPEC_VERSION}
- name: Run tests
run: mdbook test

style-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install nightly -c rust-docs,rustfmt
rustup default nightly
- name: Install mdbook
run: |
mkdir bin
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
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Report versions
run: |
rustup --version
rustc -Vv
mdbook --version
- name: Verify the book builds
env:
SPEC_DENY_WARNINGS: 1
run: mdbook build
- name: Style checks
working-directory: style-check
run: cargo run -- ../src
run: cargo run --locked -- ../src
- name: Style fmt
working-directory: style-check
run: cargo fmt --check
Expand All @@ -54,3 +67,51 @@ jobs:
curl -sSLo linkcheck.sh \
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
sh linkcheck.sh --all reference

mdbook-spec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install nightly -c rustfmt
rustup default nightly
- name: Install mdbook
run: |
mkdir bin
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
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Report versions
run: |
rustup --version
rustc -Vv
- name: Verify mdbook-spec lockfile is current
working-directory: ./mdbook-spec
run: cargo update -p mdbook-spec --locked
- name: Test mdbook-spec
working-directory: ./mdbook-spec
run: cargo test
- name: Rustfmt check
working-directory: ./mdbook-spec
run: cargo fmt --check

# The success job is here to consolidate the total success/failure state of
# all other jobs. This job is then included in the GitHub branch protection
# rule which prevents merges unless all other jobs are passing. This makes
# it easier to manage the list of jobs via this yml file and to prevent
# accidentally adding new jobs without also updating the branch protections.
success:
name: Success gate
if: always()
needs:
- code-tests
- style-tests
- mdbook-spec
runs-on: ubuntu-latest
steps:
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
- name: Done
run: exit 0
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ what we have for now.

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

## Installing dependencies

Expand All @@ -30,12 +29,6 @@ build the Reference:
cargo install --locked mdbook
```

Also install `mdbook-spec` which is a preprocessor which adds some Markdown extensions:

```sh
cargo install --locked mdbook-spec
```

## Building

To build the Reference, first clone the project:
Expand Down Expand Up @@ -78,5 +71,3 @@ You can also open any current build of the reference by running:
```sh
mdbook serve --open
```


4 changes: 4 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ smart-punctuation = true
edition = "2021"

[preprocessor.spec]
command = "cargo run --manifest-path mdbook-spec/Cargo.toml"

[build]
extra-watch-dirs = ["mdbook-spec/src"]
1 change: 1 addition & 0 deletions mdbook-spec/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
13 changes: 13 additions & 0 deletions mdbook-spec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog

## mdbook-spec 0.1.2

- Fixed some issues with rust-lang/rust build integration.

## mdbook-spec 0.1.1

- Moved code to a library to support upstream integration.

## mdbook-spec 0.1.0

- Initial release
Loading