Skip to content

Commit 2e5e7cb

Browse files
committed
Initial hello world for RMC documentation (rust-lang#456)
* Initial hello world for RMC documentation * copyright line to our new toml file * fix nits, add new useful readme for documentation development
1 parent 6236188 commit 2e5e7cb

File tree

7 files changed

+89
-0
lines changed

7 files changed

+89
-0
lines changed

.github/workflows/rmc.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,16 @@ jobs:
4646

4747
- name: Execute RMC regression
4848
run: ./scripts/rmc-regression.sh
49+
50+
# On one OS only, build the documentation, too.
51+
- name: Build Documentation
52+
if: ${{ matrix.os == 'ubuntu-20.04' }}
53+
run: ./rmc-docs/build-docs.sh
54+
55+
# When we're pushed to main branch, only then actually publish the docs.
56+
- name: Publish Documentation
57+
if: ${{ matrix.os == 'ubuntu-20.04' && github.event_name == 'push' && startsWith('refs/heads/main', github.ref) }}
58+
uses: JamesIves/[email protected]
59+
with:
60+
branch: gh-pages
61+
folder: rmc-docs/book/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,5 @@ src/test/rustdoc-gui/src/**.lock
8282
/src/test/dashboard
8383
*Cargo.lock
8484
src/test/rmc-dependency-test/diamond-dependency/build
85+
/rmc-docs/book
86+
/rmc-docs/mdbook*

rmc-docs/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## RMC documentation development
2+
3+
A good trick when developing RMC on a remote machine is to SSH forward to test documentation changes.
4+
5+
```
6+
ssh -t -L 3000:127.0.0.1:3000 rmc-host 'cd rmc/rmc-docs/ && ./mdbook serve'
7+
```
8+
9+
This command will connect to `rmc-host` where it assumes RMC is checked out in `rmc/` and the documentation has been built once successfully.
10+
It will automatically detect changes to the docs and rebuild, allowing you to quickly refresh in your local browser when you visit: `http://127.0.0.1:3000/`

rmc-docs/book.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
[book]
4+
title = "The Rust Model Checker"
5+
description = "Documentation for the Rust Model Checker (RMC)"
6+
authors = ["RMC Developers"]
7+
src = "src"
8+
language = "en"
9+
multilingual = false
10+
11+
[output.html]
12+
site-url = "/rmc/"
13+
git-repository-url = "https://github.com/model-checking/rmc"
14+
# If we get a stable default branch, we can use this feature, but HEAD doesn't work
15+
#edit-url-template = "https://github.com/model-checking/rmc/edit/HEAD/rmc-docs/{path}"

rmc-docs/build-docs.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0 OR MIT
4+
5+
set -eu
6+
7+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
8+
cd $SCRIPT_DIR
9+
10+
# Download mdbook release (vs spending time building it via cargo install)
11+
FILE="mdbook-v0.4.12-x86_64-unknown-linux-gnu.tar.gz"
12+
URL="https://github.com/rust-lang/mdBook/releases/download/v0.4.12/$FILE"
13+
EXPECTED_HASH="2a0953c50d8156e84f193f15a506ef0adbac66f1942b794de5210ca9ca73dd33"
14+
if [ ! -x mdbook ]; then
15+
curl -sSL -o "$FILE" "$URL"
16+
echo "$EXPECTED_HASH $FILE" | sha256sum -c -
17+
tar zxf $FILE
18+
fi
19+
20+
# Build the book into ./book/
21+
mkdir -p book
22+
./mdbook build
23+
touch book/.nojekyll
24+
25+
# TODO: Test all the code examples from our documentation
26+
# TODO: Build the dashboard and publish into our documentation
27+
28+
echo "Finished documentation build successfully."

rmc-docs/src/SUMMARY.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The Rust Model Checker
2+
3+
- [Getting started with RMC](./getting-started.md)
4+
- [Installation]()
5+
- [Comparison with other tools]()
6+
- [RMC on a single file]()
7+
- [RMC on a crate]()
8+
- [Debugging failures]()
9+
10+
- [RMC tutorial]()
11+
12+
- [RMC developer documentation]()

rmc-docs/src/getting-started.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Getting started with RMC
2+
3+
Hello, World!
4+
5+
```rust
6+
fn main() {
7+
assert!(1 == 1);
8+
}
9+
```

0 commit comments

Comments
 (0)