2016-11-04 13:58:55 +01:00
DIST := dist
2020-02-19 04:10:25 +01:00
DIST_DIRS := $( DIST) /binaries $( DIST) /release
2017-06-15 15:51:23 +02:00
2025-09-28 04:03:36 -04:00
# By default use go's 1.25 experimental json v2 library when building
# TODO: remove when no longer experimental
export GOEXPERIMENT ?= jsonv2
2017-08-16 08:46:41 +08:00
GO ?= go
2019-04-14 11:06:43 -04:00
SHASUM ?= shasum -a 256
2020-03-09 01:11:39 +01:00
COMMA := ,
2020-02-02 02:43:35 +00:00
2026-04-29 18:37:38 +02:00
XGO_VERSION := go-1.26.x
2022-03-16 03:50:26 +01:00
2026-06-01 14:05:09 -07:00
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
2026-05-08 06:49:34 +02:00
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 # renovate: datasource=go
2026-04-26 16:25:22 +02:00
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
2026-06-08 13:41:45 -07:00
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.34.0 # renovate: datasource=go
2026-05-08 06:49:34 +02:00
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
2026-05-22 22:22:04 +02:00
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)
2020-03-20 10:29:31 -04:00
2026-04-29 18:37:38 +02:00
HAS_GO := $( shell hash $( GO) > /dev/null 2>& 1 && echo yes)
2023-04-17 16:46:25 +02:00
ifeq ( $( HAS_GO ) , yes)
2020-06-06 01:57:25 +02:00
CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER= 32766
CGO_CFLAGS ?= $( shell $( GO) env CGO_CFLAGS) $( CGO_EXTRA_CFLAGS)
2020-02-02 02:43:35 +00:00
endif
2017-06-15 15:51:23 +02:00
2026-04-29 18:37:38 +02:00
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
2025-08-06 22:22:08 +02:00
CGO_ENABLED ?= 0
2026-05-07 02:57:59 +08:00
ifneq (, $( findstring sqlite_mattn ,$( TAGS ))$( findstring pam ,$( TAGS )) )
2025-08-06 22:22:08 +02:00
CGO_ENABLED = 1
endif
STATIC ?=
EXTLDFLAGS ?=
ifneq ( $( STATIC ) ,)
EXTLDFLAGS = -extldflags "-static"
endif
2023-10-06 20:39:21 +00:00
ifeq ( $( GOOS ) ,windows)
IS_WINDOWS := yes
else ifeq ( $( patsubst Windows %,Windows ,$( OS )) ,Windows)
ifeq ( $( GOOS ) ,)
IS_WINDOWS := yes
endif
endif
2026-04-29 18:37:38 +02:00
# GOFLAGS and EXTRA_GOFLAGS are for the 'go build' command only
2023-10-06 20:39:21 +00:00
ifeq ( $( IS_WINDOWS ) ,yes)
2021-05-29 15:37:21 +08:00
GOFLAGS := -v -buildmode= exe
EXECUTABLE ?= gitea.exe
2017-06-15 15:51:23 +02:00
else
2020-08-24 17:46:41 -04:00
GOFLAGS := -v
2019-04-29 19:08:21 +01:00
EXECUTABLE ?= gitea
2020-07-27 22:13:15 +02:00
endif
2026-04-29 18:37:38 +02:00
EXTRA_GOFLAGS ?=
2020-07-27 22:13:15 +02:00
ifeq ( $( shell sed --version 2>/dev /null | grep -q GNU && echo gnu ) ,gnu)
SED_INPLACE := sed -i
else
SED_INPLACE := sed -i ''
2017-06-15 15:51:23 +02:00
endif
2026-04-29 18:37:38 +02:00
# GOTEST_FLAGS is for unit test and integration test
GOTEST_FLAGS ?= -timeout 40m
2020-01-29 23:43:07 +08:00
2020-02-22 10:15:11 +01:00
STORED_VERSION_FILE := VERSION
2023-06-20 01:37:32 -04:00
GITHUB_REF_TYPE ?= branch
GITHUB_REF_NAME ?= $( shell git rev-parse --abbrev-ref HEAD)
2023-06-17 23:26:49 -04:00
ifneq ( $( GITHUB_REF_TYPE ) ,branch)
VERSION ?= $( subst v,,$( GITHUB_REF_NAME))
2023-06-23 02:52:15 -05:00
GITEA_VERSION ?= $( VERSION)
2018-07-12 06:32:01 +03:00
else
2023-06-17 23:26:49 -04:00
ifneq ( $( GITHUB_REF_NAME ) ,)
2024-05-22 19:34:52 -04:00
VERSION ?= $( subst release/v,,$( GITHUB_REF_NAME)) -nightly
2018-07-12 06:32:01 +03:00
else
2021-05-04 12:16:23 -04:00
VERSION ?= main
2018-07-12 06:32:01 +03:00
endif
2020-02-22 10:15:11 +01:00
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
2018-07-12 06:32:01 +03:00
endif
2023-04-24 11:43:19 -04:00
# if version = "main" then update version to "nightly"
ifeq ( $( VERSION ) ,main)
VERSION := main-nightly
endif
2026-02-19 02:23:32 +01:00
LDFLAGS := $( LDFLAGS) -X "main.Version= $( GITEA_VERSION) " -X "main.Tags= $( TAGS) "
2015-11-03 12:16:43 -05:00
2025-04-15 00:32:54 +08:00
LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/riscv64
2021-02-22 15:01:57 +08:00
2026-05-26 15:49:31 -07:00
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/...)
2019-12-05 04:41:38 +01:00
2026-03-29 12:24:30 +02:00
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
2026-04-01 20:15:02 +02:00
FRONTEND_DEV_LOG_LEVEL ?= warn
2020-03-03 20:51:11 +01:00
2025-06-16 20:03:51 +08:00
BINDATA_DEST_WILDCARD := modules/migration/bindata.* modules/public/bindata.* modules/options/bindata.* modules/templates/bindata.*
2019-12-05 04:41:38 +01:00
2022-09-05 07:04:18 +01:00
GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go
2023-07-19 00:06:43 +08:00
SVG_DEST_DIR := public/assets/img/svg
2020-07-12 11:10:56 +02:00
2020-07-27 20:05:42 +02:00
AIR_TMP_DIR := .air
2022-09-04 00:20:46 +02:00
GO_LICENSE_FILE := assets/go-licenses.json
2026-02-18 05:13:26 +01:00
TAR_EXCLUDES := .git data indexers queues log node_modules $( EXECUTABLE) $( DIST) $( MAKE_EVIDENCE_DIR) $( AIR_TMP_DIR)
2021-04-09 07:08:14 +02:00
2025-10-28 12:23:50 +01:00
GO_DIRS := build cmd models modules routers services tests tools
2023-03-15 03:20:19 +01:00
WEB_DIRS := web_src/js web_src/css
2020-12-17 14:00:47 +00:00
2025-09-14 18:15:06 +02:00
ESLINT_FILES := web_src/js tools *.ts tests/e2e
2024-03-17 23:12:36 +01:00
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
2025-12-19 09:50:48 -08:00
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
2024-02-09 04:59:39 +01:00
2020-03-09 01:11:39 +01:00
GO_SOURCES := $( wildcard *.go)
2025-06-12 11:59:33 +08:00
GO_SOURCES += $( shell find $( GO_DIRS) -type f -name "*.go" )
2022-09-05 07:04:18 +01:00
GO_SOURCES += $( GENERATED_GO_DEST)
2020-03-09 01:11:39 +01:00
2026-03-10 18:05:52 +01:00
ESLINT_CONCURRENCY ?= 2
2022-09-02 15:18:23 -04:00
2018-07-28 02:19:01 +02:00
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
2025-02-21 16:04:30 +08:00
SWAGGER_SPEC_INPUT := templates/swagger/v1_input.json
2026-05-27 16:23:44 -07:00
SWAGGER_EXCLUDE := gitea.dev/sdk
2026-04-29 08:47:52 -04:00
OPENAPI3_SPEC := templates/swagger/v1_openapi3_json.tmpl
2018-07-28 02:19:01 +02:00
2017-09-13 09:03:20 +03:00
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
2020-01-20 12:45:14 -03:00
TEST_PGSQL_SCHEMA ?= gtestschema
2024-10-03 03:00:56 +02:00
TEST_MINIO_ENDPOINT ?= minio:9000
2018-12-12 02:01:41 +01:00
TEST_MSSQL_HOST ?= mssql:1433
2026-05-01 23:38:38 +08:00
TEST_MSSQL_DBNAME ?= testgitea
2018-12-12 02:01:41 +01:00
TEST_MSSQL_USERNAME ?= sa
TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
2017-09-13 09:03:20 +03:00
2025-11-08 15:23:55 -05:00
# Include local Makefile
# Makefile.local is listed in .gitignore
2026-04-29 18:37:38 +02:00
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
2025-11-08 15:23:55 -05:00
2016-11-04 13:58:55 +01:00
.PHONY : all
2016-11-18 09:57:30 +01:00
all : build
2015-11-03 12:16:43 -05:00
2020-01-05 18:40:02 +01:00
.PHONY : help
2025-01-27 09:44:09 +08:00
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)
2026-02-21 01:26:47 +01:00
@printf " \033[36m%-46s\033[0m %s\n" "test-e2e" "test end to end using playwright"
2026-04-29 18:37:38 +02:00
@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)"
2020-01-13 21:06:54 -03:00
2019-12-05 04:41:38 +01:00
.PHONY : clean -all
2025-01-27 09:44:09 +08:00
clean-all : clean ## delete backend, frontend and integration files
2026-03-29 12:24:30 +02:00
rm -rf $( FRONTEND_DEST_ENTRIES) node_modules
2019-12-05 04:41:38 +01:00
2016-11-04 13:58:55 +01:00
.PHONY : clean
2025-01-27 09:44:09 +08:00
clean : ## delete backend and integration files
2026-04-29 18:37:38 +02:00
rm -f $( EXECUTABLE) test-*.test tests/*.ini
rm -rf $( DIST) $( BINDATA_DEST_WILDCARD) man tests/integration/gitea-integration-*
2015-11-08 14:31:49 -05:00
2016-11-04 13:58:55 +01:00
.PHONY : fmt
2025-06-18 21:30:40 +02:00
fmt : ## format the Go and template code
2026-04-17 19:45:22 +02:00
$( GO) run $( GOLANGCI_LINT_PACKAGE) fmt
2022-08-31 17:58:54 +02:00
$( eval TEMPLATES := $( shell find templates -type f -name '*.tmpl' ))
2023-04-24 08:48:43 +02:00
@# 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)
2016-11-04 13:58:55 +01:00
2022-10-16 10:11:17 +02:00
.PHONY : fmt -check
fmt-check : fmt
2023-03-19 02:47:47 +01:00
@diff= $$ ( git diff --color= always $( GO_SOURCES) templates $( WEB_DIRS) ) ; \
2022-10-16 10:11:17 +02:00
if [ -n " $$ diff" ] ; then \
echo "Please run 'make fmt' and commit the result:" ; \
2025-02-21 00:05:40 +08:00
printf "%s" " $$ {diff}" ; \
2022-10-16 10:11:17 +02:00
exit 1; \
fi
2020-02-11 20:42:03 +01:00
.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
2017-06-15 15:51:23 +02:00
.PHONY : generate -swagger
2026-04-29 08:47:52 -04:00
generate-swagger : $( SWAGGER_SPEC ) $( OPENAPI 3_SPEC ) ## generate the swagger spec from code comments
2022-09-05 07:04:18 +01:00
2025-06-12 11:59:33 +08:00
$(SWAGGER_SPEC) : $( GO_SOURCES ) $( SWAGGER_SPEC_INPUT )
2025-02-21 16:04:30 +08:00
$( GO) run $( SWAGGER_PACKAGE) generate spec --exclude " $( SWAGGER_EXCLUDE) " --input " $( SWAGGER_SPEC_INPUT) " --output './$(SWAGGER_SPEC)'
2017-07-11 21:28:57 -05:00
2018-04-20 11:13:50 +02:00
.PHONY : swagger -check
swagger-check : generate -swagger
2023-03-19 02:47:47 +01:00
@diff= $$ ( git diff --color= always '$(SWAGGER_SPEC)' ) ; \
2018-04-20 11:13:50 +02:00
if [ -n " $$ diff" ] ; then \
echo "Please run 'make generate-swagger' and commit the result:" ; \
2025-02-21 00:05:40 +08:00
printf "%s" " $$ {diff}" ; \
2018-04-20 11:13:50 +02:00
exit 1; \
2020-11-29 22:39:36 +01:00
fi
2018-04-20 11:13:50 +02:00
2018-06-02 07:29:12 -04:00
.PHONY : swagger -validate
2025-01-27 09:44:09 +08:00
swagger-validate : ## check if the swagger spec is valid
2025-02-21 16:04:30 +08:00
@# 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
2022-03-16 03:50:26 +01:00
$( GO) run $( SWAGGER_PACKAGE) validate './$(SWAGGER_SPEC)'
2025-02-21 16:04:30 +08:00
@$( SED_INPLACE) -E -e 's|"basePath":( *)"/(.*)"|"basePath":\1"\2"|g' './$(SWAGGER_SPEC)' # remove the prefix slash from basePath
2018-06-02 07:29:12 -04:00
2026-04-29 08:47:52 -04:00
.PHONY : generate -openapi 3
generate-openapi3 : $( OPENAPI 3_SPEC ) ## generate the OpenAPI 3.0 spec from the Swagger 2.0 spec
$(OPENAPI3_SPEC) : $( SWAGGER_SPEC ) build /generate -openapi .go $( wildcard build /openapi 3gen /*.go )
$( GO) run build/generate-openapi.go
.PHONY : openapi 3-check
openapi3-check : generate -openapi 3
@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
2020-08-16 23:43:09 +02:00
.PHONY : checks
2025-01-27 09:44:09 +08:00
checks : checks -frontend checks -backend ## run various consistency checks
2020-03-29 13:56:58 +02:00
2020-08-16 23:43:09 +02:00
.PHONY : checks -frontend
2025-01-27 09:44:09 +08:00
checks-frontend : lockfile -check svg -check ## check frontend files
2020-08-16 23:43:09 +02:00
.PHONY : checks -backend
2026-04-29 08:47:52 -04:00
checks-backend : tidy -check swagger -check openapi 3-check fmt -check swagger -validate security -check ## check backend files
2020-08-16 23:43:09 +02:00
.PHONY : lint
2026-05-22 22:22:04 +02:00
lint : lint -frontend lint -backend lint -templates lint -swagger lint -spell lint -md lint -actions lint -json lint -yaml lint -shell ## lint everything
2020-03-29 13:56:58 +02:00
2023-04-22 20:53:00 +02:00
.PHONY : lint -fix
2025-01-27 09:44:09 +08:00
lint-fix : lint -frontend -fix lint -backend -fix lint -spell -fix ## lint everything and fix issues
2023-04-22 20:53:00 +02:00
2020-03-29 13:56:58 +02:00
.PHONY : lint -frontend
2025-01-27 09:44:09 +08:00
lint-frontend : lint -js lint -css ## lint frontend files
2023-04-22 20:53:00 +02:00
.PHONY : lint -frontend -fix
2025-01-27 09:44:09 +08:00
lint-frontend-fix : lint -js -fix lint -css -fix ## lint frontend files and fix issues
2023-04-22 20:53:00 +02:00
.PHONY : lint -backend
2026-04-17 19:45:22 +02:00
lint-backend : lint -go lint -editorconfig ## lint backend files
2023-04-22 20:53:00 +02:00
.PHONY : lint -backend -fix
2026-04-17 19:45:22 +02:00
lint-backend-fix : lint -go -fix lint -editorconfig ## lint backend files and fix issues
2023-04-22 20:53:00 +02:00
.PHONY : lint -js
2026-01-31 13:58:23 +01:00
lint-js : node_modules ## lint js and ts files
2026-03-31 18:50:51 +02:00
pnpm exec eslint --color --max-warnings= 0 --concurrency $( ESLINT_CONCURRENCY) $( ESLINT_FILES)
pnpm exec vue-tsc
2023-04-22 20:53:00 +02:00
.PHONY : lint -js -fix
2026-01-31 13:58:23 +01:00
lint-js-fix : node_modules ## lint js and ts files and fix issues
2026-03-31 18:50:51 +02:00
pnpm exec eslint --color --max-warnings= 0 --concurrency $( ESLINT_CONCURRENCY) $( ESLINT_FILES) --fix
pnpm exec vue-tsc
2023-04-22 20:53:00 +02:00
.PHONY : lint -css
2025-01-27 09:44:09 +08:00
lint-css : node_modules ## lint css files
2026-03-31 18:50:51 +02:00
pnpm exec stylelint --color --max-warnings= 0 $( STYLELINT_FILES)
2023-04-22 20:53:00 +02:00
.PHONY : lint -css -fix
2025-01-27 09:44:09 +08:00
lint-css-fix : node_modules ## lint css files and fix issues
2026-03-31 18:50:51 +02:00
pnpm exec stylelint --color --max-warnings= 0 $( STYLELINT_FILES) --fix
2023-04-22 20:53:00 +02:00
.PHONY : lint -swagger
2025-01-27 09:44:09 +08:00
lint-swagger : node_modules ## lint swagger files
2026-03-31 18:50:51 +02:00
pnpm exec spectral lint -q -F hint $( SWAGGER_SPEC)
2023-04-09 20:05:12 +02:00
.PHONY : lint -md
2025-01-27 09:44:09 +08:00
lint-md : node_modules ## lint markdown files
2026-03-31 18:50:51 +02:00
pnpm exec markdownlint *.md
2020-03-29 13:56:58 +02:00
2025-11-20 22:53:44 +01:00
.PHONY : lint -md -fix
lint-md-fix : node_modules ## lint markdown files and fix issues
2026-03-31 18:50:51 +02:00
pnpm exec markdownlint --fix *.md
2025-11-20 22:53:44 +01:00
2024-02-09 04:59:39 +01:00
.PHONY : lint -spell
2025-01-27 09:44:09 +08:00
lint-spell : ## lint spelling
2026-02-27 00:06:31 +01:00
@git ls-files $( SPELLCHECK_FILES) | xargs go run $( MISSPELL_PACKAGE) -dict assets/misspellings.csv -error
2024-02-09 04:59:39 +01:00
.PHONY : lint -spell -fix
2025-01-27 09:44:09 +08:00
lint-spell-fix : ## lint spelling and fix issues
2026-02-27 00:06:31 +01:00
@git ls-files $( SPELLCHECK_FILES) | xargs go run $( MISSPELL_PACKAGE) -dict assets/misspellings.csv -w
2024-02-09 04:59:39 +01:00
2023-04-22 20:53:00 +02:00
.PHONY : lint -go
2025-01-27 09:44:09 +08:00
lint-go : ## lint go files
2026-05-08 23:39:35 +02:00
GO = $( GO) GOLANGCI_LINT_PACKAGE = $( GOLANGCI_LINT_PACKAGE) $( GO) run ./tools/lint-go-all.go
2023-04-22 20:53:00 +02:00
.PHONY : lint -go -fix
2025-01-27 09:44:09 +08:00
lint-go-fix : ## lint go files and fix issues
2026-05-08 23:39:35 +02:00
GO = $( GO) GOLANGCI_LINT_PACKAGE = $( GOLANGCI_LINT_PACKAGE) $( GO) run ./tools/lint-go-all.go --fix
2023-04-22 20:53:00 +02:00
.PHONY : lint -editorconfig
lint-editorconfig :
2025-02-21 16:04:30 +08:00
@echo "Running editorconfig check..."
2024-03-06 02:48:14 +01:00
@$( GO) run $( EDITORCONFIG_CHECKER_PACKAGE) $( EDITORCONFIG_FILES)
2020-08-16 23:43:09 +02:00
2023-05-25 09:33:31 +08:00
.PHONY : lint -actions
2026-05-16 10:38:46 +02:00
lint-actions : .venv ## lint action workflow files
@$( GO) run $( ACTIONLINT_PACKAGE)
@uv run --frozen zizmor --quiet --min-confidence= medium .github
2023-05-25 09:33:31 +08:00
2026-05-22 22:22:04 +02:00
.PHONY : lint -shell
lint-shell : ## lint shell scripts
@SHELLCHECK_IMAGE= $( SHELLCHECK_IMAGE) CONTAINER_RUNTIME = $( CONTAINER_RUNTIME) ./tools/lint-shell.sh $$ ( git ls-files '*.sh' )
2023-06-14 20:17:58 +02:00
.PHONY : lint -templates
2025-01-27 09:44:09 +08:00
lint-templates : .venv node_modules ## lint template files
2025-09-06 14:58:25 +02:00
@node tools/lint-templates-svg.ts
2025-07-16 18:53:35 +02:00
@uv run --frozen djlint $( shell find templates -type f -iname '*.tmpl' )
2023-06-14 20:17:58 +02:00
2023-09-08 04:24:06 +02:00
.PHONY : lint -yaml
2025-01-27 09:44:09 +08:00
lint-yaml : .venv ## lint yaml files
2025-07-16 18:53:35 +02:00
@uv run --frozen yamllint -s .
2023-09-08 04:24:06 +02:00
2025-12-19 07:27:21 +01:00
.PHONY : lint -json
lint-json : node_modules ## lint json files
2026-03-31 18:50:51 +02:00
pnpm exec eslint -c eslint.json.config.ts --color --max-warnings= 0 --concurrency $( ESLINT_CONCURRENCY)
2025-12-19 07:27:21 +01:00
.PHONY : lint -json -fix
lint-json-fix : node_modules ## lint and fix json files
2026-03-31 18:50:51 +02:00
pnpm exec eslint -c eslint.json.config.ts --color --max-warnings= 0 --concurrency $( ESLINT_CONCURRENCY) --fix
2025-12-19 07:27:21 +01:00
2020-09-05 02:55:06 +02:00
.PHONY : watch
2025-01-27 09:44:09 +08:00
watch : ## watch everything and continuously rebuild
2024-03-17 23:12:36 +01:00
@bash tools/watch.sh
2020-09-05 02:55:06 +02:00
2020-04-12 05:50:59 +02:00
.PHONY : watch -frontend
2026-03-29 12:24:30 +02:00
watch-frontend : node_modules ## start vite dev server for frontend
2026-04-01 20:15:02 +02:00
NODE_ENV = development pnpm exec vite --logLevel $( FRONTEND_DEV_LOG_LEVEL)
2020-04-12 05:50:59 +02:00
2020-07-27 20:05:42 +02:00
.PHONY : watch -backend
2026-01-22 09:30:02 +01:00
watch-backend : ## watch backend files and continuously rebuild
2022-12-27 14:00:34 +08:00
GITEA_RUN_MODE = dev $( GO) run $( AIR_PACKAGE) -c .air.toml
2020-07-27 20:05:42 +02:00
2021-04-08 12:41:57 +02:00
.PHONY : test -backend
2025-03-25 14:54:17 -03:00
test-backend : ## test backend files
2026-04-29 18:37:38 +02:00
@echo "Running go test with $( GOTEST_FLAGS) -tags ' $( TAGS) '..."
@$( GO) test $( GOTEST_FLAGS) -tags= '$(TAGS)' $( GO_TEST_PACKAGES)
2017-05-24 12:13:18 -04:00
2021-04-08 12:41:57 +02:00
.PHONY : test -frontend
2025-03-25 14:54:17 -03:00
test-frontend : node_modules ## test frontend files
2026-03-31 18:50:51 +02:00
pnpm exec vitest
2021-04-08 12:41:57 +02:00
2020-03-06 07:47:40 +01:00
.PHONY : test -check
2020-01-26 20:07:12 +00:00
test-check :
2020-12-03 02:54:30 +01:00
@echo "Running test-check..." ;
2020-01-26 20:07:12 +00:00
@diff= $$ ( git status -s) ; \
if [ -n " $$ diff" ] ; then \
2021-04-08 12:41:57 +02:00
echo "make test-backend has changed files in the source tree:" ; \
2025-02-21 00:05:40 +08:00
printf "%s" " $$ {diff}" ; \
2020-01-26 20:07:12 +00:00
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; \
2020-11-29 22:39:36 +01:00
fi
2020-01-26 20:07:12 +00:00
2026-04-29 18:37:38 +02:00
.PHONY : test -backend \#%
test-backend\#% :
@echo "Running go test with -tags ' $( TAGS) '..."
@$( GO) test $( GOTEST_FLAGS) -tags= '$(TAGS)' -run $( subst .,/,$* ) $( GO_TEST_PACKAGES)
2019-10-16 14:42:42 +01:00
2017-09-07 19:22:15 +02:00
.PHONY : coverage
2017-09-13 20:57:55 +08:00
coverage :
2021-09-01 03:43:29 +01:00
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
2025-10-23 11:07:39 +02:00
$( GO) run tools/gocovmerge.go integration.coverage-bodged.out coverage-bodged.out > coverage.all
2017-06-15 05:38:33 -04:00
.PHONY : unit -test -coverage
unit-test-coverage :
2026-04-29 18:37:38 +02:00
@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
2016-03-06 16:40:04 -05:00
2022-05-25 02:19:13 +02:00
.PHONY : tidy
2025-01-27 09:44:09 +08:00
tidy : ## run go mod tidy
2022-05-25 02:19:13 +02:00
$( 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)
2025-02-28 06:06:47 -08:00
@$( MAKE) --no-print-directory $( GO_LICENSE_FILE)
2022-05-25 02:19:13 +02:00
2022-09-09 17:33:01 +02:00
vendor : go .mod go .sum
2022-05-25 02:19:13 +02:00
$( GO) mod vendor
2022-09-09 17:33:01 +02:00
@touch vendor
2017-05-02 15:22:21 +02:00
2022-09-02 03:58:09 +02:00
.PHONY : tidy -check
tidy-check : tidy
2023-03-19 02:47:47 +01:00
@diff= $$ ( git diff --color= always go.mod go.sum $( GO_LICENSE_FILE) ) ; \
2018-05-21 14:34:20 +02:00
if [ -n " $$ diff" ] ; then \
2022-05-25 02:19:13 +02:00
echo "Please run 'make tidy' and commit the result:" ; \
2025-02-20 22:10:54 +08:00
printf "%s" " $$ {diff}" ; \
2018-05-21 14:34:20 +02:00
exit 1; \
2020-11-29 22:39:36 +01:00
fi
2017-04-24 16:31:46 +02:00
2022-09-04 00:20:46 +02:00
.PHONY : go -licenses
2025-01-27 09:44:09 +08:00
go-licenses : $( GO_LICENSE_FILE ) ## regenerate go licenses
2022-09-04 00:20:46 +02:00
2022-09-09 17:33:01 +02:00
$(GO_LICENSE_FILE) : go .mod go .sum
2026-02-18 05:13:26 +01:00
GO = $( GO) $( GO) run build/generate-go-licenses.go $( GO_LICENSE_FILE)
2022-09-04 00:20:46 +02:00
2026-04-29 18:37:38 +02:00
.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.
2026-05-26 15:49:31 -07:00
$(GO) test $(GOTEST_FLAGS) -tags ' $( TAGS) ' -c gitea.dev/tests/integration -o ./test-integration-$( GITEA_TEST_DATABASE) .test
2026-05-21 06:58:41 +02:00
./tools/test-integration.sh ./test-integration-$( GITEA_TEST_DATABASE) .test
.PHONY : test -integration -compile
test-integration-compile :
2026-05-26 15:49:31 -07:00
$( GO) test $( GOTEST_FLAGS) -tags '$(TAGS)' -c -o /dev/null gitea.dev/tests/integration
2020-04-19 08:17:02 -03:00
2026-04-29 18:37:38 +02:00
.PHONY : test -integration \#%
test-integration\#% :
2026-05-26 15:49:31 -07:00
$( GO) test $( GOTEST_FLAGS) -tags '$(TAGS)' -run $( subst .,/,$* ) gitea.dev/tests/integration
2017-04-25 03:24:51 -04:00
2026-04-29 18:37:38 +02:00
.PHONY : test -migration
test-migration : migrations .integration .test migrations .individual .test
2019-04-05 00:22:10 +08:00
2026-04-29 18:37:38 +02:00
.PHONY : migrations .integration .test
migrations.integration.test :
2026-05-26 15:49:31 -07:00
$( GO) test $( GOTEST_FLAGS) -tags '$(TAGS)' gitea.dev/tests/integration/migration-test
2022-02-13 21:19:12 +00:00
2026-04-29 18:37:38 +02:00
.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)
2019-09-25 20:13:18 +08:00
2026-04-29 18:37:38 +02:00
.PHONY : migrations .individual .test \#%
migrations.individual.test\#% :
2026-05-26 15:49:31 -07:00
$( GO) test $( GOTEST_FLAGS) -tags '$(TAGS)' gitea.dev/models/migrations/$*
2022-09-02 15:18:23 -04:00
.PHONY : playwright
2024-02-22 04:19:13 +01:00
playwright : deps -frontend
2026-05-22 22:22:04 +02:00
@CONTAINER_RUNTIME= $( CONTAINER_RUNTIME) ./tools/test-e2e.sh install
2022-09-02 15:18:23 -04:00
.PHONY : test -e 2e
2026-04-30 08:38:05 -06:00
test-e2e : playwright frontend backend
2026-05-22 22:22:04 +02:00
@CONTAINER_RUNTIME= $( CONTAINER_RUNTIME) EXECUTABLE = $( EXECUTABLE) ./tools/test-e2e.sh run $( GITEA_TEST_E2E_FLAGS)
2016-03-06 16:40:04 -05:00
2019-12-05 04:41:38 +01:00
.PHONY : build
2025-01-27 09:44:09 +08:00
build : frontend backend ## build everything
2020-02-22 10:15:11 +01:00
.PHONY : frontend
2026-03-29 12:24:30 +02:00
frontend : $( FRONTEND_DEST ) ## build frontend files
2020-02-22 10:15:11 +01:00
.PHONY : backend
2026-01-22 09:30:02 +01:00
backend : generate -backend $( EXECUTABLE ) ## build backend files
2020-02-22 10:15:11 +01:00
2022-09-05 07:04:18 +01:00
# 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
2020-02-22 10:15:11 +01:00
.PHONY : generate
2025-01-27 09:44:09 +08:00
generate : generate -backend ## run "go generate"
2022-09-09 17:33:01 +02:00
2022-09-05 07:04:18 +01:00
.PHONY : generate -backend
generate-backend : $( TAGS_PREREQ ) generate -go
2022-09-09 17:33:01 +02:00
.PHONY : generate -go
2022-09-05 07:04:18 +01:00
generate-go : $( TAGS_PREREQ )
2020-12-03 02:54:30 +01:00
@echo "Running go generate..."
2024-04-29 09:45:53 +06:00
@CC= GOOS = GOARCH = CGO_ENABLED = 0 $( GO) generate -tags '$(TAGS)' ./...
2019-12-05 04:41:38 +01:00
2022-09-11 15:02:18 +08:00
.PHONY : security -check
security-check :
2026-02-20 16:40:07 +01:00
GOEXPERIMENT = go run $( GOVULNCHECK_PACKAGE) -show color ./... || true
2022-09-11 15:02:18 +08:00
2020-02-11 20:42:03 +01:00
$(EXECUTABLE) : $( GO_SOURCES ) $( TAGS_PREREQ )
2025-08-06 22:22:08 +02:00
ifneq ( $( and $( STATIC ) ,$( findstring pam ,$( TAGS ))) ,)
2026-01-30 10:23:38 +08:00
$( error pam support set via TAGS does not support static builds )
2025-08-06 22:22:08 +02:00
endif
CGO_ENABLED = " $( CGO_ENABLED) " CGO_CFLAGS = " $( CGO_CFLAGS) " $( GO) build $( GOFLAGS) $( EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@
2016-11-04 13:58:55 +01:00
.PHONY : release
2024-07-10 09:46:08 +08:00
release : frontend generate release -windows release -linux release -darwin release -freebsd release -copy release -compress vendor release -sources release -check
2016-12-04 23:48:36 +01:00
2020-02-19 04:10:25 +01:00
$(DIST_DIRS) :
mkdir -p $( DIST_DIRS)
2016-11-04 13:58:55 +01:00
2017-03-07 14:49:24 +01:00
.PHONY : release -windows
2020-02-19 04:10:25 +01:00
release-windows : | $( DIST_DIRS )
2024-12-29 21:37:59 -05:00
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) .
2021-04-15 10:02:44 +01:00
ifeq (, $( findstring gogit ,$( TAGS )) )
2024-12-29 21:37:59 -05:00
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 .
2021-04-15 10:02:44 +01:00
endif
2017-03-07 14:49:24 +01:00
.PHONY : release -linux
2020-02-19 04:10:25 +01:00
release-linux : | $( DIST_DIRS )
2024-12-29 21:37:59 -05:00
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) .
2017-03-07 14:49:24 +01:00
.PHONY : release -darwin
2020-02-19 04:10:25 +01:00
release-darwin : | $( DIST_DIRS )
2024-12-29 21:37:59 -05:00
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) .
2016-11-04 13:58:55 +01:00
2023-01-10 17:21:24 -05:00
.PHONY : release -freebsd
release-freebsd : | $( DIST_DIRS )
2024-12-29 21:37:59 -05:00
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) .
2023-01-10 17:21:24 -05:00
2016-11-04 13:58:55 +01:00
.PHONY : release -copy
2020-02-19 04:10:25 +01:00
release-copy : | $( DIST_DIRS )
2022-06-05 10:42:24 +08:00
cd $( DIST) ; for file in ` find . -type f -name "*" ` ; do cp $$ { file} ./release/; done ;
2016-11-04 13:58:55 +01:00
.PHONY : release -check
2020-02-19 04:10:25 +01:00
release-check : | $( DIST_DIRS )
2019-04-14 16:33:24 -04:00
cd $( DIST) /release/; for file in ` find . -type f -name "*" ` ; do echo "checksumming $$ {file}" && $( SHASUM) ` echo $$ { file} | sed 's/^..//' ` > $$ { file} .sha256; done ;
2016-11-04 13:58:55 +01:00
2018-05-21 20:50:39 +02:00
.PHONY : release -compress
2020-02-19 04:10:25 +01:00
release-compress : | $( DIST_DIRS )
2023-07-27 00:51:02 +02:00
cd $( DIST) /release/; for file in ` find . -type f -name "*" ` ; do echo "compressing $$ {file}" && $( GO) run $( GXZ_PACKAGE) -k -9 $$ { file} ; done ;
2018-05-21 20:50:39 +02:00
2020-02-16 18:53:02 +01:00
.PHONY : release -sources
2021-04-09 07:08:14 +02:00
release-sources : | $( DIST_DIRS )
2020-02-22 10:15:11 +01:00
echo $( VERSION) > $( STORED_VERSION_FILE)
2021-04-09 07:08:14 +02:00
# bsdtar needs a ^ to prevent matching subdirectories
$( eval EXCL := --exclude= $( shell tar --help | grep -q bsdtar && echo "^" ) ./)
2022-04-25 18:41:07 +02:00
# 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 .
2020-02-22 10:15:11 +01:00
rm -f $( STORED_VERSION_FILE)
2020-02-16 18:53:02 +01:00
2022-02-12 08:08:53 +01:00
.PHONY : deps
2025-01-27 09:44:09 +08:00
deps : deps -frontend deps -backend deps -tools deps -py ## install dependencies
2023-06-14 20:17:58 +02:00
.PHONY : deps -py
2025-01-27 09:44:09 +08:00
deps-py : .venv ## install python dependencies
2022-02-12 08:08:53 +01:00
.PHONY : deps -frontend
2025-01-27 09:44:09 +08:00
deps-frontend : node_modules ## install frontend dependencies
2022-02-12 08:08:53 +01:00
.PHONY : deps -backend
2025-01-27 09:44:09 +08:00
deps-backend : ## install backend dependencies
2022-02-12 08:08:53 +01:00
$( GO) mod download
2023-03-10 00:13:17 -06:00
.PHONY : deps -tools
2025-01-27 09:44:09 +08:00
deps-tools : ## install tool dependencies
2024-07-28 19:27:24 +02:00
$( 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
2022-02-12 08:08:53 +01:00
2025-09-03 21:17:14 -04:00
node_modules : pnpm -lock .yaml
2026-03-31 18:50:51 +02:00
pnpm install --frozen-lockfile
2020-01-28 08:30:39 +01:00
@touch node_modules
2019-06-19 04:59:47 +02:00
2025-07-15 23:19:39 +02:00
.venv : uv .lock
uv sync
2023-06-14 20:17:58 +02:00
@touch .venv
2023-09-22 22:51:48 +02:00
.PHONY : update
2026-04-01 05:26:52 +02:00
update : update -go update -js update -py ## update dependencies
.PHONY : update -go
update-go : ## update go dependencies
$( GO) get -u ./...
$( MAKE) tidy
2023-09-22 22:51:48 +02:00
2023-06-27 21:44:17 +02:00
.PHONY : update -js
2026-01-22 09:30:02 +01:00
update-js : node_modules ## update js dependencies
2026-03-31 18:50:51 +02:00
pnpm exec updates -u -f package.json
2025-09-03 21:17:14 -04:00
rm -rf node_modules pnpm-lock.yaml
2026-03-31 18:50:51 +02:00
pnpm install
2026-05-04 23:39:20 +02:00
@touch node_modules
2019-06-19 04:59:47 +02:00
2023-06-27 21:44:17 +02:00
.PHONY : update -py
2026-01-22 09:30:02 +01:00
update-py : node_modules ## update py dependencies
2026-03-31 18:50:51 +02:00
pnpm exec updates -u -f pyproject.toml
2025-07-15 23:19:39 +02:00
rm -rf .venv uv.lock
uv sync
2023-06-26 23:14:00 +02:00
@touch .venv
2026-03-29 12:24:30 +02:00
.PHONY : vite
vite : $( FRONTEND_DEST ) ## build vite files
2019-12-05 04:41:38 +01:00
2026-03-29 12:24:30 +02:00
$(FRONTEND_DEST) : $( FRONTEND_SOURCES ) $( FRONTEND_CONFIGS ) pnpm -lock .yaml
2026-01-22 09:30:02 +01:00
@$( MAKE) -s node_modules
2026-03-29 12:24:30 +02:00
@rm -rf $( FRONTEND_DEST_ENTRIES)
@echo "Running vite build..."
2026-03-31 18:50:51 +02:00
@pnpm exec vite build
2026-03-29 12:24:30 +02:00
@touch $( FRONTEND_DEST)
2019-05-16 07:57:47 +02:00
2020-07-12 11:10:56 +02:00
.PHONY : svg
2026-01-22 09:30:02 +01:00
svg : node_modules ## build svg files
2020-07-12 11:10:56 +02:00
rm -rf $( SVG_DEST_DIR)
2025-09-06 14:58:25 +02:00
node tools/generate-svg.ts
2020-07-12 11:10:56 +02:00
.PHONY : svg -check
svg-check : svg
2020-07-24 18:41:30 +02:00
@git add $( SVG_DEST_DIR)
2023-03-19 02:47:47 +01:00
@diff= $$ ( git diff --color= always --cached $( SVG_DEST_DIR) ) ; \
2020-07-12 11:10:56 +02:00
if [ -n " $$ diff" ] ; then \
2020-07-24 18:41:30 +02:00
echo "Please run 'make svg' and 'git add $( SVG_DEST_DIR) ' and commit the result:" ; \
2025-02-21 00:05:40 +08:00
printf "%s" " $$ {diff}" ; \
2020-07-12 11:10:56 +02:00
exit 1; \
2020-11-29 22:39:36 +01:00
fi
2020-07-12 11:10:56 +02:00
2022-01-15 12:06:29 -08:00
.PHONY : lockfile -check
lockfile-check :
2026-03-31 18:50:51 +02:00
pnpm install --frozen-lockfile
2025-09-03 21:17:14 -04:00
@diff= $$ ( git diff --color= always pnpm-lock.yaml) ; \
2022-01-15 12:06:29 -08:00
if [ -n " $$ diff" ] ; then \
2025-09-03 21:17:14 -04:00
echo "pnpm-lock.yaml is inconsistent with package.json" ; \
echo "Please run 'pnpm install --frozen-lockfile' and commit the result:" ; \
2025-02-21 00:05:40 +08:00
printf "%s" " $$ {diff}" ; \
2022-01-15 12:06:29 -08:00
exit 1; \
fi
2020-09-02 18:57:08 +02:00
.PHONY : generate -gitignore
2025-01-27 09:44:09 +08:00
generate-gitignore : ## update gitignore files
2022-07-04 05:33:55 +02:00
$( GO) run build/generate-gitignores.go
2020-09-02 18:57:08 +02:00
2017-07-28 08:51:20 +03:00
.PHONY : generate -images
2025-09-05 23:06:02 +02:00
generate-images : | node_modules ## generate images
2025-09-06 14:58:25 +02:00
cd tools && node generate-images.ts $( TAGS)
2019-03-25 22:23:17 +01:00
2026-05-10 06:51:46 +02:00
.PHONY : generate -codemirror -languages
generate-codemirror-languages : | node_modules ## generate codemirror languages
node tools/generate-codemirror-languages.ts
2021-02-24 23:36:48 +01:00
.PHONY : generate -manpage
2025-01-27 09:44:09 +08:00
generate-manpage : ## generate manpage
2021-02-24 23:36:48 +01:00
@[ -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
2022-07-12 17:32:37 -04:00
@#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page
2021-02-24 23:36:48 +01:00
2024-02-16 04:17:34 +01:00
# 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 :