Skip to content

Fix HTML linting issues #4

Fix HTML linting issues

Fix HTML linting issues #4

name: Build and Deploy
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
run: bundle exec jekyll build
env:
JEKYLL_ENV: production
- name: Check links with HTMLProofer
run: |
gem install html-proofer -v 5.2.1 -N
htmlproofer ./_site --disable-external --allow-hash-href --assume-extension .html
- name: Validate HTML with html-validate
run: npx --yes html-validate@8.24.1 "_site/**/*.html"
- name: Lint Markdown
run: npx --yes markdownlint-cli2
- name: Run Lighthouse accessibility audit
run: |
python3 -m http.server 4000 --directory ./_site >/tmp/riffpointer-site.log 2>&1 &
server_pid=$!
trap 'kill $server_pid' EXIT
sleep 5
mkdir -p .lighthouseci
npx --yes lighthouse http://127.0.0.1:4000/ --only-categories=accessibility --chrome-flags="--headless --no-sandbox" --output=json --output-path=.lighthouseci/home.json
npx --yes lighthouse http://127.0.0.1:4000/about/ --only-categories=accessibility --chrome-flags="--headless --no-sandbox" --output=json --output-path=.lighthouseci/about.json
npx --yes lighthouse http://127.0.0.1:4000/projects/ --only-categories=accessibility --chrome-flags="--headless --no-sandbox" --output=json --output-path=.lighthouseci/projects.json
npx --yes lighthouse http://127.0.0.1:4000/resources/ --only-categories=accessibility --chrome-flags="--headless --no-sandbox" --output=json --output-path=.lighthouseci/resources.json
node -e "const fs=require('fs'); const files=['home','about','projects','resources']; for (const name of files) { const file='.lighthouseci/' + name + '.json'; const score=JSON.parse(fs.readFileSync(file, 'utf8')).categories.accessibility.score; if (score < 0.9) throw new Error(file + ' accessibility score ' + score); }"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4