summaryrefslogtreecommitdiff
path: root/.github/workflows/docs.yml
blob: 76b0113a0e1cecfbc594544a6d424e7b3f17d840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Docs Checks
on:
  pull_request:
    branches: [ main ]

jobs:
  check-func-docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install gomplate
        run: |
          docker create --name gomplate hairyhenderson/gomplate
          docker cp gomplate:/gomplate .
          sudo mv gomplate /usr/local/bin
      - name: Make sure function docs are up-to-date
        run: |
          make --always-make gen-func-docs GOOS= GOARCH= GO=echo
          git diff --exit-code
          if [ $? -ne 0 ]; then
            echo "Function docs are out of date. Please run 'make gen-func-docs' locally and commit the changes."
            exit 1
          fi
  muffet:
    runs-on: ubuntu-latest
    steps:
      - name: Hugo setup
        uses: peaceiris/actions-hugo@v3.0.0
        with:
          # keep this in sync with netlify.toml
          hugo-version: '0.128.0'
      - uses: actions/checkout@v4
      - name: Install muffet
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          gh release --repo raviqqe/muffet download -p muffet_linux_amd64.tar.gz
          tar xvf muffet_linux_amd64.tar.gz muffet
          sudo mv muffet /usr/local/bin
      - name: Serve the site and check links
        run: |
          set -ex

          cd docs
          hugo --renderToMemory
          hugo serve --watch=false --renderToMemory &
          sleep 2

          muffet http://localhost:1313 \
            -r8 --max-connections-per-host=4 --buffer-size=8192 \
            --exclude="https://github\.com.*" \
            --exclude="https://docs\.aws.*" \
            --exclude="https://linux.die\.net.*" \
            --exclude="https://jqplay\.org.*" \
            --exclude="https://json\.org.*" \
            --exclude="https://goessner\.net.*"

          kill %1