This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [github.com/go-swagger/go-swagger](https://redirect.github.com/go-swagger/go-swagger) | `v0.33.2` → `v0.34.0` |  |  | --- ### Release Notes <details> <summary>go-swagger/go-swagger (github.com/go-swagger/go-swagger)</summary> ### [`v0.34.0`](https://redirect.github.com/go-swagger/go-swagger/releases/tag/v0.34.0) [Compare Source](https://redirect.github.com/go-swagger/go-swagger/compare/v0.33.2...v0.34.0) go-swagger release 0.34.0 *** Released on 2026 May 29 ##### [0.34.0](https://redirect.github.com/go-swagger/go-swagger/tree/v0.34.0) - 2026-05-28 Major refactoring. Focus on improving runtime (e.g.generated client) and codescan (e.g. generated spec). **Full Changelog**: <https://github.com/go-swagger/go-swagger/compare/v0.33.2...v0.34.0> 42 commits in this release. *** ##### <!-- 00 -->Implemented enhancements - feat(client): added method to configure client-side custom producers/consumers by [@​fredbi](https://redirect.github.com/fredbi) in [#​3351](https://redirect.github.com/go-swagger/go-swagger/pull/3351) [...](https://redirect.github.com/go-swagger/go-swagger/commit/4068f65b0403f90092e78269f89ef7cb26d6eb2f) ##### <!-- 01 -->Fixed bugs - fix(client): moved internal fields in generated Params (timeout, Context) to their own struct. by [@​fredbi](https://redirect.github.com/fredbi) in [#​3349](https://redirect.github.com/go-swagger/go-swagger/pull/3349) [...](https://redirect.github.com/go-swagger/go-swagger/commit/a81068f5d52d4b560654f8e17748b6a79ec1425e) - fix(client): added operation with context to client interface. by [@​fredbi](https://redirect.github.com/fredbi) in [#​3348](https://redirect.github.com/go-swagger/go-swagger/pull/3348) [...](https://redirect.github.com/go-swagger/go-swagger/commit/d5e5d3020b83f4a9b895ae31a93cb121f989e4a6) - fix(codescan): upgraded codescan for swagger generate spec. by [@​fredbi](https://redirect.github.com/fredbi) in [#​3347](https://redirect.github.com/go-swagger/go-swagger/pull/3347) [...](https://redirect.github.com/go-swagger/go-swagger/commit/971f2aa56ad48d927ab9d21de794edf1c43d22b7) - fix(client): generated client uses more idiomatic SubmitContext by [@​fredbi](https://redirect.github.com/fredbi) in [#​3342](https://redirect.github.com/go-swagger/go-swagger/pull/3342) [...](https://redirect.github.com/go-swagger/go-swagger/commit/01d8f1358f8ab94c4b7c3a1caf50e1d0b11b26c6) - fix: adapted to runtime v0.32.x by [@​fredbi](https://redirect.github.com/fredbi) in [#​3341](https://redirect.github.com/go-swagger/go-swagger/pull/3341) [...](https://redirect.github.com/go-swagger/go-swagger/commit/ba25bfa2cc0822973d9f48f5976721ffc8c499fc) - fix: handle operator characters in enum constants (fixes [#​1047](https://redirect.github.com/go-swagger/go-swagger/issues/1047)) by [@​Abzaek](https://redirect.github.com/Abzaek) in [#​3330](https://redirect.github.com/go-swagger/go-swagger/pull/3330) [...](https://redirect.github.com/go-swagger/go-swagger/commit/4856feb230eba01352d2bb310f03b26827d34a5e) ##### <!-- 02 -->Refactor - refact(codegen): more concise server binding of form parameters. by [@​fredbi](https://redirect.github.com/fredbi) in [#​3339](https://redirect.github.com/go-swagger/go-swagger/pull/3339) [...](https://redirect.github.com/go-swagger/go-swagger/commit/036e31515a687b8a237bcf2d938a7ae36dc55fd1) - refact(generator): split template repository, funcmaps and langage by [@​fredbi](https://redirect.github.com/fredbi) in [#​3316](https://redirect.github.com/go-swagger/go-swagger/pull/3316) [...](https://redirect.github.com/go-swagger/go-swagger/commit/4d659c0b5e0724cb78b413a564619792fe4dd23e) ##### <!-- 03 -->Documentation - doc: announcements before cutting v0.34.0 by [@​fredbi](https://redirect.github.com/fredbi) in [#​3352](https://redirect.github.com/go-swagger/go-swagger/pull/3352) [...](https://redirect.github.com/go-swagger/go-swagger/commit/9b15dfe858b6b20747fb24b672707ee817481f11) - doc(faq): added explanations about why mixin can't support yaml anchors by [@​fredbi](https://redirect.github.com/fredbi) in [#​3340](https://redirect.github.com/go-swagger/go-swagger/pull/3340) [...](https://redirect.github.com/go-swagger/go-swagger/commit/0dd20f7852a35f3ebf4ea552cef66ae7296801a2) - codegen(cli): fixed missing dependencies in CLI doc template by [@​fredbi](https://redirect.github.com/fredbi) in [#​3309](https://redirect.github.com/go-swagger/go-swagger/pull/3309) [...](https://redirect.github.com/go-swagger/go-swagger/commit/b1cc87b266a8351b4fc4534d5116c11a1daadbc1) ##### <!-- 05 -->Code quality - chore: move generated code to use the new swag api. by [@​fredbi](https://redirect.github.com/fredbi) in [#​3336](https://redirect.github.com/go-swagger/go-swagger/pull/3336) [...](https://redirect.github.com/go-swagger/go-swagger/commit/ba47cff06d55b38579a1f2e34a2e4e8691dd90b0) - chore(generator): migrated to the new go-openapi/swag api. by [@​fredbi](https://redirect.github.com/fredbi) in [#​3335](https://redirect.github.com/go-swagger/go-swagger/pull/3335) [...](https://redirect.github.com/go-swagger/go-swagger/commit/83bced44f9c028141dd698838da0e5409d0ed49b) - chore(lint): relint code base (pass 1) by [@​fredbi](https://redirect.github.com/fredbi) in [#​3331](https://redirect.github.com/go-swagger/go-swagger/pull/3331) [...](https://redirect.github.com/go-swagger/go-swagger/commit/8a020f05985758bcb2535e36984ab03c62109fed) - ci: reenact linting (was temporarily disabled to swallow large diffs) by [@​fredbi](https://redirect.github.com/fredbi) in [#​3304](https://redirect.github.com/go-swagger/go-swagger/pull/3304) [...](https://redirect.github.com/go-swagger/go-swagger/commit/8cd187ba00b80a021c0493e55906b6835a985458) - doc: post-release by [@​fredbi](https://redirect.github.com/fredbi) in [#​3302](https://redirect.github.com/go-swagger/go-swagger/pull/3302) [...](https://redirect.github.com/go-swagger/go-swagger/commit/746308f71fe2d5e722b151a0ede49f84ecfaa3ea) ##### <!-- 07 -->Miscellaneous tasks - test: fix fake flaky test reporting by [@​fredbi](https://redirect.github.com/fredbi) in [#​3350](https://redirect.github.com/go-swagger/go-swagger/pull/3350) [...](https://redirect.github.com/go-swagger/go-swagger/commit/747db03403e881e53baecd5c2f40a074e15697bf) - ci: drop peter-evans sign-commits to avoid per-file API uploads by [@​fredbi](https://redirect.github.com/fredbi) in [#​3346](https://redirect.github.com/go-swagger/go-swagger/pull/3346) [...](https://redirect.github.com/go-swagger/go-swagger/commit/480a0bdbf54484562cef642132b929a9e5c03d4a) - ci: checkout examples before configuring bot credentials by [@​fredbi](https://redirect.github.com/fredbi) in [#​3345](https://redirect.github.com/go-swagger/go-swagger/pull/3345) [...](https://redirect.github.com/go-swagger/go-swagger/commit/6dda1280feee830fadbed93e6c896000fe92acdf) - ci: fix cross-workflow artifact download permission by [@​fredbi](https://redirect.github.com/fredbi) in [#​3344](https://redirect.github.com/go-swagger/go-swagger/pull/3344) [...](https://redirect.github.com/go-swagger/go-swagger/commit/5981d75858c489b8f82974c47f7fa7089deb66d2) - ci: fix examples regeneration auto-PR by [@​fredbi](https://redirect.github.com/fredbi) in [#​3343](https://redirect.github.com/go-swagger/go-swagger/pull/3343) [...](https://redirect.github.com/go-swagger/go-swagger/commit/f50d895b3a304b8a0657a4e8612fc53e6ff370dc) - chore(diff): moved cmd/swagger/commands/diff to its own package by [@​fredbi](https://redirect.github.com/fredbi) in [#​3308](https://redirect.github.com/go-swagger/go-swagger/pull/3308) [...](https://redirect.github.com/go-swagger/go-swagger/commit/6e059188a45c84e64591b7cb915f4205d6f7a8a1) - chore(codescan): moved the codescan package in a separate repo by [@​fredbi](https://redirect.github.com/fredbi) in [#​3307](https://redirect.github.com/go-swagger/go-swagger/pull/3307) [...](https://redirect.github.com/go-swagger/go-swagger/commit/eeca5fc9ff118d7be5d76d52855a082b04f13d91) - ci: added workflow to regen examples and push the changes to the exam… by [@​fredbi](https://redirect.github.com/fredbi) in [#​3305](https://redirect.github.com/go-swagger/go-swagger/pull/3305) [...](https://redirect.github.com/go-swagger/go-swagger/commit/9203e37e731b131c5d89a78209d549960b7c0a1c) ##### <!-- 08 -->Security - docs: add comprehensive documentation for API Browser (issue [#​2401](https://redirect.github.com/go-swagger/go-swagger/issues/2401)) by [@​dashitongzhi](https://redirect.github.com/dashitongzhi) in [#​3338](https://redirect.github.com/go-swagger/go-swagger/pull/3338) [...](https://redirect.github.com/go-swagger/go-swagger/commit/b594d144ef999cb830cc9cb32d1c3617d5d93a36) - ci: enhanced regen examples workflow by [@​fredbi](https://redirect.github.com/fredbi) in [#​3306](https://redirect.github.com/go-swagger/go-swagger/pull/3306) [...](https://redirect.github.com/go-swagger/go-swagger/commit/e1c611ed9e0739d0395b8e08922ddfb48a6e257d) - doc: move examples by [@​fredbi](https://redirect.github.com/fredbi) in [#​3303](https://redirect.github.com/go-swagger/go-swagger/pull/3303) [...](https://redirect.github.com/go-swagger/go-swagger/commit/c32e2d574a1272c97c18aaddbeed294f62fdca31) ##### <!-- 0A -->Updates - chore(deps): bump the development-dependencies group with 10 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3337](https://redirect.github.com/go-swagger/go-swagger/pull/3337) [...](https://redirect.github.com/go-swagger/go-swagger/commit/9f68bcccf8a6ab943fa954764e749bd8e3b67684) - chore(deps): bump the development-dependencies group with 2 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3329](https://redirect.github.com/go-swagger/go-swagger/pull/3329) [...](https://redirect.github.com/go-swagger/go-swagger/commit/9286ac262e487f54fbeea64798790b463f27a7cc) - chore(deps): bump golang from `f853308` to `91eda97` in the development-dependencies group across 1 directory by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3328](https://redirect.github.com/go-swagger/go-swagger/pull/3328) [...](https://redirect.github.com/go-swagger/go-swagger/commit/a4f355cfded251a4d9fc4a3f06b0aed72314c2a4) - chore(deps): bump the development-dependencies group with 4 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3327](https://redirect.github.com/go-swagger/go-swagger/pull/3327) [...](https://redirect.github.com/go-swagger/go-swagger/commit/1078819e42db2fdf56b7fd724f911b5b32f0ed42) - chore(deps): bump the development-dependencies group with 3 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3326](https://redirect.github.com/go-swagger/go-swagger/pull/3326) [...](https://redirect.github.com/go-swagger/go-swagger/commit/e4b5c8fe1fe5869e2da495e9e363032cfee9b85f) - chore(deps): bump the development-dependencies group with 5 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3325](https://redirect.github.com/go-swagger/go-swagger/pull/3325) [...](https://redirect.github.com/go-swagger/go-swagger/commit/30da59f48a8baf6a04a667191355c5aacbb1f6f1) - chore(deps): bump golang from `27f8293` to `f853308` in the development-dependencies group across 1 directory by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3324](https://redirect.github.com/go-swagger/go-swagger/pull/3324) [...](https://redirect.github.com/go-swagger/go-swagger/commit/faffaccee8fc0843fa35ce757b19643b15b20551) - chore(deps): bump the development-dependencies group with 6 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3323](https://redirect.github.com/go-swagger/go-swagger/pull/3323) [...](https://redirect.github.com/go-swagger/go-swagger/commit/5bbf90b257203d40a28d40d68f38411b0b0ab06e) - chore(deps): bump golang from `c2a1f7b` to `27f8293` in the development-dependencies group across 1 directory by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3322](https://redirect.github.com/go-swagger/go-swagger/pull/3322) [...](https://redirect.github.com/go-swagger/go-swagger/commit/d25d6f2da06f02c38565d2bed1a4c45c41b4b539) - chore(deps): bump the development-dependencies group with 2 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3321](https://redirect.github.com/go-swagger/go-swagger/pull/3321) [...](https://redirect.github.com/go-swagger/go-swagger/commit/cedb38213dc4bfeb6c6f2fccb0211e596c777faf) - chore(deps): bump golang from `2389ebf` to `c2a1f7b` in the development-dependencies group across 1 directory by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3320](https://redirect.github.com/go-swagger/go-swagger/pull/3320) [...](https://redirect.github.com/go-swagger/go-swagger/commit/3815953bf63523fd72c9f9dad337f3d7990fd7bd) - chore(deps): bump the development-dependencies group with 4 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3318](https://redirect.github.com/go-swagger/go-swagger/pull/3318) [...](https://redirect.github.com/go-swagger/go-swagger/commit/126ceeb6180966caba0429435d94b0fb1a1e8c14) - chore(deps): bump the development-dependencies group with 6 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3317](https://redirect.github.com/go-swagger/go-swagger/pull/3317) [...](https://redirect.github.com/go-swagger/go-swagger/commit/af43211eec84e29e817f3e990cf8084fb45ebec0) - chore(deps): bump the development-dependencies group with 4 updates by [@​dependabot\[bot\]](https://redirect.github.com/dependabot\[bot]) in [#​3315](https://redirect.github.com/go-swagger/go-swagger/pull/3315) [...](https://redirect.github.com/go-swagger/go-swagger/commit/0f32c03e4982ed564cfd9d9593a4cfa1c1304d40) *** ##### People who contributed to this release - [@​Abzaek](https://redirect.github.com/Abzaek) - [@​dashitongzhi](https://redirect.github.com/dashitongzhi) - [@​fredbi](https://redirect.github.com/fredbi) *** ##### New Contributors - [@​dashitongzhi](https://redirect.github.com/dashitongzhi) made their first contribution in [#​3338](https://redirect.github.com/go-swagger/go-swagger/pull/3338) - [@​Abzaek](https://redirect.github.com/Abzaek) made their first contribution in [#​3330](https://redirect.github.com/go-swagger/go-swagger/pull/3330) *** **[go-swagger](https://redirect.github.com/go-swagger/go-swagger) license terms** [![License][license-badge]][license-url] [license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg [license-url]: https://redirect.github.com/go-swagger/go-swagger/?tab=Apache-2.0-1-ov-file#readme *** Released by [GoReleaser](https://redirect.github.com/goreleaser/goreleaser). </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - Only on Monday (`* * * * 1`) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, 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 [Mend Renovate](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNDEuNSIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> --------- Co-authored-by: Nicolas <bircni@icloud.com>
679 lines
24 KiB
Makefile
679 lines
24 KiB
Makefile
DIST := dist
|
|
DIST_DIRS := $(DIST)/binaries $(DIST)/release
|
|
|
|
# By default use go's 1.25 experimental json v2 library when building
|
|
# TODO: remove when no longer experimental
|
|
export GOEXPERIMENT ?= jsonv2
|
|
|
|
GO ?= go
|
|
SHASUM ?= shasum -a 256
|
|
COMMA := ,
|
|
|
|
XGO_VERSION := go-1.26.x
|
|
|
|
AIR_PACKAGE ?= github.com/air-verse/air@v1.65.3 # renovate: datasource=go
|
|
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.7.0 # renovate: datasource=go
|
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 # renovate: datasource=go
|
|
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.15 # renovate: datasource=go
|
|
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.8.0 # renovate: datasource=go
|
|
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.34.0 # renovate: datasource=go
|
|
XGO_PACKAGE ?= src.techknowlogick.com/xgo@v1.9.0 # renovate: datasource=go
|
|
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1.3.0 # renovate: datasource=go
|
|
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 # renovate: datasource=go
|
|
SHELLCHECK_IMAGE ?= docker.io/koalaman/shellcheck:v0.11.0@sha256:61862eba1fcf09a484ebcc6feea46f1782532571a34ed51fedf90dd25f925a8d # renovate: datasource=docker
|
|
|
|
CONTAINER_RUNTIME ?= $(shell hash docker >/dev/null 2>&1 && echo docker || echo podman)
|
|
|
|
HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes)
|
|
ifeq ($(HAS_GO), yes)
|
|
CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER=32766
|
|
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
|
|
endif
|
|
|
|
MAKE_EVIDENCE_DIR := .make_evidence
|
|
|
|
# Use sqlite as default database if running tests, only do so for local tests, not in CI.
|
|
# CI should explicitly set the database to avoid unexpected results.
|
|
ifneq ($(findstring test-,$(MAKECMDGOALS)),)
|
|
ifeq ($(CI),)
|
|
GITEA_TEST_DATABASE ?= sqlite
|
|
endif
|
|
endif
|
|
|
|
TAGS ?=
|
|
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
|
|
|
|
CGO_ENABLED ?= 0
|
|
ifneq (,$(findstring sqlite_mattn,$(TAGS))$(findstring pam,$(TAGS)))
|
|
CGO_ENABLED = 1
|
|
endif
|
|
|
|
STATIC ?=
|
|
EXTLDFLAGS ?=
|
|
ifneq ($(STATIC),)
|
|
EXTLDFLAGS = -extldflags "-static"
|
|
endif
|
|
|
|
ifeq ($(GOOS),windows)
|
|
IS_WINDOWS := yes
|
|
else ifeq ($(patsubst Windows%,Windows,$(OS)),Windows)
|
|
ifeq ($(GOOS),)
|
|
IS_WINDOWS := yes
|
|
endif
|
|
endif
|
|
|
|
# GOFLAGS and EXTRA_GOFLAGS are for the 'go build' command only
|
|
ifeq ($(IS_WINDOWS),yes)
|
|
GOFLAGS := -v -buildmode=exe
|
|
EXECUTABLE ?= gitea.exe
|
|
else
|
|
GOFLAGS := -v
|
|
EXECUTABLE ?= gitea
|
|
endif
|
|
EXTRA_GOFLAGS ?=
|
|
|
|
ifeq ($(shell sed --version 2>/dev/null | grep -q GNU && echo gnu),gnu)
|
|
SED_INPLACE := sed -i
|
|
else
|
|
SED_INPLACE := sed -i ''
|
|
endif
|
|
|
|
# GOTEST_FLAGS is for unit test and integration test
|
|
GOTEST_FLAGS ?= -timeout 40m
|
|
|
|
STORED_VERSION_FILE := VERSION
|
|
|
|
GITHUB_REF_TYPE ?= branch
|
|
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
ifneq ($(GITHUB_REF_TYPE),branch)
|
|
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
|
|
GITEA_VERSION ?= $(VERSION)
|
|
else
|
|
ifneq ($(GITHUB_REF_NAME),)
|
|
VERSION ?= $(subst release/v,,$(GITHUB_REF_NAME))-nightly
|
|
else
|
|
VERSION ?= main
|
|
endif
|
|
|
|
STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null)
|
|
ifneq ($(STORED_VERSION),)
|
|
GITEA_VERSION ?= $(STORED_VERSION)
|
|
else
|
|
GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
|
endif
|
|
endif
|
|
|
|
# if version = "main" then update version to "nightly"
|
|
ifeq ($(VERSION),main)
|
|
VERSION := main-nightly
|
|
endif
|
|
|
|
LDFLAGS := $(LDFLAGS) -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
|
|
|
|
LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/riscv64
|
|
|
|
GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list gitea.dev/models/migrations/...) gitea.dev/tests/integration/migration-test gitea.dev/tests gitea.dev/tests/integration,$(shell $(GO) list ./... | grep -v /vendor/))
|
|
MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list gitea.dev/models/migrations/...)
|
|
|
|
FRONTEND_SOURCES := $(shell find web_src/js web_src/css -type f)
|
|
FRONTEND_CONFIGS := vite.config.ts tailwind.config.ts
|
|
FRONTEND_DEST := public/assets/.vite/manifest.json
|
|
FRONTEND_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts public/assets/.vite
|
|
FRONTEND_DEV_LOG_LEVEL ?= warn
|
|
|
|
BINDATA_DEST_WILDCARD := modules/migration/bindata.* modules/public/bindata.* modules/options/bindata.* modules/templates/bindata.*
|
|
|
|
GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go
|
|
|
|
SVG_DEST_DIR := public/assets/img/svg
|
|
|
|
AIR_TMP_DIR := .air
|
|
|
|
GO_LICENSE_FILE := assets/go-licenses.json
|
|
|
|
TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR)
|
|
|
|
GO_DIRS := build cmd models modules routers services tests tools
|
|
WEB_DIRS := web_src/js web_src/css
|
|
|
|
ESLINT_FILES := web_src/js tools *.ts tests/e2e
|
|
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
|
|
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.json .github $(filter-out CHANGELOG.md, $(wildcard *.go *.md *.yml *.yaml *.toml))
|
|
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.json
|
|
|
|
GO_SOURCES := $(wildcard *.go)
|
|
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go")
|
|
GO_SOURCES += $(GENERATED_GO_DEST)
|
|
|
|
ESLINT_CONCURRENCY ?= 2
|
|
|
|
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
|
|
SWAGGER_SPEC_INPUT := templates/swagger/v1_input.json
|
|
SWAGGER_EXCLUDE := gitea.dev/sdk
|
|
OPENAPI3_SPEC := templates/swagger/v1_openapi3_json.tmpl
|
|
|
|
TEST_MYSQL_HOST ?= mysql:3306
|
|
TEST_MYSQL_DBNAME ?= testgitea
|
|
TEST_MYSQL_USERNAME ?= root
|
|
TEST_MYSQL_PASSWORD ?=
|
|
TEST_PGSQL_HOST ?= pgsql:5432
|
|
TEST_PGSQL_DBNAME ?= testgitea
|
|
TEST_PGSQL_USERNAME ?= postgres
|
|
TEST_PGSQL_PASSWORD ?= postgres
|
|
TEST_PGSQL_SCHEMA ?= gtestschema
|
|
TEST_MINIO_ENDPOINT ?= minio:9000
|
|
TEST_MSSQL_HOST ?= mssql:1433
|
|
TEST_MSSQL_DBNAME ?= testgitea
|
|
TEST_MSSQL_USERNAME ?= sa
|
|
TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
|
|
|
|
# Include local Makefile
|
|
# Makefile.local is listed in .gitignore
|
|
ifneq ("$(wildcard Makefile.local)","")
|
|
include Makefile.local
|
|
endif
|
|
|
|
$(foreach v, $(filter TEST_%, $(.VARIABLES)), $(eval MAKEFILE_VARS+=$v=$($v)))
|
|
$(foreach v, $(filter GITEA_TEST_%, $(.VARIABLES)), $(eval MAKEFILE_VARS+=$v=$($v)))
|
|
export MAKEFILE_VARS
|
|
|
|
.PHONY: all
|
|
all: build
|
|
|
|
.PHONY: help
|
|
help: Makefile ## print Makefile help information.
|
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m[TARGETS] default target: build\033[0m\n\n\033[35mTargets:\033[0m\n"} /^[0-9A-Za-z._-]+:.*?##/ { printf " \033[36m%-45s\033[0m %s\n", $$1, $$2 }' Makefile #$(MAKEFILE_LIST)
|
|
@printf " \033[36m%-46s\033[0m %s\n" "test-e2e" "test end to end using playwright"
|
|
@printf " \033[36m%-46s\033[0m %s\n" "test-backend[#TestSpecificName]" "run unit test (sqlite only)"
|
|
@printf " \033[36m%-46s\033[0m %s\n" "test-integration[#TestSpecificName]" "run integration test for GITEA_TEST_DATABASE (sqlite, mysql, pgsql, mssql)"
|
|
|
|
.PHONY: clean-all
|
|
clean-all: clean ## delete backend, frontend and integration files
|
|
rm -rf $(FRONTEND_DEST_ENTRIES) node_modules
|
|
|
|
.PHONY: clean
|
|
clean: ## delete backend and integration files
|
|
rm -f $(EXECUTABLE) test-*.test tests/*.ini
|
|
rm -rf $(DIST) $(BINDATA_DEST_WILDCARD) man tests/integration/gitea-integration-*
|
|
|
|
.PHONY: fmt
|
|
fmt: ## format the Go and template code
|
|
$(GO) run $(GOLANGCI_LINT_PACKAGE) fmt
|
|
$(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl'))
|
|
@# strip whitespace after '{{' or '(' and before '}}' or ')' unless there is only
|
|
@# whitespace before it
|
|
@$(SED_INPLACE) \
|
|
-e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' \
|
|
-e 's/([ ]\{1,\}/(/g' -e '/^[ ]\{1,\})/! s/[ ]\{1,\})/)/g' \
|
|
$(TEMPLATES)
|
|
|
|
.PHONY: fmt-check
|
|
fmt-check: fmt
|
|
@diff=$$(git diff --color=always $(GO_SOURCES) templates $(WEB_DIRS)); \
|
|
if [ -n "$$diff" ]; then \
|
|
echo "Please run 'make fmt' and commit the result:"; \
|
|
printf "%s" "$${diff}"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: $(TAGS_EVIDENCE)
|
|
$(TAGS_EVIDENCE):
|
|
@mkdir -p $(MAKE_EVIDENCE_DIR)
|
|
@echo "$(TAGS)" > $(TAGS_EVIDENCE)
|
|
|
|
ifneq "$(TAGS)" "$(shell cat $(TAGS_EVIDENCE) 2>/dev/null)"
|
|
TAGS_PREREQ := $(TAGS_EVIDENCE)
|
|
endif
|
|
|
|
.PHONY: generate-swagger
|
|
generate-swagger: $(SWAGGER_SPEC) $(OPENAPI3_SPEC) ## generate the swagger spec from code comments
|
|
|
|
$(SWAGGER_SPEC): $(GO_SOURCES) $(SWAGGER_SPEC_INPUT)
|
|
$(GO) run $(SWAGGER_PACKAGE) generate spec --exclude "$(SWAGGER_EXCLUDE)" --input "$(SWAGGER_SPEC_INPUT)" --output './$(SWAGGER_SPEC)'
|
|
|
|
.PHONY: swagger-check
|
|
swagger-check: generate-swagger
|
|
@diff=$$(git diff --color=always '$(SWAGGER_SPEC)'); \
|
|
if [ -n "$$diff" ]; then \
|
|
echo "Please run 'make generate-swagger' and commit the result:"; \
|
|
printf "%s" "$${diff}"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: swagger-validate
|
|
swagger-validate: ## check if the swagger spec is valid
|
|
@# swagger "validate" requires that the "basePath" must start with a slash, but we are using Golang template "{{...}}"
|
|
@$(SED_INPLACE) -E -e 's|"basePath":( *)"(.*)"|"basePath":\1"/\2"|g' './$(SWAGGER_SPEC)' # add a prefix slash to basePath
|
|
@# FIXME: there are some warnings
|
|
$(GO) run $(SWAGGER_PACKAGE) validate './$(SWAGGER_SPEC)'
|
|
@$(SED_INPLACE) -E -e 's|"basePath":( *)"/(.*)"|"basePath":\1"\2"|g' './$(SWAGGER_SPEC)' # remove the prefix slash from basePath
|
|
|
|
.PHONY: generate-openapi3
|
|
generate-openapi3: $(OPENAPI3_SPEC) ## generate the OpenAPI 3.0 spec from the Swagger 2.0 spec
|
|
|
|
$(OPENAPI3_SPEC): $(SWAGGER_SPEC) build/generate-openapi.go $(wildcard build/openapi3gen/*.go)
|
|
$(GO) run build/generate-openapi.go
|
|
|
|
.PHONY: openapi3-check
|
|
openapi3-check: generate-openapi3
|
|
@diff=$$(git diff --color=always '$(OPENAPI3_SPEC)'); \
|
|
if [ -n "$$diff" ]; then \
|
|
echo "Please run 'make generate-openapi3' and commit the result:"; \
|
|
printf "%s" "$${diff}"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: checks
|
|
checks: checks-frontend checks-backend ## run various consistency checks
|
|
|
|
.PHONY: checks-frontend
|
|
checks-frontend: lockfile-check svg-check ## check frontend files
|
|
|
|
.PHONY: checks-backend
|
|
checks-backend: tidy-check swagger-check openapi3-check fmt-check swagger-validate security-check ## check backend files
|
|
|
|
.PHONY: lint
|
|
lint: lint-frontend lint-backend lint-templates lint-swagger lint-spell lint-md lint-actions lint-json lint-yaml lint-shell ## lint everything
|
|
|
|
.PHONY: lint-fix
|
|
lint-fix: lint-frontend-fix lint-backend-fix lint-spell-fix ## lint everything and fix issues
|
|
|
|
.PHONY: lint-frontend
|
|
lint-frontend: lint-js lint-css ## lint frontend files
|
|
|
|
.PHONY: lint-frontend-fix
|
|
lint-frontend-fix: lint-js-fix lint-css-fix ## lint frontend files and fix issues
|
|
|
|
.PHONY: lint-backend
|
|
lint-backend: lint-go lint-editorconfig ## lint backend files
|
|
|
|
.PHONY: lint-backend-fix
|
|
lint-backend-fix: lint-go-fix lint-editorconfig ## lint backend files and fix issues
|
|
|
|
.PHONY: lint-js
|
|
lint-js: node_modules ## lint js and ts files
|
|
pnpm exec eslint --color --max-warnings=0 --concurrency $(ESLINT_CONCURRENCY) $(ESLINT_FILES)
|
|
pnpm exec vue-tsc
|
|
|
|
.PHONY: lint-js-fix
|
|
lint-js-fix: node_modules ## lint js and ts files and fix issues
|
|
pnpm exec eslint --color --max-warnings=0 --concurrency $(ESLINT_CONCURRENCY) $(ESLINT_FILES) --fix
|
|
pnpm exec vue-tsc
|
|
|
|
.PHONY: lint-css
|
|
lint-css: node_modules ## lint css files
|
|
pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES)
|
|
|
|
.PHONY: lint-css-fix
|
|
lint-css-fix: node_modules ## lint css files and fix issues
|
|
pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES) --fix
|
|
|
|
.PHONY: lint-swagger
|
|
lint-swagger: node_modules ## lint swagger files
|
|
pnpm exec spectral lint -q -F hint $(SWAGGER_SPEC)
|
|
|
|
.PHONY: lint-md
|
|
lint-md: node_modules ## lint markdown files
|
|
pnpm exec markdownlint *.md
|
|
|
|
.PHONY: lint-md-fix
|
|
lint-md-fix: node_modules ## lint markdown files and fix issues
|
|
pnpm exec markdownlint --fix *.md
|
|
|
|
.PHONY: lint-spell
|
|
lint-spell: ## lint spelling
|
|
@git ls-files $(SPELLCHECK_FILES) | xargs go run $(MISSPELL_PACKAGE) -dict assets/misspellings.csv -error
|
|
|
|
.PHONY: lint-spell-fix
|
|
lint-spell-fix: ## lint spelling and fix issues
|
|
@git ls-files $(SPELLCHECK_FILES) | xargs go run $(MISSPELL_PACKAGE) -dict assets/misspellings.csv -w
|
|
|
|
.PHONY: lint-go
|
|
lint-go: ## lint go files
|
|
GO=$(GO) GOLANGCI_LINT_PACKAGE=$(GOLANGCI_LINT_PACKAGE) $(GO) run ./tools/lint-go-all.go
|
|
|
|
.PHONY: lint-go-fix
|
|
lint-go-fix: ## lint go files and fix issues
|
|
GO=$(GO) GOLANGCI_LINT_PACKAGE=$(GOLANGCI_LINT_PACKAGE) $(GO) run ./tools/lint-go-all.go --fix
|
|
|
|
.PHONY: lint-editorconfig
|
|
lint-editorconfig:
|
|
@echo "Running editorconfig check..."
|
|
@$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) $(EDITORCONFIG_FILES)
|
|
|
|
.PHONY: lint-actions
|
|
lint-actions: .venv ## lint action workflow files
|
|
@$(GO) run $(ACTIONLINT_PACKAGE)
|
|
@uv run --frozen zizmor --quiet --min-confidence=medium .github
|
|
|
|
.PHONY: lint-shell
|
|
lint-shell: ## lint shell scripts
|
|
@SHELLCHECK_IMAGE=$(SHELLCHECK_IMAGE) CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) ./tools/lint-shell.sh $$(git ls-files '*.sh')
|
|
|
|
.PHONY: lint-templates
|
|
lint-templates: .venv node_modules ## lint template files
|
|
@node tools/lint-templates-svg.ts
|
|
@uv run --frozen djlint $(shell find templates -type f -iname '*.tmpl')
|
|
|
|
.PHONY: lint-yaml
|
|
lint-yaml: .venv ## lint yaml files
|
|
@uv run --frozen yamllint -s .
|
|
|
|
.PHONY: lint-json
|
|
lint-json: node_modules ## lint json files
|
|
pnpm exec eslint -c eslint.json.config.ts --color --max-warnings=0 --concurrency $(ESLINT_CONCURRENCY)
|
|
|
|
.PHONY: lint-json-fix
|
|
lint-json-fix: node_modules ## lint and fix json files
|
|
pnpm exec eslint -c eslint.json.config.ts --color --max-warnings=0 --concurrency $(ESLINT_CONCURRENCY) --fix
|
|
|
|
.PHONY: watch
|
|
watch: ## watch everything and continuously rebuild
|
|
@bash tools/watch.sh
|
|
|
|
.PHONY: watch-frontend
|
|
watch-frontend: node_modules ## start vite dev server for frontend
|
|
NODE_ENV=development pnpm exec vite --logLevel $(FRONTEND_DEV_LOG_LEVEL)
|
|
|
|
.PHONY: watch-backend
|
|
watch-backend: ## watch backend files and continuously rebuild
|
|
GITEA_RUN_MODE=dev $(GO) run $(AIR_PACKAGE) -c .air.toml
|
|
|
|
.PHONY: test-backend
|
|
test-backend: ## test backend files
|
|
@echo "Running go test with $(GOTEST_FLAGS) -tags '$(TAGS)'..."
|
|
@$(GO) test $(GOTEST_FLAGS) -tags='$(TAGS)' $(GO_TEST_PACKAGES)
|
|
|
|
.PHONY: test-frontend
|
|
test-frontend: node_modules ## test frontend files
|
|
pnpm exec vitest
|
|
|
|
.PHONY: test-check
|
|
test-check:
|
|
@echo "Running test-check...";
|
|
@diff=$$(git status -s); \
|
|
if [ -n "$$diff" ]; then \
|
|
echo "make test-backend has changed files in the source tree:"; \
|
|
printf "%s" "$${diff}"; \
|
|
echo "You should change the tests to create these files in a temporary directory."; \
|
|
echo "Do not simply add these files to .gitignore"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: test-backend\#%
|
|
test-backend\#%:
|
|
@echo "Running go test with -tags '$(TAGS)'..."
|
|
@$(GO) test $(GOTEST_FLAGS) -tags='$(TAGS)' -run $(subst .,/,$*) $(GO_TEST_PACKAGES)
|
|
|
|
.PHONY: coverage
|
|
coverage:
|
|
grep '^\(mode: .*\)\|\(.*:[0-9]\+\.[0-9]\+,[0-9]\+\.[0-9]\+ [0-9]\+ [0-9]\+\)$$' coverage.out > coverage-bodged.out
|
|
grep '^\(mode: .*\)\|\(.*:[0-9]\+\.[0-9]\+,[0-9]\+\.[0-9]\+ [0-9]\+ [0-9]\+\)$$' integration.coverage.out > integration.coverage-bodged.out
|
|
$(GO) run tools/gocovmerge.go integration.coverage-bodged.out coverage-bodged.out > coverage.all
|
|
|
|
.PHONY: unit-test-coverage
|
|
unit-test-coverage:
|
|
@echo "Running unit-test-coverage $(GOTEST_FLAGS) -tags '$(TAGS)'..."
|
|
@$(GO) test $(GOTEST_FLAGS) -tags='$(TAGS)' -cover -coverprofile coverage.out $(GO_TEST_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
|
|
|
.PHONY: tidy
|
|
tidy: ## run go mod tidy
|
|
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
|
|
$(GO) mod tidy -compat=$(MIN_GO_VERSION)
|
|
@$(MAKE) --no-print-directory $(GO_LICENSE_FILE)
|
|
|
|
vendor: go.mod go.sum
|
|
$(GO) mod vendor
|
|
@touch vendor
|
|
|
|
.PHONY: tidy-check
|
|
tidy-check: tidy
|
|
@diff=$$(git diff --color=always go.mod go.sum $(GO_LICENSE_FILE)); \
|
|
if [ -n "$$diff" ]; then \
|
|
echo "Please run 'make tidy' and commit the result:"; \
|
|
printf "%s" "$${diff}"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: go-licenses
|
|
go-licenses: $(GO_LICENSE_FILE) ## regenerate go licenses
|
|
|
|
$(GO_LICENSE_FILE): go.mod go.sum
|
|
GO=$(GO) $(GO) run build/generate-go-licenses.go $(GO_LICENSE_FILE)
|
|
|
|
.PHONY: test-integration
|
|
test-integration:
|
|
@# Use a compiled binary: testlogger forwards gitea logs to t.Log, so `go test -v`
|
|
@# would flood output per passing test. testcache can't help these tests anyway —
|
|
@# they mutate the work directory, so cache inputs change between runs.
|
|
$(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -c gitea.dev/tests/integration -o ./test-integration-$(GITEA_TEST_DATABASE).test
|
|
./tools/test-integration.sh ./test-integration-$(GITEA_TEST_DATABASE).test
|
|
|
|
.PHONY: test-integration-compile
|
|
test-integration-compile:
|
|
$(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -c -o /dev/null gitea.dev/tests/integration
|
|
|
|
.PHONY: test-integration\#%
|
|
test-integration\#%:
|
|
$(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -run $(subst .,/,$*) gitea.dev/tests/integration
|
|
|
|
.PHONY: test-migration
|
|
test-migration: migrations.integration.test migrations.individual.test
|
|
|
|
.PHONY: migrations.integration.test
|
|
migrations.integration.test:
|
|
$(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' gitea.dev/tests/integration/migration-test
|
|
|
|
.PHONY: migrations.individual.test
|
|
migrations.individual.test:
|
|
@# tests of multiple packages use the same database, don't run in parallel
|
|
$(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -p 1 $(MIGRATE_TEST_PACKAGES)
|
|
|
|
.PHONY: migrations.individual.test\#%
|
|
migrations.individual.test\#%:
|
|
$(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' gitea.dev/models/migrations/$*
|
|
|
|
.PHONY: playwright
|
|
playwright: deps-frontend
|
|
@CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) ./tools/test-e2e.sh install
|
|
|
|
.PHONY: test-e2e
|
|
test-e2e: playwright frontend backend
|
|
@CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) EXECUTABLE=$(EXECUTABLE) ./tools/test-e2e.sh run $(GITEA_TEST_E2E_FLAGS)
|
|
|
|
.PHONY: build
|
|
build: frontend backend ## build everything
|
|
|
|
.PHONY: frontend
|
|
frontend: $(FRONTEND_DEST) ## build frontend files
|
|
|
|
.PHONY: backend
|
|
backend: generate-backend $(EXECUTABLE) ## build backend files
|
|
|
|
# We generate the backend before the frontend in case we in future we want to generate things in the frontend from generated files in backend
|
|
.PHONY: generate
|
|
generate: generate-backend ## run "go generate"
|
|
|
|
.PHONY: generate-backend
|
|
generate-backend: $(TAGS_PREREQ) generate-go
|
|
|
|
.PHONY: generate-go
|
|
generate-go: $(TAGS_PREREQ)
|
|
@echo "Running go generate..."
|
|
@CC= GOOS= GOARCH= CGO_ENABLED=0 $(GO) generate -tags '$(TAGS)' ./...
|
|
|
|
.PHONY: security-check
|
|
security-check:
|
|
GOEXPERIMENT= go run $(GOVULNCHECK_PACKAGE) -show color ./... || true
|
|
|
|
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
|
|
ifneq ($(and $(STATIC),$(findstring pam,$(TAGS))),)
|
|
$(error pam support set via TAGS does not support static builds)
|
|
endif
|
|
CGO_ENABLED="$(CGO_ENABLED)" CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@
|
|
|
|
.PHONY: release
|
|
release: frontend generate release-windows release-linux release-darwin release-freebsd release-copy release-compress vendor release-sources release-check
|
|
|
|
$(DIST_DIRS):
|
|
mkdir -p $(DIST_DIRS)
|
|
|
|
.PHONY: release-windows
|
|
release-windows: | $(DIST_DIRS)
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo $(TAGS)' -ldflags '-s -w -linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
|
|
ifeq (,$(findstring gogit,$(TAGS)))
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo gogit $(TAGS)' -ldflags '-s -w -linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
|
|
endif
|
|
|
|
.PHONY: release-linux
|
|
release-linux: | $(DIST_DIRS)
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-s -w -linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
|
|
|
|
.PHONY: release-darwin
|
|
release-darwin: | $(DIST_DIRS)
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
|
|
|
|
.PHONY: release-freebsd
|
|
release-freebsd: | $(DIST_DIRS)
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets 'freebsd/amd64' -out gitea-$(VERSION) .
|
|
|
|
.PHONY: release-copy
|
|
release-copy: | $(DIST_DIRS)
|
|
cd $(DIST); for file in `find . -type f -name "*"`; do cp $${file} ./release/; done;
|
|
|
|
.PHONY: release-check
|
|
release-check: | $(DIST_DIRS)
|
|
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done;
|
|
|
|
.PHONY: release-compress
|
|
release-compress: | $(DIST_DIRS)
|
|
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && $(GO) run $(GXZ_PACKAGE) -k -9 $${file}; done;
|
|
|
|
.PHONY: release-sources
|
|
release-sources: | $(DIST_DIRS)
|
|
echo $(VERSION) > $(STORED_VERSION_FILE)
|
|
# bsdtar needs a ^ to prevent matching subdirectories
|
|
$(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
|
|
# use transform to a add a release-folder prefix; in bsdtar the transform parameter equivalent is -s
|
|
$(eval TRANSFORM := $(shell tar --help | grep -q bsdtar && echo "-s '/^./gitea-src-$(VERSION)/'" || echo "--transform 's|^./|gitea-src-$(VERSION)/|'"))
|
|
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) $(TRANSFORM) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
|
|
rm -f $(STORED_VERSION_FILE)
|
|
|
|
.PHONY: deps
|
|
deps: deps-frontend deps-backend deps-tools deps-py ## install dependencies
|
|
|
|
.PHONY: deps-py
|
|
deps-py: .venv ## install python dependencies
|
|
|
|
.PHONY: deps-frontend
|
|
deps-frontend: node_modules ## install frontend dependencies
|
|
|
|
.PHONY: deps-backend
|
|
deps-backend: ## install backend dependencies
|
|
$(GO) mod download
|
|
|
|
.PHONY: deps-tools
|
|
deps-tools: ## install tool dependencies
|
|
$(GO) install $(AIR_PACKAGE) & \
|
|
$(GO) install $(EDITORCONFIG_CHECKER_PACKAGE) & \
|
|
$(GO) install $(GOLANGCI_LINT_PACKAGE) & \
|
|
$(GO) install $(GXZ_PACKAGE) & \
|
|
$(GO) install $(MISSPELL_PACKAGE) & \
|
|
$(GO) install $(SWAGGER_PACKAGE) & \
|
|
$(GO) install $(XGO_PACKAGE) & \
|
|
$(GO) install $(GOVULNCHECK_PACKAGE) & \
|
|
$(GO) install $(ACTIONLINT_PACKAGE) & \
|
|
wait
|
|
|
|
node_modules: pnpm-lock.yaml
|
|
pnpm install --frozen-lockfile
|
|
@touch node_modules
|
|
|
|
.venv: uv.lock
|
|
uv sync
|
|
@touch .venv
|
|
|
|
.PHONY: update
|
|
update: update-go update-js update-py ## update dependencies
|
|
|
|
.PHONY: update-go
|
|
update-go: ## update go dependencies
|
|
$(GO) get -u ./...
|
|
$(MAKE) tidy
|
|
|
|
.PHONY: update-js
|
|
update-js: node_modules ## update js dependencies
|
|
pnpm exec updates -u -f package.json
|
|
rm -rf node_modules pnpm-lock.yaml
|
|
pnpm install
|
|
@touch node_modules
|
|
|
|
.PHONY: update-py
|
|
update-py: node_modules ## update py dependencies
|
|
pnpm exec updates -u -f pyproject.toml
|
|
rm -rf .venv uv.lock
|
|
uv sync
|
|
@touch .venv
|
|
|
|
.PHONY: vite
|
|
vite: $(FRONTEND_DEST) ## build vite files
|
|
|
|
$(FRONTEND_DEST): $(FRONTEND_SOURCES) $(FRONTEND_CONFIGS) pnpm-lock.yaml
|
|
@$(MAKE) -s node_modules
|
|
@rm -rf $(FRONTEND_DEST_ENTRIES)
|
|
@echo "Running vite build..."
|
|
@pnpm exec vite build
|
|
@touch $(FRONTEND_DEST)
|
|
|
|
.PHONY: svg
|
|
svg: node_modules ## build svg files
|
|
rm -rf $(SVG_DEST_DIR)
|
|
node tools/generate-svg.ts
|
|
|
|
.PHONY: svg-check
|
|
svg-check: svg
|
|
@git add $(SVG_DEST_DIR)
|
|
@diff=$$(git diff --color=always --cached $(SVG_DEST_DIR)); \
|
|
if [ -n "$$diff" ]; then \
|
|
echo "Please run 'make svg' and 'git add $(SVG_DEST_DIR)' and commit the result:"; \
|
|
printf "%s" "$${diff}"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: lockfile-check
|
|
lockfile-check:
|
|
pnpm install --frozen-lockfile
|
|
@diff=$$(git diff --color=always pnpm-lock.yaml); \
|
|
if [ -n "$$diff" ]; then \
|
|
echo "pnpm-lock.yaml is inconsistent with package.json"; \
|
|
echo "Please run 'pnpm install --frozen-lockfile' and commit the result:"; \
|
|
printf "%s" "$${diff}"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: generate-gitignore
|
|
generate-gitignore: ## update gitignore files
|
|
$(GO) run build/generate-gitignores.go
|
|
|
|
.PHONY: generate-images
|
|
generate-images: | node_modules ## generate images
|
|
cd tools && node generate-images.ts $(TAGS)
|
|
|
|
.PHONY: generate-codemirror-languages
|
|
generate-codemirror-languages: | node_modules ## generate codemirror languages
|
|
node tools/generate-codemirror-languages.ts
|
|
|
|
.PHONY: generate-manpage
|
|
generate-manpage: ## generate manpage
|
|
@[ -f gitea ] || make backend
|
|
@mkdir -p man/man1/ man/man5
|
|
@./gitea docs --man > man/man1/gitea.1
|
|
@gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created
|
|
@#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page
|
|
|
|
# Disable parallel execution because it would break some targets that don't
|
|
# specify exact dependencies like 'backend' which does currently not depend
|
|
# on 'frontend' to enable Node.js-less builds from source tarballs.
|
|
.NOTPARALLEL:
|