unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
359 stars 157 forks source link

Run linkcheck on 'release' PR workflow #2332

Closed cosenal closed 5 months ago

cosenal commented 5 months ago

Fixes #2283 as agreed in Mitiq community call on April 26, 2024.

Description

Linkcheck was disabled in #2287, because it was making every pull request (PR) build fail with false errors. Some websites (e.g., doi.org) have bot-preventive measures for which they return 4xx errors when a request is made. In this PR we ignore those websites, on the assumption that we trust their links are not going to break.

Some false errors may still occurr, so we decided to do a linkcheck pass only on 'release' PRs.

How do you detect a 'release' PR?

We check whether the word 'release' is in the PR title (case-insensitive). This will have some false positives (just like this PR itself ๐Ÿ˜ ), but it should have no false negatives, see this search on past release PRs. On false positives we just run make linkcheck superfluously, not a big deal.

Bonus

I fixed some linkcheck warning by explicitly replacing links that have been redirected since the time they were added to our docs.

Testing

The new step was tested locally with

act pull_request -e act_event.json --container-architecture linux/amd64 -j docs

where act_event.json is a file with content

{
  "pull_request": {
    "title": "this is a relEAse PR"
  }
}
codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.22%. Comparing base (ccb9ff6) to head (c3a9474).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2332 +/- ## ========================================== + Coverage 98.19% 98.22% +0.02% ========================================== Files 87 87 Lines 4052 4052 ========================================== + Hits 3979 3980 +1 + Misses 73 72 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

purva-thakre commented 5 months ago

I think you should add the details from How do you detect a 'release' PR? in your PR description to this section of the docs.

cosenal commented 5 months ago

I think you should add the details from How do you detect a 'release' PR? in your PR description to this section of the docs.

@purva-thakre Yes, good idea

cosenal commented 5 months ago

@purva-thakre comment addressed, PTAL

cosenal commented 5 months ago

You can see this in action now! https://github.com/unitaryfund/mitiq/actions/runs/8899188557/job/24437953232?pr=2338 ๐ŸŽ‰ well.. linkcheck fails, but the change from this PR is working :)