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

Markdown link check in CI #2543

Merged
merged 15 commits into from
Sep 12, 2019
Merged

Markdown link check in CI #2543

merged 15 commits into from
Sep 12, 2019

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Sep 11, 2019

Enable markdown link checking in CI.

This should have been easy, but

This means we can't use language: node in pre-commit, and installing npm on a python container in CircleCI didn't seem to work. So what we're left with is:

  • Add a new hook in the pre-commit config to run the check. This only runs manually (i.e. not on commit or during normal CI checks).
  • Add a new job in CircleCI workflow to run a node container, install the checker, and run just that stage manually.

# markdown-link-check doesn't support multiple files on the commandline, so this hacks around that.
# Note that you must install the package separately via npm. For example:
# brew install npm; npm install -g markdown-link-check
entry: bash -xc 'echo "$@" | xargs -n1 -t markdown-link-check -c markdown-link-check.config.json' --
Copy link
Contributor Author

Choose a reason for hiding this comment

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

language: system
types: [markdown]
# Don't check localized files since their target might not be localized.
exclude: ".*localized.*"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be controversial - if a localized file tries to link to something that hasn't been translated, what should we do? We could link to the english version, but that might be bad for the user. Currently we allow the dead links but we can change them if we really want.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right now for the localized file, if some doc hasn't been translated, we link them to the english version and try to avoid dead links.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, let's get this merged first, then fix that in a subsequent PR

@chriselion chriselion changed the title Develop link check xargs Markdown link check in CI Sep 12, 2019

markdown_link_check:
docker:
- image: circleci/node:12.6.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we running this check in a separate docker image, and in a separate job (1. build and test 2. markdown_link_check) instead of in the same docker image in the same job?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned in the PR description

and installing npm on a python container in CircleCI didn't seem to work.

I'll give it another try though (unfortunately it's a lot of trial and error, as you can tell by the number of commits on this PR)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah sorry I missed that part. In that case I think two jobs is fine. (No need to spend your time getting it to work within one job. )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried again in #2547 but installation doesn't worth without sudo, and then node cant' find the file when running.

At this point I'd rather just rewrite the link check in python so we have more control over it, and run it directly from pre-commit. But I think the current approach will work fine for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good [thumb up]

@chriselion chriselion merged commit 884a662 into develop Sep 12, 2019
@chriselion chriselion deleted the develop-link-check-xargs branch September 12, 2019 22:15
surfnerd pushed a commit that referenced this pull request Sep 12, 2019
* check using xargs

* fix broken BC link

* install npm, run precommit before unit tests

* try to install npm

* try a node image build

* add workflow

* don't use precommit on node run

* sudo make me a sandwich

* pass config arg

* revert CI order change

* retry precommit

* sudo apt-get

* sudo npm

* make sure fails on bad link

* cleanup and refix link
Copy link

@mmattar mmattar left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants