Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Deny warning when building doc #10387

Merged
merged 5 commits into from
Dec 15, 2021
Merged

Deny warning when building doc #10387

merged 5 commits into from
Dec 15, 2021

Conversation

gui1117
Copy link
Contributor

@gui1117 gui1117 commented Nov 29, 2021

This make the CI deny for warning when building the doc. So we can catch dead link and especially dead link in rust doc when linking to types.

But I think this current PR is wrong because it will also deny warning on dependencies which can be annoying in case some of our dependence have warnings.

Maybe we should have both:

RUSTDOCFLAGS="-Dwarnings" time cargo +nightly doc --workspace --all-features --verbose --no-deps
time cargo +nightly doc --workspace --all-features --verbose

Or maybe have 2 different job ?
Is there some good solution ?

cc @TriplEight

@gui1117 gui1117 requested a review from a team as a code owner November 29, 2021 08:28
@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Nov 29, 2021
@alvicsam
Copy link
Contributor

We can have 2 different jobs. During PR pipeline we can use the one with RUSTDOCFLAGS="-Dwarnings" so developer can see that the check failed. And during master pipeline use the one without flag so not to break pipeline.

@gui1117
Copy link
Contributor Author

gui1117 commented Nov 30, 2021

I don't know when the master pipelin is run instead of PR pipeline, but for me any solution which ensures that the docs for the crate in the workspace are without warning would be great.
All in all what I want to ensure is:

RUSTDOCFLAGS="-Dwarnings" time cargo +nightly doc --workspace --all-features --verbose --no-deps

Because I don't want to check the doc of the dependencies, only the doc of our crates here in substrate.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

We should make sure all doc links are valid at all times 💯

@gui1117
Copy link
Contributor Author

gui1117 commented Nov 30, 2021

We should make sure all doc links are valid at all times 100

but we don't control the doc of our dependency, there might be some time where their doc is broken and we need to update to their new version, that can be annoying if our CI doesn't allow our dependency to have doc with warnings.

@kianenigma
Copy link
Contributor

We should make sure all doc links are valid at all times 100

but we don't control the doc of our dependency, there might be some time where their doc is broken and we need to update to their new version, that can be annoying if our CI doesn't allow our dependency to have doc with warnings.

Okay, I mean everything in our repo if possible.

@gui1117 gui1117 added A1-onice A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. and removed A0-please_review Pull request needs code review. A1-onice labels Dec 3, 2021
@stale stale bot removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Dec 3, 2021
@gui1117
Copy link
Contributor Author

gui1117 commented Dec 3, 2021

@alvicsam I have no idea how to implement something for the master pipeline/ PR pipeline.

@alvicsam
Copy link
Contributor

alvicsam commented Dec 3, 2021

@thiolliere I can help you with that but I don't understand how it should work.

Currently this job (build-rustdoc ) runs on both PR and master pipelines. With this PR the master pipeline will fail.
So my assumption was to keep this the build-rustdoc task with RUSTDOCFLAGS="-Dwarnings" so developer can see that this step fails and docs have some issues. And create another task build-rustdoc-master (the name is just an example) for master without RUSTDOCFLAGS="-Dwarnings" in order not to break the whole pipeline because of the docs.

Otherwise we can mark continuous-integration/gitlab-build-rustdoc in github as Required and a PR cannot be merge until docs are fixed. But I don't know what should a developer do if there is an issue that you described:

but we don't control the doc of our dependency, there might be some time where their doc is broken and we need to update to their new version, that can be annoying if our CI doesn't allow our dependency to have doc with warnings.

@gui1117
Copy link
Contributor Author

gui1117 commented Dec 7, 2021

or maybe we can also have 2 jobs:

  • one required, which does RUSTDOCFLAGS="-Dwarnings" but doesn't build doc for deps with --no-deps
  • another job, not required, which builds the whole doc without denying warnings and without excluding deps.

The only issue I see is that it makes the CI even longer

@gui1117 gui1117 requested a review from adoerr as a code owner December 7, 2021 09:26
@gui1117 gui1117 added A0-please_review Pull request needs code review. and removed A4-gotissues labels Dec 7, 2021
@gui1117
Copy link
Contributor Author

gui1117 commented Dec 7, 2021

So I added the new job, which is meant to be mandatory, and kept the doc generation unchanged.

It seems ok to me

EDIT: I also fixed the doc or removed the link that can't be fixed

@gui1117 gui1117 added B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Dec 7, 2021
@alvicsam
Copy link
Contributor

alvicsam commented Dec 7, 2021

LGTM

The only issue I see is that it makes the CI even longer

Actually it doesn't. The check-rustdoc job is quick as I can see and at the same stage there is test-linux-stable job which is way longer (jobs in one stage run simultaneously)

@TriplEight can you please mark check-rustdoc as "Required"?

@TriplEight
Copy link
Contributor

So it turns out that we'll have two jobs:

check-rustdoc:
  ...
  - RUSTDOCFLAGS="-Dwarnings" time cargo +nightly doc --workspace --all-features --verbose

and

build-rustdoc:
  ...
  - time cargo +nightly doc --workspace --all-features --verbose --no-deps

Both running on PRs and master.
Two questions: why do we care checking while failing on warnings, but with deps. And building rustdocs for publishing without deps? Is there some cargo doc workaround or we can just have one job as one in chech-rustdoc now?

@gui1117
Copy link
Contributor Author

gui1117 commented Dec 8, 2021

So it turns out that we'll have two jobs:

check-rustdoc:
  ...
  - RUSTDOCFLAGS="-Dwarnings" time cargo +nightly doc --workspace --all-features --verbose

and

build-rustdoc:
  ...
  - time cargo +nightly doc --workspace --all-features --verbose --no-deps

Both running on PRs and master. Two questions: why do we care checking while failing on warnings, but with deps. And building rustdocs for publishing without deps? Is there some cargo doc workaround or we can just have one job as one in chech-rustdoc now?

no the jobs should be:

check-rustdoc:
  ...
  - RUSTDOCFLAGS="-Dwarnings" time cargo +nightly doc --workspace --all-features --verbose --no-deps

and

build-rustdoc:
  ...
  - time cargo +nightly doc --workspace --all-features --verbose
  ... publish docs

So we check docs while failing on warnings but without deps (because we don't want to check our deps, we only want to check our own doc). this job should be required, our doc should always build without warning.

We build the docs while with deps without failing on warnings (this is because we want to publish all the docs in one place, it makes it easier to walk through all docs)

@TriplEight
Copy link
Contributor

Now it makes sense

@TriplEight TriplEight merged commit 1306573 into master Dec 15, 2021
@TriplEight TriplEight deleted the gui-doc-deny-warning branch December 15, 2021 19:28
seunlanlege pushed a commit to seunlanlege/substrate that referenced this pull request Dec 17, 2021
* deny warning

* add new job

* fix doc

* fmt
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* deny warning

* add new job

* fix doc

* fmt
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* deny warning

* add new job

* fix doc

* fmt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants