From f9aebd77d4c26274cde97239e0f3770b5b0383bf Mon Sep 17 00:00:00 2001 From: Adphi Date: Wed, 10 Aug 2022 11:35:55 +0200 Subject: [PATCH] actions: move docs test to its own job Signed-off-by: Adphi --- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ Makefile | 2 ++ 2 files changed, 33 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d9f34da..ea1e564 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,6 +45,35 @@ jobs: - name: Run tests run: make tests + docs-up-to-date: + name: Docs up to date + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # fetching all tags is required for the Makefile to compute the right version + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + + - name: Share cache with other actions + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + /tmp/.buildx-cache + key: ${{ runner.os }}-tests-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-tests- + + - name: Check if docs are up to date + run: make docs-up-to-date + build: name: Build runs-on: ubuntu-latest @@ -155,6 +184,7 @@ jobs: if: startsWith(github.event.ref, 'refs/tags/v') needs: - tests + - docs-up-to-date - build steps: @@ -202,6 +232,7 @@ jobs: if: startsWith(github.event.ref, 'refs/tags/v') needs: - tests + - docs-up-to-date - build-image steps: diff --git a/Makefile b/Makefile index 445ffcd..ad94421 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,8 @@ docker-run: tests: @go generate ./... @go list ./...| xargs go test -exec sudo -count=1 -timeout 20m -v + +docs-up-to-date: @$(MAKE) docs @git diff --quiet docs || (echo "Please regenerate the documentation with 'make docs'"; exit 1)