Skip to content

Commit

Permalink
Add nighlty link checks per #366
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones-plip committed Apr 27, 2022
1 parent f4993b5 commit 1ada6a2
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/scripts/muffet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

muffet http://localhost:1313 \
--buffer-size 50000 \
--timeout 35 \
--timeout 10 \
--concurrency 2 \
--ignore-fragments \
--exclude ".*demo\.app\.medicmobile\.org.*" \
Expand All @@ -27,5 +27,7 @@ muffet http://localhost:1313 \
--exclude "https://github\.com/medic/cht-docs/commit.*" \
--exclude "https://github\.com/medic/cht-core/commit.*" \
--exclude "https://github\.com/medic/cht-docs/edit/master/.*" \
--exclude ".*localhost:5984.*" \
--exclude "https://docs.google.com/spreadsheets/d/12345ABCDEF/edit#gid=555666888"
--exclude "http[s]*://localhost[8443|5984]*" \
--exclude "http[s]*://cht\.domain\.com.*" \
--exclude "http[s]*://127\.0\.0*" \
--exclude "https://docs.google.com/spreadsheets/d/12345ABCDEF/.*"
71 changes: 71 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Notes:
# - All software installed below is pinned so they don't get upgraded and break w/o us knowing why.
# - If you bump one version up to latest, please bump them all so we stay current!
# - Hugo builds the site twice: once for link checking and once minified for pushing live
# - Bash script for muffet is intentionally stand alone so devs/content editors can easily run it locally

on:
schedule:
# * is a special character in YAML so you have to quote this string
# runs at 3:15am every day:
# - cron: '15 3 * * *'
# runs every 5 min
# - cron: '*/5 * * * *'

name: Test site and push live if we're on Master
jobs:
BuildLinkCheckPushLive:
name:
runs-on: ubuntu-18.04
timeout-minutes: 15
steps:

- name: All Branches - Git checkout, including recursive call for Docsy theme
uses: actions/checkout@v2
with:
submodules: recursive # Fetch the Docsy theme
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: All Branches - Install hugo extended v0.71.1
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.71.1"
extended: true

- name: All Branches - Install Node 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: All Branches - Install npm modules for Hugo
run: npm install

- name: All Branches - Install Go v1.18
uses: actions/setup-go@v2
with:
go-version: '1.18'

- name: All Branches - Install Muffet v1.5.7
run: GO111MODULE=on go install github.com/raviqqe/[email protected]

# run in background so CI doesn't hang waiting for "ctrl + c". Sleep ensures server is ready in next step
- name: All Branches - Serve Hugo site
run: |
hugo server&
sleep 5
- name: All Branches - Run Muffet link checker
shell: bash
run: ./.github/scripts/muffet.sh

- name: Master Branch Only - Report errors to Slack, if any
if: ${{ github.ref == 'refs/heads/master' && failure() }}
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEB_HOOK }}'
SLACK_CHANNEL: '#cht-squad-docs'
SLACK_COLOR: '#3278BD'
SLACK_ICON: ":flappingphone:"
SLACK_MESSAGE: 'Broken Links Found'
SLACK_TITLE: CHT DOCS BAD LINKS
SLACK_USERNAME: Medic-Bot

0 comments on commit 1ada6a2

Please sign in to comment.