From 7bed202086ce11c73e774af3d36ef06b322875f3 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 31 May 2024 10:52:05 +0200 Subject: [PATCH] ci: Add GitHub Action for go mod tidy and mocks --- .github/workflows/pr-go-mod-tidy-mocks.yml | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/pr-go-mod-tidy-mocks.yml diff --git a/.github/workflows/pr-go-mod-tidy-mocks.yml b/.github/workflows/pr-go-mod-tidy-mocks.yml new file mode 100644 index 000000000000..4e243540c063 --- /dev/null +++ b/.github/workflows/pr-go-mod-tidy-mocks.yml @@ -0,0 +1,48 @@ +name: 'PR Go Mod Tidy and Mocks' +on: + pull_request: + branches: + - main + +concurrency: + group: ci-${{ github.ref }}-pr-go-mod-tidy-mocks + cancel-in-progress: true + +jobs: + go-mod-tidy: + name: Check go mod tidy + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 'stable' + - name: Run go mod tidy + run: ./scripts/go-mod-tidy-all.sh + - name: Check for diffs + run: | + git diff --exit-code || { + echo "Please run './scripts/go-mod-tidy-all.sh' and commit the changes"; + exit 1; + } + + generate-mocks: + name: Generate Mocks + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 'stable' + - name: Generate mocks + run: make mocks + - name: Check for diffs + run: | + git diff --exit-code || { + echo "Please run 'make mocks' and commit the changes"; + exit 1; + }