From 22fb783724c74683d2cfd360f04be57cfae743d7 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 12 Mar 2025 11:32:21 +0100 Subject: [PATCH] test: extract go bin --- .golangci.yml | 7 +---- .make/go.mk | 12 ------- .woodpecker.star | 31 +++++++------------ Makefile | 22 ++++++------- .../antivirus/pkg/scanners/mocks/scanner.go | 2 +- .../collaboration/mocks/connector_service.go | 2 +- .../mocks/content_connector_service.go | 2 +- .../mocks/file_connector_service.go | 2 +- .../collaboration/mocks/gateway_selector.go | 2 +- services/collaboration/mocks/lock_parser.go | 2 +- services/graph/Makefile | 2 +- services/graph/mocks/base_graph_provider.go | 2 +- .../mocks/drive_item_permissions_provider.go | 2 +- .../graph/mocks/drives_drive_item_provider.go | 2 +- services/graph/mocks/gateway_selector.go | 2 +- services/graph/mocks/http_client.go | 2 +- services/graph/mocks/permissions.go | 2 +- services/graph/mocks/publisher.go | 2 +- services/graph/mocks/role_service.go | 2 +- services/graph/pkg/identity/mocks/backend.go | 2 +- .../pkg/identity/mocks/education_backend.go | 2 +- .../graph/pkg/identity/mocks/ldapclient.go | 2 +- .../pkg/backends/keycloak/mocks/client.go | 2 +- .../pkg/user/backend/mocks/user_backend.go | 2 +- .../pkg/userroles/mocks/user_role_assigner.go | 2 +- 25 files changed, 43 insertions(+), 71 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 174298d399..d923e08814 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,7 +5,6 @@ linters: disable: - contextcheck # FIXME: causes panic in graph service - lll # 760 issues in the codebase - - exhaustivestruct - exhaustruct - exhaustive # 634 issues in the codebase - wrapcheck # 398 issues in the codebase @@ -16,14 +15,12 @@ linters: - forbidigo - gochecknoglobals - nlreturn - - nosnakecase # each 100-200 issues in codebase - gci - godot - funlen - - gomnd - gofumpt - ireturn - - goerr113 + - err113 - containedctx - paralleltest - gocritic # each 50-100 issues in codebase @@ -31,8 +28,6 @@ linters: - cyclop - noctx - testpackage - - maligned - - golint - forcetypeassert - nonamedreturns - dupl diff --git a/.make/go.mk b/.make/go.mk index 44f109ad49..dcd1bd4524 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -67,18 +67,6 @@ fmt: @echo "- $(NAME): fmt" gofmt -s -w $(SOURCES) -.PHONY: golangci-lint-fix -golangci-lint-fix: $(GOLANGCI_LINT) - $(GOLANGCI_LINT) run $(LINTERS) --fix - -.PHONY: golangci-lint -golangci-lint: $(GOLANGCI_LINT) - $(GOLANGCI_LINT) run --path-prefix services/$(NAME) - -.PHONY: ci-golangci-lint -ci-golangci-lint: $(GOLANGCI_LINT) - $(GOLANGCI_LINT) run --path-prefix services/$(NAME) --timeout 15m0s --issues-exit-code 0 --out-format checkstyle > checkstyle.xml - .PHONY: test test: @go test -v -tags '$(TAGS)' -coverprofile coverage.out ./... diff --git a/.woodpecker.star b/.woodpecker.star index 2d51320fbb..847d630c48 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -418,8 +418,14 @@ def main(ctx): build_release_helpers = \ changelog() + \ - docs() + \ - licenseCheck(ctx) + docs() + + build_release_helpers.append( + pipelineDependsOn( + licenseCheck(ctx), + getGoBinForTesting(ctx), + ), + ) test_pipelines = \ codestyle(ctx) + \ @@ -1741,20 +1747,9 @@ def binaryRelease(ctx, arch, build_type, target, depends_on = []): } def licenseCheck(ctx): - # uploads third-party-licenses to https://download.owncloud.com/ocis/ocis/daily/ - target = "/ocis/%s/daily" % (ctx.repo.name.replace("ocis-", "")) - if ctx.build.event == "tag": - # uploads third-party-licenses to eg. https://download.owncloud.com/ocis/ocis/1.0.0-beta9/ - folder = "stable" - buildref = ctx.build.ref.replace("refs/tags/v", "") - buildref = buildref.lower() - if buildref.find("-") != -1: # "x.x.x-alpha", "x.x.x-beta", "x.x.x-rc" - folder = "testing" - target = "/ocis/%s/%s/%s" % (ctx.repo.name.replace("ocis-", ""), folder, buildref) - - return [{ + return { "name": "check-licenses", - "steps": [ + "steps": restoreGoBinCache() + [ { "name": "node-check-licenses", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, @@ -1840,7 +1835,7 @@ def licenseCheck(ctx): }, ], "workspace": workspace, - }] + } def releaseDockerManifest(ctx, repo, build_type): spec = "manifest.tmpl" @@ -2503,10 +2498,8 @@ def genericCachePurge(flush_path): { "event": "pull_request", }, - # { - # "status": ["success", "failure"] - # }, ], + "runs_on": ["failure"], } def genericBuildArtifactCache(ctx, name, action, path): diff --git a/Makefile b/Makefile index 4b78541437..7d88f8a707 100644 --- a/Makefile +++ b/Makefile @@ -213,20 +213,16 @@ protobuf: done .PHONY: golangci-lint -golangci-lint: - @for mod in $(OC_MODULES); do \ - $(MAKE) --no-print-directory -C $$mod golangci-lint; \ - done +golangci-lint: $(GOLANGCI_LINT) + $(GOLANGCI_LINT) run --modules-download-mode vendor --timeout 15m0s --issues-exit-code 0 --out-format checkstyle > checkstyle.xml .PHONY: ci-golangci-lint -ci-golangci-lint: $(GOLANGCI_LINT) +ci-golangci-lint: $(GOLANGCI_LINT) run --modules-download-mode vendor --timeout 15m0s --issues-exit-code 0 --out-format checkstyle > checkstyle.xml .PHONY: golangci-lint-fix -golangci-lint-fix: - @for mod in $(OC_MODULES); do \ - $(MAKE) --no-print-directory -C $$mod golangci-lint-fix; \ - done +golangci-lint-fix: $(GOLANGCI_LINT) + $(GOLANGCI_LINT) run --fix --modules-download-mode vendor --timeout 15m0s --issues-exit-code 0 --out-format checkstyle > checkstyle.xml .PHONY: test-gherkin-lint test-gherkin-lint: @@ -241,13 +237,13 @@ bingo-update: $(BINGO) $(BINGO) get -l -v -t 20 .PHONY: check-licenses -check-licenses: ci-go-check-licenses ci-node-check-licenses +check-licenses: $(GO_LICENSES) ci-go-check-licenses ci-node-check-licenses .PHONY: save-licenses -save-licenses: ci-go-save-licenses ci-node-save-licenses +save-licenses: $(GO_LICENSES) ci-go-save-licenses ci-node-save-licenses .PHONY: ci-go-check-licenses -ci-go-check-licenses: $(GO_LICENSES) +ci-go-check-licenses: $(GO_LICENSES) check ./... .PHONY: ci-node-check-licenses @@ -257,7 +253,7 @@ ci-node-check-licenses: done .PHONY: ci-go-save-licenses -ci-go-save-licenses: $(GO_LICENSES) +ci-go-save-licenses: @mkdir -p ./third-party-licenses/go/opencloud/third-party-licenses $(GO_LICENSES) csv ./... > ./third-party-licenses/go/opencloud/third-party-licenses.csv $(GO_LICENSES) save ./... --force --save_path="./third-party-licenses/go/opencloud/third-party-licenses" diff --git a/services/antivirus/pkg/scanners/mocks/scanner.go b/services/antivirus/pkg/scanners/mocks/scanner.go index e1b381d081..0e54e6b88c 100644 --- a/services/antivirus/pkg/scanners/mocks/scanner.go +++ b/services/antivirus/pkg/scanners/mocks/scanner.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/collaboration/mocks/connector_service.go b/services/collaboration/mocks/connector_service.go index b025173fd8..ee17ddff09 100644 --- a/services/collaboration/mocks/connector_service.go +++ b/services/collaboration/mocks/connector_service.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/collaboration/mocks/content_connector_service.go b/services/collaboration/mocks/content_connector_service.go index cfa646b23e..37e2b11363 100644 --- a/services/collaboration/mocks/content_connector_service.go +++ b/services/collaboration/mocks/content_connector_service.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/collaboration/mocks/file_connector_service.go b/services/collaboration/mocks/file_connector_service.go index 53a7c660b7..c40b382086 100644 --- a/services/collaboration/mocks/file_connector_service.go +++ b/services/collaboration/mocks/file_connector_service.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/collaboration/mocks/gateway_selector.go b/services/collaboration/mocks/gateway_selector.go index 09a3257263..e79ace9e0c 100644 --- a/services/collaboration/mocks/gateway_selector.go +++ b/services/collaboration/mocks/gateway_selector.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/collaboration/mocks/lock_parser.go b/services/collaboration/mocks/lock_parser.go index cc94f3a7d1..7e6e106886 100644 --- a/services/collaboration/mocks/lock_parser.go +++ b/services/collaboration/mocks/lock_parser.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/Makefile b/services/graph/Makefile index 8afc765279..aa80ead13c 100644 --- a/services/graph/Makefile +++ b/services/graph/Makefile @@ -14,7 +14,7 @@ include ../../.make/release.mk include ../../.make/docs.mk .PHONY: go-generate -go-generate: $(MOCKERY) +go-generate: $(MOCKERY) .PHONY: l10n-pull diff --git a/services/graph/mocks/base_graph_provider.go b/services/graph/mocks/base_graph_provider.go index 38050a8c99..f1b95ad1ff 100644 --- a/services/graph/mocks/base_graph_provider.go +++ b/services/graph/mocks/base_graph_provider.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/mocks/drive_item_permissions_provider.go b/services/graph/mocks/drive_item_permissions_provider.go index fedac18aa0..c34bc71fc2 100644 --- a/services/graph/mocks/drive_item_permissions_provider.go +++ b/services/graph/mocks/drive_item_permissions_provider.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/mocks/drives_drive_item_provider.go b/services/graph/mocks/drives_drive_item_provider.go index 9ca9447ad6..4d07847909 100644 --- a/services/graph/mocks/drives_drive_item_provider.go +++ b/services/graph/mocks/drives_drive_item_provider.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/mocks/gateway_selector.go b/services/graph/mocks/gateway_selector.go index 09a3257263..e79ace9e0c 100644 --- a/services/graph/mocks/gateway_selector.go +++ b/services/graph/mocks/gateway_selector.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/mocks/http_client.go b/services/graph/mocks/http_client.go index d83f3d386c..0c29f9e883 100644 --- a/services/graph/mocks/http_client.go +++ b/services/graph/mocks/http_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/mocks/permissions.go b/services/graph/mocks/permissions.go index 9f9d59038f..60931c7073 100644 --- a/services/graph/mocks/permissions.go +++ b/services/graph/mocks/permissions.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/mocks/publisher.go b/services/graph/mocks/publisher.go index 2af03eea1d..7b9cc6d8f7 100644 --- a/services/graph/mocks/publisher.go +++ b/services/graph/mocks/publisher.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/mocks/role_service.go b/services/graph/mocks/role_service.go index ecc5443413..1407f3273b 100644 --- a/services/graph/mocks/role_service.go +++ b/services/graph/mocks/role_service.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/pkg/identity/mocks/backend.go b/services/graph/pkg/identity/mocks/backend.go index a4375562e4..c26ae8b256 100644 --- a/services/graph/pkg/identity/mocks/backend.go +++ b/services/graph/pkg/identity/mocks/backend.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/pkg/identity/mocks/education_backend.go b/services/graph/pkg/identity/mocks/education_backend.go index f06cd5a179..716f0adde0 100644 --- a/services/graph/pkg/identity/mocks/education_backend.go +++ b/services/graph/pkg/identity/mocks/education_backend.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/graph/pkg/identity/mocks/ldapclient.go b/services/graph/pkg/identity/mocks/ldapclient.go index 8ca75dd57a..dbfad7fa92 100644 --- a/services/graph/pkg/identity/mocks/ldapclient.go +++ b/services/graph/pkg/identity/mocks/ldapclient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/invitations/pkg/backends/keycloak/mocks/client.go b/services/invitations/pkg/backends/keycloak/mocks/client.go index 67238ea31e..fff2474a71 100644 --- a/services/invitations/pkg/backends/keycloak/mocks/client.go +++ b/services/invitations/pkg/backends/keycloak/mocks/client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/proxy/pkg/user/backend/mocks/user_backend.go b/services/proxy/pkg/user/backend/mocks/user_backend.go index 813e1f4e0c..af1aed5a7f 100644 --- a/services/proxy/pkg/user/backend/mocks/user_backend.go +++ b/services/proxy/pkg/user/backend/mocks/user_backend.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks diff --git a/services/proxy/pkg/userroles/mocks/user_role_assigner.go b/services/proxy/pkg/userroles/mocks/user_role_assigner.go index 7d2d89ea1a..b683b1a4c5 100644 --- a/services/proxy/pkg/userroles/mocks/user_role_assigner.go +++ b/services/proxy/pkg/userroles/mocks/user_role_assigner.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.53.0. DO NOT EDIT. +// Code generated by mockery v2.53.2. DO NOT EDIT. package mocks