ci: Add GitHub Action for go mod tidy and mocks (#20501)

This commit is contained in:
Julien Robert 2024-05-31 11:56:44 +02:00 committed by GitHub
parent a6857962c5
commit 8364791eb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,50 @@
name: 'Checks dependencies and mocks generation'
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@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- 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: Check up to date mocks
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- 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;
}

View File

@ -7,7 +7,7 @@ package mock
import (
reflect "reflect"
log "cosmossdk.io/log"
log "cosmossdk.io/core/log"
gomock "github.com/golang/mock/gomock"
)