Skip to content

Commit 485005d

Browse files
authored
Add HTML validator action (#579)
* Add HTML validator action (#1) * Add HTML validator action * Update root to `_site` * Update validate.yml * Update validate.yml * Update validate.yml * Add check-links * Update validate.yml * Add lighthouse and ignores for URLs * Add lighthouse config * Update validate.yml * Hash-pin `html5validator-action` * Try with nox * Set all thresholds to 0.95, correct noxfile * Update names as suggested in review * Add back the checkout step * Revert to building in jekyll container for speed Docker approach is way faster (1 minute vs 6.5 minutes) * Maybe we don't need to copy assets? * Fix some links, ignore netlify-preview from README.md * Fix link check, simplify naming * Add documentation, use absolute links in index * Fix wrong extension for img fallback * Two more places where absolute links needed * Fix jpg -> png in two more places
1 parent b868aeb commit 485005d

File tree

7 files changed

+163
-16
lines changed

7 files changed

+163
-16
lines changed

.github/workflows/lighthouserc.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"staticDistDir": "./_site",
5+
"autodiscoverUrlBlocklist": [
6+
"conduct.html"
7+
],
8+
"settings": {
9+
"skipAudits": ["canonical"]
10+
}
11+
},
12+
"assert": {
13+
"assertions": {
14+
"categories:performance": ["error", { "minScore": 0.95 }],
15+
"categories:accessibility": ["error", { "minScore": 0.95 }],
16+
"categories:best-practices": ["error", { "minScore": 0.95 }],
17+
"categories:seo": ["error", { "minScore": 0.95 }]
18+
}
19+
}
20+
}
21+
}

.github/workflows/validate.yml

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
name: Build Jekyll site for testing
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Build the site in the Jekyll/builder container
23+
run: |
24+
docker run \
25+
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
26+
jekyll/builder:latest /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build --future"
27+
28+
- name: List result of Jekyll build
29+
run: |
30+
ls _site/ -l
31+
ls _site/assets -l
32+
33+
# - name: Copy assets
34+
# run: cp -r assets _site/assets
35+
36+
- name: Publish built site
37+
uses: actions/upload-artifact@v2
38+
with:
39+
name: Built site ${{ github.run_number }}
40+
path: ./_site
41+
if-no-files-found: error
42+
43+
validate:
44+
45+
runs-on: ubuntu-latest
46+
name: Validate HTML
47+
needs: [build]
48+
49+
steps:
50+
- name: Fetch built site
51+
uses: actions/download-artifact@v2
52+
with:
53+
name: Built site ${{ github.run_number }}
54+
path: ./_site
55+
56+
# just to satisfy the `Cyb3r-Jak3/html5validator-action` action
57+
- name: Create dummy git repository
58+
run: git init
59+
60+
- name: HTML5 Validator
61+
uses: Cyb3r-Jak3/html5validator-action@44696509d19bec6bd00e5ebf29bbeda320562aac
62+
with:
63+
root: _site/
64+
65+
check-links:
66+
67+
runs-on: ubuntu-latest
68+
name: Check links
69+
needs: [build]
70+
71+
steps:
72+
- name: Fetch built site
73+
uses: actions/download-artifact@v2
74+
with:
75+
name: Built site ${{ github.run_number }}
76+
path: ./_site
77+
78+
- name: Install link check dependencies
79+
run: pip install pytest-check-links
80+
81+
# TODO: we are not checking absolute links as pytest plugins does not support them
82+
- name: Check links
83+
run: |
84+
pytest _site/ --check-links \
85+
--check-links-ignore "https://.*linkedin.com/.*" \
86+
--check-links-ignore "/" \
87+
--check-links-ignore ".github/images/netlify-preview.png"
88+
89+
lighthouse:
90+
91+
runs-on: ubuntu-latest
92+
name: Audit with Lighthouse
93+
needs: [build]
94+
95+
steps:
96+
- name: Fetch repository for `lighthouserc.json`
97+
uses: actions/checkout@v2
98+
- name: Fetch built site
99+
uses: actions/download-artifact@v2
100+
with:
101+
name: Built site ${{ github.run_number }}
102+
path: ./_site
103+
- name: Audit with Lighthouse
104+
uses: treosh/lighthouse-ci-action@v8
105+
with:
106+
configPath: ".github/workflows/lighthouserc.json"
107+
temporaryPublicStorage: true
108+
uploadArtifacts: true

README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To build and preview the site locally, follow these steps:
2828
3. **Run the `build` command**
2929

3030
```console
31-
$ nox -s build
31+
$ nox -s build-live
3232
```
3333

3434

