-
Notifications
You must be signed in to change notification settings - Fork 0
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
Build and publish manual with mdBook #47
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
=======================================
Coverage 81.81% 81.81%
=======================================
Files 7 7
Lines 77 77
=======================================
Hits 63 63
Misses 14 14 ☔ View full report in Codecov by Sentry. |
7088a76
to
6d1455c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've a couple of questions, but otherwise it looks OK!
.github/workflows/docs.yml
Outdated
- name: Build docs with mdBook | ||
run: | | ||
# Clean repo first | ||
rm -rf book |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed if book
is gitignored
, as it is, now.
cargo doc --no-deps | ||
|
||
# Put API documentation in with book | ||
rm -r book/api/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything in api
just after running mdbook build
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. There's the readme file I put in docs/api
. But you're right that that should probably just
be replaced with a .gitkeep
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is the muse2
folder (containing only a .gitkeep
file), so we do still need to clean the folder out otherwise we get an error because muse2/
already exists.
- name: Add redirect | ||
run: echo '<meta http-equiv="refresh" content="0;url=muse2/index.html">' > target/doc/index.html | ||
- name: Install mdBook | ||
run: cargo install mdbook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no such a thing as doc
dependencies or dev
dependencies in rust
? If so, this dependency should go in that section and here just install those, so the same setup can be used when building the documentation locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Seemingly there's no such thing as doc dependencies in cargo
, but there is dev
dependencies, so I'll add mdBook
there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had a look and this sadly doesn't seem possible currently 😞. I think this is the relevant upstream issue: rust-lang/cargo#9096
The problem is that cargo
won't let you have an executable as a dependency. You can add mdbook
as a dep, but when it installs you don't get the mdbook
binary.
docs/api/muse2/README.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you need this placeholder for? If it is just for keeping the directory structure, you can add a .gitkeep
file. See https://stackoverflow.com/a/7229996/3778792
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, kind of. It's because we link to it from a markdown folder in docs/
, so if the folder doesn't exist then the markdown link checker complains. But a .gitkeep
file is a better idea.
df5e762
to
a673e11
Compare
This PR adds some skeleton files for the documentation and adds a CI workflow to build them with mdBook and publish to GitHub Pages. I've tested it by manually running the workflow. You can see the results here: https://energysystemsmodellinglab.github.io/MUSE_2.0/
The API documentation is still being published to GitHub Pages too; it's accessible via a link on the main page.
Closes #36.