-
Notifications
You must be signed in to change notification settings - Fork 962
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
Add documentation build and links checking in CI. #1145
Conversation
45ee2dc
to
b2b19f1
Compare
Hum, seems like this is suffering from #1056. I think I'm gonna add a couple of retries to try to avoid link checking issue. Maybe not the best solution but better than nothing. |
azure-pipelines.yml
Outdated
- script: | | ||
cd docs && ..\target\debug\zola check | ||
condition: eq( variables['Agent.OS'], 'Windows_NT' ) | ||
displayName: Check documentation links windows |
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.
That's no good, it would block the release of Zola if there is a dead link. I would be tempted to move zola check
to GH actions actually.
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.
Hello @Keats, in fact that was the intention. 😄
To not pass the CI process if for any reason the documentation was broken or of boken links was introduced (Like the ones I corrected). Also it would check this on a regular basis and avoid documentation to deviate and keep it completely updated.
I like to put all checks in the CI, but if you think it annoying I can remove them from this PR.
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.
It's a good instinct but the link checker is not robust yet so that could cause me to comment out these lines in anger if I want to do a release and it's failing for whatever reason
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.
So I comment out the link check part.
I introduced nb_threads_per_cpu to configure the link_checker number of threads. As reducing the number of threads looks more stable at least on AzureDevOps. Maybe because there is some kind of limitation to traffic and especially number of simultaneous connections outgoing from AzureDevOps to avoid DDOS.
# skip_anchor_prefixes = [ | ||
# "https://caniuse.com/", | ||
# ] | ||
|
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's the reason for that change?
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.
In fact I did a configuration documentation copy / paste.
[link_checker]
# Skip link checking for external URLs that start with these prefixes
skip_prefixes = [
"http://127.0.0.1",
]
# Skip anchor checking for external URLs that start with these prefixes
# skip_anchor_prefixes = [
# "https://caniuse.com/",
# ]
I wanted to avoid broken links errors with http://127.0.0.1
(there are a several errors in the documentation), but so far I don't have to use the "anchors skip part". So I commented it out.
- Ensure documentation can be built. - Check documentation links are valid.
- Try to see if it is more stable with less thread especially on systems with few ressources.
- nb_threads_per_cpu define the number of thread per cpu the link_checker will use to check links. Example : if your system is 2 cpus and nb_threads_per_cpu = 6 you will get 6 * 2 = 12 threads to check links. - nb_threads_per_cpu default to 4.
f92886d
to
0e6e7fc
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.
Overall I like the build on CI but not sure about the rest. We can definitely lower the number of threads for the link checker though, in a more static way for now.
- script: | | ||
cd docs && ..\target\debug\zola build | ||
condition: eq( variables['Agent.OS'], 'Windows_NT' ) | ||
displayName: Check documentation build windows |
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 like that!
@@ -7,10 +7,15 @@ pub struct LinkChecker { | |||
pub skip_prefixes: Vec<String>, | |||
/// Skip anchor checking for these URL prefixes | |||
pub skip_anchor_prefixes: Vec<String>, | |||
pub nb_threads_per_cpu: usize, |
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 don't think this should be configurable. Let's keep it at 4 for now and we'll see for configuration later on.
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.
So I come back to the static version
components/site/src/link_checking.rs
Outdated
"Number of cpus: {}, using {} threads", | ||
num_cpus::get(), | ||
num_cpus::get() * nb_threads_per_cpu | ||
); |
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.
we don't want to print that
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 have removed it.
|
||
This theme places content first by tucking away navigation in a hidden drawer. | ||
|
||
* Built for [Zola](https://www.getzola.com) | ||
* Built for [Zola](https://www.getzola.org) |
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.
Those are generated by the https://github.com/getzola/themes repo, fixing it here will not prevent more bad permalinks on the next update.
Sanity check:
Code changes
(Delete or ignore this section for documentation changes)
next
branch?If the change is a new feature or adding to/changing an existing one:
Explanations:
@Keats, you told me in a comment that it was something you wanted to add to the CI. I did it as I could handle it and let you manage more complex stuffs.
zola build
andzola check
to ensure documentation can be built and does not contain invalid links.Maybe I would have to open this PR on the master branch ? Let me know if you would rather this PR on the master branch.