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

ci: check internal links in mdbook after build #3015

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

not-my-profile
Copy link
Collaborator

@not-my-profile not-my-profile commented Jul 22, 2023

We already run markdown-link-check in our CI, however by virtue of it running against .md files it cannot detect links that are broken due to mdbook-specifics (such as forgetting to list the .md file in SUMMARY.md or the README.md bug). I already fixed 5 such broken links in #3017 and #2990 ... we should really detect these broken links in the CI.

This PR therefore adds a new link-check-book job to our CI that builds the mdbook and then checks the generated HTML for broken links with the hyperlink link checker.

@not-my-profile not-my-profile force-pushed the ci-hyperlink branch 7 times, most recently from 43c774e to 886ceef Compare July 22, 2023 07:11
I want to introduce another link checking job that works on the HTML
output, so I am renaming our existing link check job to disambiguate it.
@@ -92,7 +92,7 @@ jobs:
# Check out `test-all.yaml` for more ideas on organizing these.
if: always()
needs:
Copy link
Collaborator Author

@not-my-profile not-my-profile Jul 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to include the new check-links-book job under check-ok-to-merge.needs ... however I guess then we could no longer use on.pull_request.paths in the new workflow file? And would probably have to do something like what's described in this blog post?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, unfortunately I'm not sure it's easy to do this...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw what you did here — nice! I had seen this action before, but hadn't tried it out yet. Looks good; we could think about extending to more places if it turns out well.

Copy link
Member

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

- name: Build the mdbook
run: mdbook build web/book/

- name: Check links
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option would be to add this to the existing workflow, or to call the existing workflow as part of this. But no strong view.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though possibly moving the job into build-web.yaml would be a reasonable consolidation — it would run slightly too often, but not by much.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am planning on linking relevant pages of the book from doc comments in prql_ast in the future ... at which point I want to expand this CI job to check these links as well ... so I think it would be best to keep these separate since they have different path requirements and do largely different things.

@not-my-profile not-my-profile merged commit 0224b6e into PRQL:main Jul 24, 2023
61 of 63 checks passed
- name: Cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: 0.8.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, prefix-key should be updated by the Cargo.toml.

# Replace the cache key, since the caches seem to accumulate cruft over time;
# ref https://github.com/PRQL/prql/pull/2407 (and there's no GHA variable that
# contains the current version unfortunately).
[[package.metadata.release.pre-release-replacements]]
exactly = 1
file = "../.github/workflows/build-web.yaml"
replace = 'prefix-key: {{version}}'
search = 'prefix-key: [\d.]+'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, missed that, thanks @eitsupi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants