Skip to content

Commit

Permalink
Adding GitHub action for link check of user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
deining committed Feb 24, 2023
1 parent 46f2011 commit c1afc48
Show file tree
Hide file tree
Showing 9 changed files with 5,119 additions and 7 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/htmltest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# .github/workflows/htmltest.yml
# Run htmltest link checker on generated HTML output from user guide

name: Link check with htmltest

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

jobs:
htmltest:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Set up Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "latest"
extended: true

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.14.2'
cache: 'npm'
# The action defaults to search for the dependency file (package-lock.json,
# npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its
# hash as a part of the cache key.
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
cache-dependency-path: '**/package-lock.json'

# - run: npm --prefix=userguide --include=dev ci
- run: npm install postcss postcss-cli autoprefixer
- run: hugo --source userguide --destination $GITHUB_WORKSPACE/userguide/public --themesDir ../../ --theme docsy

- name: Test HTML
# https://github.com/wjdp/htmltest-action/
continue-on-error: false # <- Set to true if run shouldn't fail with broken links
uses: wjdp/htmltest-action@master
with:
# For consistency, use the same config file as for local builds
config: userguide/.htmltest.yml
path: userguide/public

- name: Archive htmltest results
uses: actions/upload-artifact@v3
with:
name: htmltest-report
path: tmp/.htmltest/htmltest.log
retention-days: 7 # default is 90 days
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules/
package-lock.json

# Hugo
.hugo_build.lock
Expand Down
1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ publish = "userguide/public"
command = "npm run docs-install && npm run build:preview"

[build.environment]
NODE_VERSION = "18.14.2"
GO_VERSION = "1.19.5"
HUGO_THEME = "repo"

Expand Down

0 comments on commit c1afc48

Please sign in to comment.