|
3 | 3 | ## What is CI?
|
4 | 4 |
|
5 | 5 | Continuous Integration (CI) refers to checks and tests that are triggered by
|
6 |
| -events that occur on GitHub such as commit pushes, pull requests, and even |
7 |
| -merges to a GitHub repository. In the pyOpenSci organization, each commit |
8 |
| -triggers at least one or more automated CI workflows. For the [pyOpenSci |
| 6 | +events that occur within a GitHub repository such as pushing a commit, opening a pull request, and |
| 7 | +merging a pull request. In the pyOpenSci organization, each commit that is pushed |
| 8 | +to a GitHub repository triggers at least one or more automated CI workflows. For the [pyOpenSci |
9 | 9 | website repository](https://www.pyopensci.org/) and our online books such as
|
10 |
| -the [Python packaging guidebook that is written using |
11 |
| -Sphinx](https://github.com/pyopensci/python-package-guide), this build will: |
| 10 | +the [Python packaging guidebook](https://github.com/pyopensci/python-package-guide), this build will: |
12 | 11 |
|
13 | 12 | * Build the live rendered version of the online content with any changes added
|
14 | 13 | in the current commit(s) or pull requests.
|
15 |
| -* Check the text for spelling issues, check images for missing alt tags, and |
16 |
| - more. |
| 14 | +* Check the text for spelling issues, |
| 15 | +* Check images for missing alt tags, incorrect image paths and more. |
17 | 16 |
|
18 | 17 | If the repository has code, it will check for code style.
|
19 | 18 |
|
@@ -99,6 +98,73 @@ All of our website repositories have several CI builds, including:
|
99 | 98 | GitHub requires you to download, unzip, and view an archive with the build
|
100 | 99 | site locally.
|
101 | 100 |
|
| 101 | +## pyOpenSci checks for broken links and missing alt tags: HTMLProofer |
| 102 | + |
| 103 | +[HTMLProofer](https://github.com/gjtorikian/html-proofer) is a ruby-based HTML validation tool that checks for: |
| 104 | + |
| 105 | +* correct image references |
| 106 | +* accessibility including alt tags for each image |
| 107 | +* broken links. |
| 108 | + |
| 109 | +For a full list of checks, please refer to the [HTMLProofer documentation](https://github.com/gjtorikian/html-proofer). |
| 110 | + |
| 111 | +The HTMLProofer tool is integrated into all pyOpenSci website GitHub repositories including the core website, the packaging guide, our peer review guide and this handbook that you are reading now. You can view the outputs from HTMLProofer on a pull request, by clicking on the Details section of CI build for each repository. |
| 112 | +For all of our sphinx books, the CI build that you will need to check is called **Build Push github pages / build-book (pull_request)** line. It looks like this: |
| 113 | + |
| 114 | +```{figure} /images/github-images/htmlproofer-pass.png |
| 115 | +:alt: A screenshot of the GitHub CI notifications for a sample pyOpenSci repository. There is a header that reads All checks have passed, with the text 3 successful checks beneath it. To the right side of the header is linked text reading Hide all checks. Below the header are three rows of information. The first row reads Build Push github pages / build-book (pull_request), the second reads ci/circleci: build_book -- Your tests passed on CircleCI!, and the third reads pre-commi.ci - pr -- checks completed successfully. There is a green checkmark next to each line of text. Beneath these rows is the text This branch has no conflicts with the base branch. Merging can be performed automatically. There is also a green Merge pull request button. |
| 116 | + |
| 117 | +A screenshot from a GitHub PR where all checks have passed. |
| 118 | +``` |
| 119 | + |
| 120 | +Once you click on the CI output Details, you'll be taken to the `build-book` jobs screen, which looks like this: |
| 121 | + |
| 122 | +```{figure} /images/github-images/htmlproofer-build-book.png |
| 123 | +:alt: A screenshot of the build-book jobs page in GitHub. There's a white column to the left with the job name and run details, and a large black box to the right with all of the various dropdowns within the build-book job. The htmlproofer dropdown is just over halfway down the page. |
| 124 | + |
| 125 | +A screenshot of the build-book jobs page in GitHub. |
| 126 | +``` |
| 127 | + |
| 128 | +When you expand the htmlproofer line, which reads Check HTML using htmlproofer, you will see the following: |
| 129 | + |
| 130 | +```{figure} /images/github-images/htmlproofer-build-book.png |
| 131 | +:alt: A screenshot of the build-book jobs page in GitHub with htmlproofer expanded. There's a white column to the left with the job name and run details, and a large black box to the right with all of the various dropdowns within the build-book job. The htmlproofer dropdown is just over halfway down the page and expanded to reveal information such as the run details, which checks were run, how many links were checked, whether or not HTMLProofer was successful, and how long the run took. |
| 132 | + |
| 133 | +A screenshot of the build-book jobs page in GitHub with htmlproofer expanded. |
| 134 | +``` |
| 135 | + |
| 136 | +If all of the HTMLProofer checks pass, you won't see any errors. Instead, you will see a bright green checkmark. However, sometimes you may encounter an error. |
| 137 | +Below is an image the shows a CI error associated with the build: |
| 138 | + |
| 139 | +```{figure} /images/github-images/htmlproofer-fail.png |
| 140 | +:alt: A screenshot of the GitHub CI notifications for a sample pyOpenSci repository. There is a header that reads All checks have passed, with the text 3 failing checks beneath it. To the right side of the header is linked text reading Hide all checks. Below the header are three rows of information. The first row reads Build Push github pages / build-book (pull_request), the second reads ci/circleci: build_book -- Your tests failed on CircleCI!, and the third reads pre-commi.ci - pr -- checks completed with failures. There is a red check next to each line of text. Beneath these rows is the text This branch has no conflicts with the base branch. Merging can be performed automatically. There is also a green Merge pull request button. |
| 141 | + |
| 142 | +A screenshot from a GitHub PR where all checks have passed. |
| 143 | +``` |
| 144 | + |
| 145 | +When there is an error in the pyOpenSci CI build, there are a few things to consider. |
| 146 | + |
| 147 | +1. Are the CI errors unrelated to your pull request? pyOpenSci's CI builds run on all the files in the repository by default. Sometimes, a link might become broken simply because the website is down. And that break has nothing to do with your pull request! In that case, pyOpenSci repository maintainers can still merge the pull request, even if there are failed checks. |
| 148 | +2. There are also other CI checks that are happening within each repository in addition to HTML proofer. If more than one build fails, there may be more going on here than just an HTMLProofer error. |
| 149 | + |
| 150 | +Below is an example of a broken build due to HTMLProofer. When you click on the details for the build, you see this: |
| 151 | + |
| 152 | +```{figure} /images/github-images/htmlproofer-error-message.png |
| 153 | +:alt: A screenshot of the build-book jobs page in GitHub with htmlproofer expanded. There's a white column to the left with the job name and run details with a large red X next to build-book, and a large black box to the right with all of the various dropdowns within the build-book job. The htmlproofer dropdown has a red X next to it, and is just over halfway down the page. When expanded, it reveals information such as the run details, which checks were run, how many links were checked, whether or not HTMLProofer was successful, and how long the run took. |
| 154 | + |
| 155 | +A screenshot of the build-book jobs page in GitHub with htmlproofer expanded. |
| 156 | +``` |
| 157 | + |
| 158 | +In this case, HTMLProofer told you that none of the images submitted with this PR could be found. In this case you should go back and double check that the images are in the correct folder and that their paths' are correct. In this case, the author forgot the leading forward slash in the image paths. |
| 159 | + |
| 160 | +If you see a broken HTMLProofer build, you can continue to make updates to the pull request either locally or through inline comments, until no |
| 161 | +errors are returned by HTMLProofer. Once you have a green check next to the build, it's time to submit your pull request for review! |
| 162 | + |
| 163 | +:::{note} |
| 164 | +In some cases you may be unsure as to why HTMLProofer or any part of our pyOpenSci CI checks are failing. In these cases, feel free to ping a pyOpenSci |
| 165 | +repository maintainer for help. We understand that Continuous Integration (CI) can be confusing to navigate, even for seasoned GitHub users. |
| 166 | +::: |
| 167 | + |
102 | 168 | (pre-commit-ci)=
|
103 | 169 | ## About the Pre-Commit CI Bot
|
104 | 170 |
|
|
0 commit comments