Comments (7)
This is of course a bit of an open ended issue 🙂 What I hope for is that someone will look at what mdbook keeper
can do for us:
- can it run our current tests?
- can we use it to run tests with more dependencies?
The goal would be remove the compile_fail
from our code blocks.
If you can get this working locally, then we can work on a updating the GitHub action which runs the tests for us on every PR.
from comprehensive-rust.
I started looking into this. Some issues/notes so far:
- Tests in sub-chapters aren't run (tfpk/mdbook-keeper#2)
- It doesn't seem to understand
{{#include some/file.rs}}
- Output doesn't appear incrementally
- The tests block progress on
mdbook build
andmdbook serve
On my machine, it takes ~3min to run the tests which is pretty rough when I just want to mdbook serve
. I think there's hope, potentially using:
- maybe includes can be fixed via ordering preprocessors
- controlling when it runs, locking to a renderer, possibly with a custom renderer
I intend to work on this some more. In case my work stalls out, or anyone's curious, my keeper branch has the WIP.
from comprehensive-rust.
Thanks @mauvealerts! That's already a very valuable analysis! For example, I had not realized that you run the tests all the time... so we would definitely only enable it on demand like we do for the mdbook-xgettext
renderer.
from comprehensive-rust.
I have something that I'm fairly happy with, when combined with all of these changes to mdbook-keeper
I have things running comparable to mdbook test
. IMO the steps necessary to make a mergable PR are:
- Decide where the skeleton project should go (currently
mdbook-keeper-deps
) - Don't run tests by default for
mdbook serve
-
mdbook-keeper
has released a version with the changes - Prove out the usefulness by testing some snippets
from comprehensive-rust.
Thanks for pushing this!
- Decide where the skeleton project should go (currently
mdbook-keeper-deps
)
I think this should be the root of the repository, or perhaps the src/
folder. We already have a Cargo workspace setup so that cargo check
does something useful for the code in our exercises. I hope we can build on this for the book itself: perhaps we can move up the src/exercises/Cargo.toml
file to src/
and then use its dependencies across the examples?
from comprehensive-rust.
I didn't think it was possible to have both a [workspace]
and (e.g.) a lib in the same Cargo.toml
, but apparently it is. I've updated my branch to just use Cargo.toml
in the root directory, at least for now. I've also locked mdbook-keeper
to the markdown
output format, so it doesn't slow down mdbook serve
I started updating some examples, but ran into link errors (tfpk/mdbook-keeper#9). In particular, not being able to use tokio
on Windows makes me hesitant to migrate the async examples (which was most of what I planned to do).
from comprehensive-rust.
I've also locked
mdbook-keeper
to themarkdown
output format, so it doesn't slow downmdbook serve
Ah, that's a clever work-around 😄 However, it almost suggests that mdbook-keeper
should be a renderer instead of a preprocessor. @tfpk, have you considered that approach?
I started updating some examples, but ran into link errors (tfpk/mdbook-keeper#9). In particular, not being able to use
tokio
on Windows makes me hesitant to migrate the async examples (which was most of what I planned to do).
Oh, I see... I agree that it would be important to have test coverage for all the small code snippets involving Tokio and that was also my main reason to look at mdbook-keeper
🙂
from comprehensive-rust.
Related Issues (20)
- Vietnamese translation
- Pandoc failure when building in GitHub CI HOT 5
- Timing information enters the translations HOT 2
- Mistake in Fibonacci Exercise HOT 5
- Inconsistent text in CR2 HOT 3
- Moving too quickly between pages on the popped-out "speaker notes" window resets to non-notes view HOT 1
- Do not text wrap links HOT 3
- Eliminate horizontal scrolling in rust code blocks HOT 14
- 404 page breaks translations
- Question about "Speaker Notes" in Destructuring page HOT 2
- Error-handling crates slide should be split HOT 1
- Spanish version HOT 1
- Update translation instructions on manipulating `.po` files
- Verify and prune CODEOWNERS list for translations HOT 2
- concurrency: Avoid `1..ROUND_NUMBER` loops HOT 1
- Cannot search for "`From` and `Into`"
- `From` and `Into` slide should emphasize losslessness and infallibility
- `let`...`else` example should demonstrate denesting HOT 1
- syntax: explain that rust pervasively allows separators to be used as terminators
- Call out `Neg` trait in speaker notes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comprehensive-rust.