From 2d6fde58b2c68b6016ef608ff92708039d4a9d6e Mon Sep 17 00:00:00 2001 From: Naomi Pentrel <5212232+npentrel@users.noreply.github.com> Date: Tue, 12 Mar 2024 21:50:40 +0100 Subject: [PATCH] DOCS-1484: Run htmltest on external links weekly --- .github/failed-action-issue-template.md | 7 ++++ .github/workflows/run-htmltest-local.yml | 45 ++++++++++++++++++++++++ .github/workflows/run-htmltest.yml | 19 ++++++---- .htmltest-local.yml | 37 +++++++++++++++++++ 4 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 .github/failed-action-issue-template.md create mode 100644 .github/workflows/run-htmltest-local.yml create mode 100644 .htmltest-local.yml diff --git a/.github/failed-action-issue-template.md b/.github/failed-action-issue-template.md new file mode 100644 index 00000000000..37d6b55c7e6 --- /dev/null +++ b/.github/failed-action-issue-template.md @@ -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. diff --git a/.github/workflows/run-htmltest-local.yml b/.github/workflows/run-htmltest-local.yml new file mode 100644 index 00000000000..964af409f43 --- /dev/null +++ b/.github/workflows/run-htmltest-local.yml @@ -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 diff --git a/.github/workflows/run-htmltest.yml b/.github/workflows/run-htmltest.yml index e10f583f269..4722c8544a3 100644 --- a/.github/workflows/run-htmltest.yml +++ b/.github/workflows/run-htmltest.yml @@ -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 @@ -29,14 +29,14 @@ 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 @@ -44,3 +44,10 @@ jobs: name: htmltest-report path: tmp/.htmltest/htmltest.log retention-days: 7 # Default is 90 days + - name: Create issue about failure + if: failure() + uses: JasonEtco/create-an-issue@v2.5.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: .github/failed-action-issue-template.md \ No newline at end of file diff --git a/.htmltest-local.yml b/.htmltest-local.yml new file mode 100644 index 00000000000..01dfc03a321 --- /dev/null +++ b/.htmltest-local.yml @@ -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 \ No newline at end of file