medic / cht-docs

Documentation site for the Community Health Tookit
https://docs.communityhealthtoolkit.org
14 stars 18 forks source link

Add nightly link checking #366

Open mrjones-plip opened 3 years ago

mrjones-plip commented 3 years ago

Now that we've removed per commit link checking on PRs, we should add nightly link checking on the entire repo. This will enable us to catch link rot overtime. In the original link checker effort (see #259), we used muffet. This is still a good tool! We should just run them on a schedule with something like:

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

What we have right now runs on every push:

on:
  push:
    branches:
      - '*' # branch checking is below so all this is one CI file

And then we check for if we're on master or not to only run certain parts of the CI workflow:

- name: Master Branch Only - Deploy to GH pages
   if: ${{ github.ref == 'refs/heads/master' }}

Check out the resulting PR from #367 as that will show what we need to add back in to the nightly runs.

mrjones-plip commented 3 years ago

This is what I yanked out of ci.yml in #365 :


      # Pinning to current version as of Aug 3, 2020 for stability
      - name: All Branches - Install Go v1.14
        uses: actions/setup-go@v2
        with:
          go-version: '1.14'

      # Pinning to current version as of Aug 3, 2020 for stability
      - name: All Branches - Install Muffet v1.3.3
        run: env GO111MODULE="on" go get github.com/raviqqe/muffet@1.3.3

      # run in background so CI doesn't hang waiting for "ctrl + c".  Sleep so hugo server is ready
      - 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
mrjones-plip commented 3 years ago

When ever this gets tended to, we should likely refactor the filenames so that they're logical. Maybe move ci.yml to be branch-checks.yml and the new one is nightly-link-check.yml or something? Just make it logical ;)

mrjones-plip commented 3 years ago

@MaxDiz and @abbyad - while i've actively yanked out link checking becaues it's blocked some folks from merging PRs - I'm letting this one naturally fall into when ever we want to schedule it.

mrjones-plip commented 3 years ago

a helpful not from @nomulex which I agree with:

For the link checker nightly build, we may need to put it retry logic for those links that work on retry , also if it fails say 3 times we need to have a way to alert those that are concerned.