Skip to content

Commit

Permalink
DOCS-1484: Run htmltest on external links weekly
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Mar 12, 2024
1 parent 256618b commit 2d6fde5
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/failed-action-issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Failed htmltest
assignees: npentrel
labels: bug
---

See [the action log](https://github.com/{{ env.GITHUB_ACTION_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }}) for more details.
45 changes: 45 additions & 0 deletions .github/workflows/run-htmltest-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# .github/workflows/run-htmltest.yml
# (c) 2021 Robb Romans
#
# Run htmltest link checker on generated HTML output in dist/
# https://github.com/wjdp/htmltest
#
name: run-htmltest
concurrency:
group: pullrequest-untrusted-htmltest-${{ github.event.number }}
cancel-in-progress: true
jobs:
htmltest:
runs-on: ubuntu-large
container:
image: ghcr.io/viamrobotics/canon:amd64
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes
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: Build
run: make build-dist

- name: Test HTML for local pages
# https://github.com/wjdp/htmltest-action/
# Don't fail the build on broken links
continue-on-error: false
uses: wjdp/htmltest-action@master
with:
# For consistency, use the same config file as for local builds
config: .htmltest-local.yml
- name: Archive htmltest results
uses: actions/upload-artifact@v3
# Note: Set ACTIONS_RUNTIME_TOKEN env variable to test with nektos/act
with:
name: htmltest-report
path: tmp/.htmltest/htmltest.log
retention-days: 7 # Default is 90 days
19 changes: 13 additions & 6 deletions .github/workflows/run-htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# https://github.com/wjdp/htmltest
#
name: run-htmltest
concurrency:
group: pullrequest-untrusted-htmltest-${{ github.event.number }}
cancel-in-progress: true
on: pull_request
on:
schedule:
# weekly
- cron: '0 14 * * 1'
jobs:
htmltest:
runs-on: ubuntu-large
Expand All @@ -29,18 +29,25 @@ jobs:
- name: Build
run: make build-dist

- name: Test HTML
- name: Test HTML for local pages
# https://github.com/wjdp/htmltest-action/
# Don't fail the build on broken links
continue-on-error: false
uses: wjdp/htmltest-action@master
with:
# For consistency, use the same config file as for local builds
config: .htmltest.yml
config: .htmltest-local.yml
- name: Archive htmltest results
uses: actions/upload-artifact@v3
# Note: Set ACTIONS_RUNTIME_TOKEN env variable to test with nektos/act
with:
name: htmltest-report
path: tmp/.htmltest/htmltest.log
retention-days: 7 # Default is 90 days
- name: Create issue about failure
if: failure()
uses: JasonEtco/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/failed-action-issue-template.md
37 changes: 37 additions & 0 deletions .htmltest-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
DirectoryPath: "dist"
EnforceHTTPS: true
IgnoreEmptyHref: true
IgnoreInternalEmptyHash: true
IgnoreDirectoryMissingTrailingSlash: false
IgnoreURLs:
- "example.com"
- "^/misc/js/script.js$"
- "linkedin.com"
- "app.viam.com"
- "beaglebone.local"
- "instagram.com"
- "twitter.com"
- "github.com/viamrobotics/docs"
- "openai.com"
- "espressif.com"
- "pinout.xyz"
- "play.google.com"
- "scuttlerobot.org"
- "numato.com"
- "nvidia.com"
- "slamtec.com"
- "universal-robots.com"
- "digikey.com"
- "ufactory.cc"
- "medium.com"
- "radxa.com"
- "electronics-tutorials.ws"
- "marketplace.visualstudio.com"
- "chrome.google.com"
- "raspberrypi.com"
- "grabcad.com"
IgnoreDirs:
- "lib"
CacheExpires: "6h"
# IgnoreDirs: - if we need to ever ignore files
IgnoreExternalBrokenLinks: true

0 comments on commit 2d6fde5

Please sign in to comment.