@@ -141,3 +141,16 @@ For images that are "above the fold" (that will be seen by users immediately aft
141141
```html
142142
<img class="my-class" src="my/src.png" loading="eager" />
143143
```
144+
145+
### Automated quality checks
146+
147+
A workflow on GitHub Actions is run at every push and for every pull request to ensure basic integrity of the website:
148+
- [validating](https://validator.w3.org/docs/help.html#validation_basics) the structure of the HTML using [Nu validator](https://validator.github.io/validator/) to ensure compliance with HTML standards
149+
- checking linked URLs for errors (including expired certificates)
150+
- running [Lighthouse](https://github.com/GoogleChrome/lighthouse) audits to ensure performance, accessibility, SEO optimization and best practices
151+
152+
If pre-defined quality targets are not met, the jobs will fail.
153+
Click on "Details" link for the failing job to see what caused the failure.
154+
155+
The detailed results will be available in the logs (which are only shown to users logged in on GitHub),
156+
including links to full Lighthouse reports on public temporary storage (the links will expire after 7 days).

binder.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ about the deployment. Here are a few useful resources in case you're interested:
103103
information about the BinderHub deployment at mybinder.org
104104
* [The mybinder.org billing repository](https://github.com/jupyterhub/binder-billing) has
105105
information about the cloud cost associated with running mybinder.org
106-
* [The mybinder.org site reliability guide](mybinder-sre.readthedocs.io/) is a resource
106+
* [The mybinder.org site reliability guide](https://mybinder-sre.readthedocs.io/en/latest/) is a resource
107107
for the operations team and the community to share best-practices and information about
108108
running the public BinderHub deployment at mybinder.org
109-
* [The mybinder.org incident reports page](mybinder-sre.readthedocs.io/en/latest/#incident-reports)
109+
* [The mybinder.org incident reports page](https://mybinder-sre.readthedocs.io/en/latest/#incident-reports)
110110
contains a list of incidents that have happened in the public deployment, as well as
111111
steps taken to resolve them.
112112

@@ -123,7 +123,7 @@ to join our community and contribute code, time, comments, or appreciation.
123123
the current members of the JupyterHub and Binder teams.
124124
* [**The JupyterHub Contributing guide**](https://jupyterhub-team-compass.readthedocs.io/en/latest/contributing.html) is
125125
a great place to start learning how you can contribute to the Binder Project.
126-
* [**The Binder Gitter Channel**](https://gitter.im/binder) is where a lot of real-time
126+
* [**The Binder Gitter Channel**](https://gitter.im/jupyterhub/binder) is where a lot of real-time
127127
conversations happen in the Binder community.
128128
* [**The Binder Community Forum**](https://discourse.jupyter.org/c/binder) has a lot of
129129
community interaction and useful information about using, running, and contributing to Binder.

index.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
height: 627
3939
buttons:
4040
- class:
41-
href: try
41+
href: /try
4242
text: Try it in your browser
4343
- class: install-button
44-
href: install
44+
href: /install
4545
text: Install JupyterLab
4646

4747
notebook:
@@ -54,10 +54,10 @@
5454
height: 627
5555
buttons:
5656
- class:
57-
href: try
57+
href: /try
5858
text: Try it in your browser
5959
- class: install-button
60-
href: install
60+
href: /install
6161
text: Install the Notebook
6262
features:
6363
- headline: Language of choice
@@ -112,7 +112,7 @@
112112
alt: icon to represent data
113113
src: assets/data.svg
114114
button:
115-
href: hub
115+
href: /hub
116116
text: Learn more about JupyterHub
117117

118118
voila:
@@ -125,10 +125,10 @@
125125
height: 716
126126
buttons:
127127
- class:
128-
href: try
128+
href: /try
129129
text: Try it in your browser
130130
- class: install-button
131-
href: install
131+
href: /install
132132
text: Install Voilà
133133

134134
open_standards:
@@ -287,7 +287,7 @@ <h4 class="jumbotron-text">{{ page.jumbotron.text }}</h4>
287287
<div class="col-md-6">
288288
<picture>
289289
<source type="image/webp" srcset="{{ page.jupyterlab.image.src }}.webp">
290-
<img src="{{ page.jupyterlab.image.src }}.jpg"
290+
<img src="{{ page.jupyterlab.image.src }}.png"
291291
alt="{{ page.jupyterlab.image.alt }}"
292292
width={{ page.jupyterlab.image.width }}
293293
height={{ page.jupyterlab.image.height }}
@@ -319,7 +319,7 @@ <h4 class="nb-desc">{{ page.jupyterlab.description }}</h4>
319319
<div class="col-md-6">
320320
<picture>
321321
<source type="image/webp" srcset="{{ page.notebook.image.src }}.webp">
322-
<img src="{{ page.notebook.image.src }}.jpg"
322+
<img src="{{ page.notebook.image.src }}.png"
323323
alt="{{ page.notebook.image.alt }}"
324324
width={{ page.notebook.image.width }}
325325
height={{ page.notebook.image.height }}
@@ -397,7 +397,7 @@ <h4>{{ feat.headline }}</h4>
397397
<div class="col-md-6">
398398
<picture>
399399
<source type="image/webp" srcset="{{ page.voila.image.src }}.webp">
400-
<img src="{{ page.voila.image.src }}.jpg"
400+
<img src="{{ page.voila.image.src }}.png"
401401
alt="{{ page.voila.image.alt }}"
402402
width={{ img.width }}
403403
height={{ img.height }}

noxfile.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ def install_deps(session):
1212
session.run(*"bundle install".split())
1313

1414

15+
@nox.session(name="build-live", venv_backend='conda')
16+
def build_live(session):
17+
install_deps(session)
18+
session.run(*"bundle exec jekyll serve liveserve".split())
19+
1520
@nox.session(venv_backend='conda')
1621
def build(session):
1722
install_deps(session)
18-
session.run(*"bundle exec jekyll serve liveserve".split())
23+
session.run(*"bundle exec jekyll build".split())

widgets.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h3>Installation</h3>
323323
</span>
324324
</div>
325325
<p>
326-
<a href="https://BeakerX.com">BeakerX</a> includes widgets
326+
<a href="http://beakerx.com">BeakerX</a> includes widgets
327327
for interactive tables, plots, forms, Apache Spark, and more.
328328
The table widget automatically recognizes pandas dataframes
329329
and allows you to search, sort, drag, filter, format,

0 commit comments

Comments
 (0)