From bab7d5e497a82cbbbf57e196b86f2306a75c0065 Mon Sep 17 00:00:00 2001 From: Jeff Dairiki Date: Sun, 27 Feb 2022 14:38:54 -0800 Subject: [PATCH] Test for broken internal links in CI --- .github/workflows/deploy.yml | 29 +++++++++++++++++++++++------ .htmltest.yml | 8 ++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 .htmltest.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 217e86ca..7cf9210a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,12 +12,19 @@ on: schedule: - cron: '23 2 * * *' +env: + DEPLOY: >- + ${{ + github.event_name != 'pull_request' + && + github.ref == 'refs/heads/master' + }} + OUTPUT: _html + jobs: - deploy-lektor-website: - name: Deploy lektor website + build: + name: Build lektor website runs-on: ubuntu-latest - env: - DEPLOY: ${{ github.event_name != 'pull_request' }} steps: - uses: actions/checkout@v2 @@ -28,10 +35,20 @@ jobs: python -m pip install --upgrade pip setuptools python -m pip install lektor - - run: lektor build + - name: Build lektor website + run: lektor build -O '${{ env.OUTPUT }}' - - run: lektor deploy ghpages-https + - name: Check for broken internal links + uses: wjdp/htmltest-action@master + with: + path: ${{ env.OUTPUT }} + config: .htmltest.yml + skip_external: true + log_level: 1 + + - name: Deploy lektor website if: env.DEPLOY == 'true' + run: lektor deploy -O '${{ env.OUTPUT }}' ghpages-https env: LEKTOR_DEPLOY_USERNAME: lektor LEKTOR_DEPLOY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} diff --git a/.htmltest.yml b/.htmltest.yml new file mode 100644 index 00000000..f7afd545 --- /dev/null +++ b/.htmltest.yml @@ -0,0 +1,8 @@ +IgnoreAltMissing: true +IgnoreURLs: + - "^http://localhost:" + +# htmltest does not like quotes around URL in meta refresh +CheckMetaRefresh: false +# our redirect page doesn't have a doctype +CheckDoctype: false