-
Notifications
You must be signed in to change notification settings - Fork 182
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
Add HTML validator action #579
Merged
Merged
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
300c028
Add HTML validator action (#1)
krassowski 52a7964
Hash-pin `html5validator-action`
krassowski 366e00d
Try with nox
krassowski 4dee8f5
Set all thresholds to 0.95, correct noxfile
krassowski d7f3474
Update names as suggested in review
krassowski 1621100
Add back the checkout step
krassowski 6b84d67
Revert to building in jekyll container for speed
krassowski 1e77c7d
Maybe we don't need to copy assets?
krassowski dcd0d7f
Fix some links, ignore netlify-preview from README.md
krassowski b501e41
Fix link check, simplify naming
krassowski e62e6b0
Add documentation, use absolute links in index
krassowski 2ec8a19
Fix wrong extension for img fallback
krassowski 0f200aa
Two more places where absolute links needed
krassowski b84786c
Fix jpg -> png in two more places
krassowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"ci": { | ||
"collect": { | ||
"staticDistDir": "./_site", | ||
"autodiscoverUrlBlocklist": [ | ||
"conduct.html" | ||
], | ||
"settings": { | ||
"skipAudits": ["canonical"] | ||
} | ||
}, | ||
"assert": { | ||
"assertions": { | ||
"categories:performance": ["error", { "minScore": 0.95 }], | ||
"categories:accessibility": ["error", { "minScore": 0.95 }], | ||
"categories:best-practices": ["error", { "minScore": 0.95 }], | ||
"categories:seo": ["error", { "minScore": 0.95 }] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Test website | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build Jekyll site for testing | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build the site in the Jekyll/builder container | ||
run: | | ||
pip install nox | ||
nox -s build_no_serve | ||
|
||
- name: List result of Jekyll build | ||
run: ls _site/ -l | ||
|
||
- name: Copy assets | ||
run: cp -r assets _site/assets | ||
|
||
- name: Publish built site | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Built site ${{ github.run_number }} | ||
path: ./_site | ||
if-no-files-found: error | ||
|
||
validate: | ||
|
||
runs-on: ubuntu-latest | ||
name: Validate HTML | ||
needs: [build] | ||
|
||
steps: | ||
- name: Fetch built site | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Built site ${{ github.run_number }} | ||
path: ./_site | ||
|
||
# just to satisfy the `Cyb3r-Jak3/html5validator-action` action | ||
- name: Create dummy git repository | ||
run: git init | ||
|
||
- name: HTML5 Validator | ||
uses: Cyb3r-Jak3/html5validator-action@44696509d19bec6bd00e5ebf29bbeda320562aac | ||
with: | ||
root: _site/ | ||
|
||
check-links: | ||
|
||
runs-on: ubuntu-latest | ||
name: Check links | ||
needs: [build] | ||
|
||
steps: | ||
- name: Fetch built site | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Built site ${{ github.run_number }} | ||
path: ./_site | ||
|
||
# TODO: we are not checking absolute links as pytest plugins does not support them | ||
- name: Check links | ||
run: | | ||
pip install pytest-check-links | ||
pytest _site/ --check-links --check-links-ignore "https://.*linkedin.com/.*" --check-links-ignore "/" | ||
|
||
lighthouse: | ||
|
||
runs-on: ubuntu-latest | ||
name: Check quality with Lighthouse | ||
needs: [build] | ||
|
||
steps: | ||
- name: Fetch built site | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Built site ${{ github.run_number }} | ||
path: ./_site | ||
- name: Audit with Lighthouse | ||
uses: treosh/lighthouse-ci-action@v8 | ||
with: | ||
configPath: ".github/workflows/lighthouserc.json" | ||
temporaryPublicStorage: true | ||
uploadArtifacts: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a comment somewhere just saying what we mean by "validate"? e.g., are we just doing some kind of basic integrity check? And would this not be captured by lighthouse already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of them overlap (like
alt
meta tags for images, but others are not caught by Lighthouse).By validate we mean run though W3C-sanctioned HTML integrity validator. In this case we use https://github.com/validator (https://validator.github.io/validator/) backend "Nu". It is featured on W3C: https://validator.w3.org/nu/ and https://validator.w3.org/docs/help.html#validation_basics describes what validation means to them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then maybe we could just add a comment like
# See https://validator.w3.org/docs/help.html#validation_basics for more information
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added link to that to README in e62e6b0