privacyguides.org/.github/workflows/tests.yml
dependabot[bot] 1d8bff0090
Bump untitaker/hyperlink from 0.1.20 to 0.1.21 (#587)
Bumps [untitaker/hyperlink](https://github.com/untitaker/hyperlink) from 0.1.20 to 0.1.21.
- [Release notes](https://github.com/untitaker/hyperlink/releases)
- [Commits](https://github.com/untitaker/hyperlink/compare/0.1.20...0.1.21)

---
updated-dependencies:
- dependency-name: untitaker/hyperlink
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-30 23:21:47 -05:00

239 lines
7.5 KiB
YAML

name: Code tests
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
jobs:
deps:
name: "Dependency Install"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- run: tar cvf node_modules.tar node_modules
- name: Upload node_modules for Jekyll build
uses: actions/upload-artifact@v2
with:
name: node_modules
path: node_modules.tar
build:
name: "Jekyll Build"
runs-on: ubuntu-latest
needs: deps
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Set Date and Time
run: |
sed -i "s/^ date:.*$/ date: $(TZ=UTC date "+%Y-%m-%d")/" _config.yml
sed -i "s/^ time:.*$/ time: $(TZ=UTC date "+%H:%M:%S %Z")/" _config.yml
- name: Download node_modules
uses: actions/download-artifact@v2
with:
name: node_modules
- run: tar xvf node_modules.tar
- name: Generate Website
run: npm run build
- run: tar cvf site.tar _site
- name: Upload generated Jekyll site
uses: actions/upload-artifact@v2
with:
name: generated-site
path: site.tar
link:
name: "Broken Hyperlinks (Internal)"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Copy built site to production
run: |
mv ${{ github.workspace }}/_site /tmp/
mkdir -p /tmp/src
mv ${{ github.workspace }}/* /tmp/src/
mkdir -p ${{ github.workspace }}/src
mv /tmp/src/* ${{ github.workspace }}/src/
mv /tmp/_site ${{ github.workspace }}/
- name: Internal link checker
uses: untitaker/hyperlink@0.1.21
with:
args: _site/ --sources src/
extlink:
name: "Broken Hyperlinks (External)"
runs-on: ubuntu-latest
needs: [build, link]
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Cache HTMLProofer
id: cache-htmlproofer
uses: actions/cache@v2
with:
path: tmp/.htmlproofer
key: ${{ runner.os }}-htmlproofer-${{ hashFiles('_site/**.html') }}
restore-keys: |
${{ runner.os }}-htmlproofer-
${{ runner.os }}-htmlproofer
- name: Check External Links (Informational, Soft-Fail)
uses: chabad360/htmlproofer@v1.1
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --external_only --internal-domains privacyguides.org,www.privacyguides.org --timeframe 30d --url-ignore '/https:\/\/developers\.cloudflare\.com\//,/https:\/\/github\.com\/privacyguides\/privacyguides\.org\/(edit|tree|blob)\/main/,/https:\/\/support\.(startmail|yubico)\.com\//'
continue-on-error: true
https:
name: "Require HTTPS Internal Images"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Check Images
uses: chabad360/htmlproofer@v1.1
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-img-http --internal-domains privacyguides.org,www.privacyguides.org --disable-external --checks-to-ignore LinkCheck,ScriptCheck
scripts:
name: "Script Reference Checks"
runs-on: ubuntu-latest
needs: [build, link]
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Check HTML
uses: chabad360/htmlproofer@v1.1
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --check-sri --report-script-embeds --internal-domains privacyguides.org,www.privacyguides.org --checks-to-ignore LinkCheck,ImageCheck,HtmlCheck
tags:
name: "HTML Tag Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Validate HTML
uses: chabad360/htmlproofer@v1.1
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --allow-hash-href --internal-domains privacyguides.org,www.privacyguides.org --report-invalid-tags --report-eof-tags --report-mismatched-tags --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck
entity:
name: "HTML Entity Names Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Validate HTML
uses: chabad360/htmlproofer@v1.1
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --allow-hash-href --internal-domains privacyguides.org,www.privacyguides.org --report-missing-names --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck
misc:
name: "Misc HTML Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Validate HTML
uses: chabad360/htmlproofer@v1.1
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --internal-domains privacyguides.org,www.privacyguides.org --report-missing-doctype --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck
opengraph:
name: "OpenGraph Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Check OpenGraph
uses: chabad360/htmlproofer@v1.1
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --disable-external --check-opengraph --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck