diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 9ce07101..69771e48 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -127,3 +127,35 @@ jobs: set -x ./forgejo-runner exec --var MY_VAR=testvariable --workflows .forgejo/testdata/var.yml |& tee /tmp/var.out grep --quiet 'Success - Main echo "VAR -> testvariable"' /tmp/var.out + + validate-mocks: + needs: + - build-and-tests + name: validate mocks + if: vars.ROLE == 'forgejo-coding' + runs-on: docker + container: + image: 'code.forgejo.org/oci/ci:1' + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + + - name: generate mocks + run: | + set -ex + make deps-tools + make generate + make fmt + + - name: validate mocks + run: | + git diff --quiet || { + echo "[ERROR] Please apply the changes mockery suggests:" + git diff --color=always + exit 1 + } diff --git a/Makefile b/Makefile index e32d7759..3d751aa1 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ WINDOWS_ARCHS ?= windows/amd64 GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*") GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*") -MOCKERY_PACKAGE ?= github.com/vektra/mockery/v2@v3.5.3 # renovate: datasource=go +MOCKERY_PACKAGE ?= github.com/vektra/mockery/v2@v2.53.4 # renovate: datasource=go GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0 # renovate: datasource=go DOCKER_IMAGE ?= gitea/act_runner