Skip to content

Add HTML validator action #1

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

Merged
merged 10 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ci": {
"url": ["http://localhost/", "http://localhost/install", "http://localhost/about", "http://localhost/community"],
"collect": {
"staticDistDir": "./_site"
}
}
}
101 changes: 101 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
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: |
docker run \
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
jekyll/builder:latest /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build --future"

- name: List result of Jekyll build
run: ls _site/ -l

- 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@v7.0.0
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

- name: Copy assets
run: cp -r assets _site/assets

# 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 repository
uses: actions/checkout@v2
- 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