2022-08-28 08:27:51 +08:00
|
|
|
DIST := dist
|
2023-04-30 18:13:11 +02:00
|
|
|
EXECUTABLE := forgejo-runner
|
2022-08-28 08:27:51 +08:00
|
|
|
GOFMT ?= gofumpt -l
|
|
|
|
|
DIST := dist
|
|
|
|
|
DIST_DIRS := $(DIST)/binaries $(DIST)/release
|
2025-02-25 09:47:45 +00:00
|
|
|
GO ?= $(shell go env GOROOT)/bin/go
|
2022-08-28 08:27:51 +08:00
|
|
|
SHASUM ?= shasum -a 256
|
|
|
|
|
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
|
|
|
|
|
|
|
|
|
|
LINUX_ARCHS ?= linux/amd64,linux/arm64
|
|
|
|
|
DARWIN_ARCHS ?= darwin-12/amd64,darwin-12/arm64
|
|
|
|
|
WINDOWS_ARCHS ?= windows/amd64
|
2023-03-14 18:43:05 +08:00
|
|
|
GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*")
|
2025-07-28 19:11:39 +02:00
|
|
|
GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*")
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2025-08-21 06:30:27 +00:00
|
|
|
MOCKERY_PACKAGE ?= github.com/vektra/mockery/v2@v2.53.5 # renovate: datasource=go
|
Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.5.0 (#1023)
This PR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/golangci/golangci-lint/v2/cmd/golangci-lint](https://github.com/golangci/golangci-lint) | `v2.4.0` -> `v2.5.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) |
---
### Release Notes
<details>
<summary>golangci/golangci-lint (github.com/golangci/golangci-lint/v2/cmd/golangci-lint)</summary>
### [`v2.5.0`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v250)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v2.4.0...v2.5.0)
1. New linters
- Add `godoclint` linter <https://github.com/godoc-lint/godoc-lint>
- Add `unqueryvet` linter <https://github.com/MirrexOne/unqueryvet>
- Add `iotamixing` linter <https://github.com/AdminBenni/iota-mixing>
2. Linters new features or changes
- `embeddedstructfieldcheck`: from 0.3.0 to 0.4.0 (new option: `empty-line`)
- `err113`: from [`aea10b5`](https://github.com/golangci/golangci-lint/commit/aea10b59be24) to 0.1.1 (skip internals of `Is` methods for `error` type)
- `ginkgolinter`: from 0.20.0 to 0.21.0 (new option: `force-tonot`)
- `gofumpt`: from 0.8.0 to 0.9.1 (new rule is to "clothe" naked returns for the sake of clarity)
- `ineffassign`: from 0.1.0 to 0.2.0 (new option: `check-escaping-errors`)
- `musttag`: from 0.13.1 to 0.14.0 (support interface methods)
- `revive`: from 1.11.0 to 1.12.0 (new options: `identical-ifelseif-branches`, `identical-ifelseif-conditions`, `identical-switch-branches`, `identical-switch-conditions`, `package-directory-mismatch`, `unsecure-url-scheme`, `use-waitgroup-go`, `useless-fallthrough`)
- `thelper`: from 0.6.3 to 0.7.1 (skip `t.Helper` in functions passed to `synctest.Test`)
- `wsl`: from 5.1.1 to 5.2.0 (improvements related to subexpressions)
3. Linters bug fixes
- `asciicheck`: from 0.4.1 to 0.5.0
- `errname`: from 1.1.0 to 1.1.1
- `fatcontext`: from 0.8.0 to 0.8.1
- `go-printf-func-name`: from 0.1.0 to 0.1.1
- `godot`: from 1.5.1 to 1.5.4
- `gosec`: from 2.22.7 to 2.22.8
- `nilerr`: from 0.1.1 to a temporary fork
- `nilnil`: from 1.1.0 to 1.1.1
- `protogetter`: from 0.3.15 to 0.3.16
- `tagliatelle`: from 0.7.1 to 0.7.2
- `testifylint`: from 1.6.1 to 1.6.4
4. Misc.
- fix: "no export data" errors are now handled as a standard typecheck error
5. Documentation
- Improve nolint section about syntax
</details>
---
### Configuration
📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMTMuMyIsInVwZGF0ZWRJblZlciI6IjQxLjExMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1023
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-22 10:10:07 +00:00
|
|
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0 # renovate: datasource=go
|
2025-07-03 16:41:05 +00:00
|
|
|
|
2023-04-13 04:17:08 +08:00
|
|
|
DOCKER_IMAGE ?= gitea/act_runner
|
|
|
|
|
DOCKER_TAG ?= nightly
|
|
|
|
|
DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)
|
2023-06-15 05:27:35 +00:00
|
|
|
DOCKER_ROOTLESS_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)-dind-rootless
|
2023-04-13 04:17:08 +08:00
|
|
|
|
2023-04-30 18:13:11 +02:00
|
|
|
EXTLDFLAGS = -extldflags "-static" $(null)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
|
|
|
|
ifeq ($(HAS_GO), GO)
|
|
|
|
|
GOPATH ?= $(shell $(GO) env GOPATH)
|
|
|
|
|
export PATH := $(GOPATH)/bin:$(PATH)
|
|
|
|
|
|
|
|
|
|
CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER=32766
|
|
|
|
|
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifeq ($(OS), Windows_NT)
|
|
|
|
|
GOFLAGS := -v -buildmode=exe
|
|
|
|
|
EXECUTABLE ?= $(EXECUTABLE).exe
|
|
|
|
|
else ifeq ($(OS), Windows)
|
|
|
|
|
GOFLAGS := -v -buildmode=exe
|
|
|
|
|
EXECUTABLE ?= $(EXECUTABLE).exe
|
|
|
|
|
else
|
|
|
|
|
GOFLAGS := -v
|
|
|
|
|
EXECUTABLE ?= $(EXECUTABLE)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
STORED_VERSION_FILE := VERSION
|
|
|
|
|
|
|
|
|
|
ifneq ($(DRONE_TAG),)
|
|
|
|
|
VERSION ?= $(subst v,,$(DRONE_TAG))
|
2025-06-01 15:03:22 +00:00
|
|
|
RELEASE_VERSION ?= $(VERSION)
|
2022-08-28 08:27:51 +08:00
|
|
|
else
|
|
|
|
|
ifneq ($(DRONE_BRANCH),)
|
|
|
|
|
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
|
|
|
|
|
else
|
2023-03-13 18:57:35 +08:00
|
|
|
VERSION ?= main
|
2022-08-28 08:27:51 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null)
|
|
|
|
|
ifneq ($(STORED_VERSION),)
|
2025-06-01 15:03:22 +00:00
|
|
|
RELEASE_VERSION ?= $(STORED_VERSION)
|
2022-08-28 08:27:51 +08:00
|
|
|
else
|
2025-06-01 15:03:22 +00:00
|
|
|
RELEASE_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
2022-08-28 08:27:51 +08:00
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
2025-09-05 15:03:52 +02:00
|
|
|
GO_PACKAGES_TO_VET ?= $(filter-out code.forgejo.org/forgejo/runner/v11/internal/pkg/client/mocks code.forgejo.org/forgejo/runner/v11/act/artifactcache/mock_caches.go,$(shell $(GO) list ./...))
|
2023-05-06 17:00:52 +08:00
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
TAGS ?=
|
2025-09-05 07:29:38 +00:00
|
|
|
LDFLAGS ?= -X "code.forgejo.org/forgejo/runner/v11/internal/pkg/ver.version=v$(RELEASE_VERSION)"
|
2022-08-28 08:27:51 +08:00
|
|
|
|
|
|
|
|
all: build
|
|
|
|
|
|
2025-08-21 11:24:11 +00:00
|
|
|
.PHONY: lint-check
|
2025-07-11 07:57:23 +00:00
|
|
|
lint-check:
|
|
|
|
|
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS)
|
|
|
|
|
|
2025-08-21 11:24:11 +00:00
|
|
|
.PHONY: lint
|
2025-07-11 07:57:23 +00:00
|
|
|
lint:
|
|
|
|
|
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS) --fix
|
|
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
fmt:
|
|
|
|
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
2023-02-24 23:30:09 +08:00
|
|
|
$(GO) install mvdan.cc/gofumpt@latest; \
|
2022-08-28 08:27:51 +08:00
|
|
|
fi
|
2023-03-14 18:43:05 +08:00
|
|
|
$(GOFMT) -w $(GO_FMT_FILES)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2023-03-16 11:37:08 +08:00
|
|
|
.PHONY: go-check
|
|
|
|
|
go-check:
|
|
|
|
|
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9]+' go.mod | cut -d' ' -f2))
|
|
|
|
|
$(eval MIN_GO_VERSION := $(shell printf "%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')))
|
|
|
|
|
$(eval GO_VERSION := $(shell printf "%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9]+' | tr '.' ' ');))
|
|
|
|
|
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
|
|
|
|
|
echo "Act Runner requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
.PHONY: fmt-check
|
|
|
|
|
fmt-check:
|
|
|
|
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
2023-02-24 23:30:09 +08:00
|
|
|
$(GO) install mvdan.cc/gofumpt@latest; \
|
2022-08-28 08:27:51 +08:00
|
|
|
fi
|
2023-03-14 18:43:05 +08:00
|
|
|
@diff=$$($(GOFMT) -d $(GO_FMT_FILES)); \
|
2022-08-28 08:27:51 +08:00
|
|
|
if [ -n "$$diff" ]; then \
|
|
|
|
|
echo "Please run 'make fmt' and commit the result:"; \
|
|
|
|
|
echo "$${diff}"; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi;
|
|
|
|
|
|
2025-07-11 07:57:23 +00:00
|
|
|
test: lint-check fmt-check
|
2025-08-12 10:46:18 -06:00
|
|
|
$(GO) test -v -race -short -cover -coverprofile coverage.txt ./internal/...
|
|
|
|
|
$(GO) test -race -short ./act/container
|
|
|
|
|
$(GO) test -race ./act/artifactcache/... ./act/workflowpattern/... ./act/filecollector/... ./act/common/... ./act/jobparser ./act/model ./act/exprparser ./act/schema
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2025-08-20 19:46:03 +00:00
|
|
|
integration-test:
|
2025-08-12 10:46:18 -06:00
|
|
|
@$(GO) test -race -v ./internal/app/run/...
|
2025-08-20 19:46:03 +00:00
|
|
|
|
2023-02-28 18:44:46 +08:00
|
|
|
.PHONY: vet
|
|
|
|
|
vet:
|
|
|
|
|
@echo "Running go vet..."
|
2023-07-13 09:08:21 +02:00
|
|
|
@$(GO) vet $(GO_PACKAGES_TO_VET)
|
2023-02-28 18:44:46 +08:00
|
|
|
|
2025-07-03 16:41:05 +00:00
|
|
|
.PHONY: generate
|
|
|
|
|
generate:
|
2025-09-05 15:03:52 +02:00
|
|
|
$(GO) generate ./...
|
2025-07-03 16:41:05 +00:00
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
install: $(GOFILES)
|
|
|
|
|
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
|
|
|
|
|
|
2023-03-16 11:37:08 +08:00
|
|
|
build: go-check $(EXECUTABLE)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2025-07-31 05:37:12 +00:00
|
|
|
$(EXECUTABLE): $(GOFILES) act/schema/action_schema.json act/schema/workflow_schema.json
|
2023-04-30 18:13:11 +02:00
|
|
|
$(GO) build -v -tags 'netgo osusergo $(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2025-07-03 16:41:05 +00:00
|
|
|
.PHONY: deps-tools
|
|
|
|
|
deps-tools:
|
|
|
|
|
$(GO) install $(MOCKERY_PACKAGE)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
|
|
|
|
$(DIST_DIRS):
|
|
|
|
|
mkdir -p $(DIST_DIRS)
|
|
|
|
|
|
2023-04-13 04:17:08 +08:00
|
|
|
.PHONY: docker
|
|
|
|
|
docker:
|
2023-04-25 03:15:48 +08:00
|
|
|
if ! docker buildx version >/dev/null 2>&1; then \
|
|
|
|
|
ARG_DISABLE_CONTENT_TRUST=--disable-content-trust=false; \
|
|
|
|
|
fi; \
|
|
|
|
|
docker build $${ARG_DISABLE_CONTENT_TRUST} -t $(DOCKER_REF) .
|
2023-06-12 06:35:27 +00:00
|
|
|
docker build $${ARG_DISABLE_CONTENT_TRUST} -t $(DOCKER_ROOTLESS_REF) -f Dockerfile.rootless .
|
2023-04-13 04:17:08 +08:00
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
clean:
|
|
|
|
|
$(GO) clean -x -i ./...
|
|
|
|
|
rm -rf coverage.txt $(EXECUTABLE) $(DIST)
|
|
|
|
|
|
|
|
|
|
version:
|
|
|
|
|
@echo $(VERSION)
|