forgejo/Makefile

1028 lines
40 KiB
Makefile
Raw Normal View History

ifeq ($(USE_REPO_TEST_DIR),1)
# This rule replaces the whole Makefile when we're trying to use /tmp repository temporary files
location = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
self := $(location)
%:
@tmpdir=`mktemp --tmpdir -d` ; \
echo Using temporary directory $$tmpdir for test repositories ; \
USE_REPO_TEST_DIR= $(MAKE) -f $(self) --no-print-directory REPO_TEST_DIR=$$tmpdir/ $@ ; \
STATUS=$$? ; rm -r "$$tmpdir" ; exit $$STATUS
else
# This is the "normal" part of the Makefile
DIST := dist
DIST_DIRS := $(DIST)/binaries $(DIST)/release
IMPORT := code.gitea.io/gitea
GO ?= go
2019-04-14 17:06:43 +02:00
SHASUM ?= shasum -a 256
HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes)
COMMA := ,
2023-10-21 13:30:19 +02:00
DIFF ?= diff --unified
XGO_VERSION := go-1.21.x
2024-06-04 08:52:58 +02:00
AIR_PACKAGE ?= github.com/air-verse/air@v1 # renovate: datasource=go
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.0.3 # renovate: datasource=go
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.7.0 # renovate: datasource=go
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 # renovate: datasource=go
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11 # renovate: datasource=go
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0 # renovate: datasource=go
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 # renovate: datasource=go
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 # renovate: datasource=go
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasource=go
2024-08-09 12:25:53 +02:00
DEADCODE_PACKAGE ?= golang.org/x/tools/cmd/deadcode@v0.24.0 # renovate: datasource=go
GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@v0.4.0 # renovate: datasource=go
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.16.1 # renovate: datasource=go
2024-08-19 04:03:33 +02:00
RENOVATE_NPM_PACKAGE ?= renovate@38.39.6 # renovate: datasource=docker packageName=code.forgejo.org/forgejo-contrib/renovate
2020-03-20 15:29:31 +01:00
ifeq ($(HAS_GO), yes)
CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER=32766
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
endif
ifeq ($(GOOS),windows)
IS_WINDOWS := yes
else ifeq ($(patsubst Windows%,Windows,$(OS)),Windows)
ifeq ($(GOOS),)
IS_WINDOWS := yes
endif
endif
ifeq ($(IS_WINDOWS),yes)
GOFLAGS := -v -buildmode=exe
EXECUTABLE ?= gitea.exe
else
GOFLAGS := -v
EXECUTABLE ?= gitea
endif
ifeq ($(shell sed --version 2>/dev/null | grep -q GNU && echo gnu),gnu)
SED_INPLACE := sed -i
else
SED_INPLACE := sed -i ''
endif
2017-04-05 10:10:32 +02:00
EXTRA_GOFLAGS ?=
MAKE_VERSION := $(shell "$(MAKE)" -v | cat | head -n 1)
MAKE_EVIDENCE_DIR := .make_evidence
2021-06-02 17:34:11 +02:00
ifeq ($(RACE_ENABLED),true)
GOFLAGS += -race
GOTESTFLAGS += -race
endif
STORED_VERSION_FILE := VERSION
HUGO_VERSION ?= 0.111.3
GITEA_COMPATIBILITY ?= gitea-1.22.0
[CI] Forgejo Actions based release process Refs: https://codeberg.org/forgejo/website/pulls/230 (cherry picked from commit 87d56bf6c73d726dae8aafbc7e147969f1899931) [CI] Forgejo Actions based release process (squash) base64 -w0 to avoid wrapping when the doer name is long as it creates a broken config.json (cherry picked from commit 9efdc27e49bdfb3e62401baf27b224385f9f3e5e) [CI] Forgejo Actions based release process (squash) generate .xz files and sources Generate .xz files Check .sha256 Generate the source tarbal (cherry picked from commit 7afec520c4b1032d7e67a05a41e4e2913bcd9312) [CI] Forgejo Actions based release process (squash) release notes (cherry picked from commit d8f4f4807b28297b318d2f555a76d0efef762cf7) [CI] Forgejo Actions based release process (squash) publish and sign release (cherry picked from commit a52778c74785fe57cdee3b64b4c6c8a326471532) (cherry picked from commit cf2ec6274094ac7aebda71d54c64581f528df00a) [CI] Forgejo Actions based release process (squash) version use Actions environment variables in Makefile (#25319) (#25318) uses Actions variable to determine the version. But Forgejo builds happen in a container where they are not available. Do not use them. Also verify the version of the binary is as expected for sanity check. (cherry picked from commit 6decf111a132a869f9e5c6f4d20e368b8f74309f) (cherry picked from commit 206d0b3886b2d56b585bf552e53d952b35f07284) [CI] read STORED_VERSION_FILE if available (cherry picked from commit af74085ebf51c91a51db865a66667fca511838d5) [CI] backward compatible executable compilation Add a new static-executable target to use in Dockerfiles and restore the $(EXECUTABLE) target to what it was before to for backward compatibility. The release process now builds static executables instead of dynamically linked ones which makes them more portable. It changes the requirements at compile time and is not backward compatible. In particular it may break packaging that rely on the target that currently creates a dynamically linked executable. (cherry picked from commit 84d02a174a4398b1f8ee62e08db5483a9859650f) (cherry picked from commit 854be47328cc0283119dfb78f9ba0b8306c85f75) [CI] Forgejo Actions based release process (squash) doc / ca / verbosity - Document workflow - Increase verbosity if VERBOSE=true - Download the Certificate Authority if behind the VPN (cherry picked from commit 168d5d586904835762d213b2b8815b458a38c78f) (cherry picked from commit 8756c9a72a40830441124256b7382f900a1052f8) (cherry picked from commit 2dad7ef20f3bf9ebe2425e2e28b66a4ca21c6786) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commit 5531d01f1981df665f5b8f642e9241e8ea4f4578) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal bindata.go is a file, not a directory Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commit bd88a4477817be34ea86ebb2f460b9fe8ab5f1b7) (cherry picked from commit b408085138c578dfaacafbd4b7719ca926456855) [CI] Forgejo Actions based release process (squash) public/assets moved (cherry picked from commit d8c921d5a643ed05f2935348531996fe4d08c654) (cherry picked from commit f29e50b1a09b1a22fc2dbdb77e9a1def1196175b) [CI] Fix release notes link - Use substitution to replace all dots with dashes. - Resolves https://codeberg.org/forgejo/forgejo/issues/1163 (cherry picked from commit 96783728f53a072915cace392aa269adfe9a5c73) (cherry picked from commit c8d8bf8996beb650cd86cafb110e85e1e05917a0) [CI] pin go v1.20 for testing Refs: https://codeberg.org/forgejo/forgejo/issues/1228 (cherry picked from commit fd4b5a013ee0f31453b623d12001a8b810cd7ebc) (cherry picked from commit 00bb15f57f2ae5a11abc8b044ed99dc949e812a7) Conflicts: Dockerfile Dockerfile.rootless see https://codeberg.org/forgejo/forgejo/pulls/1303 (cherry picked from commit 6e2be54a6d95412ce770d4bab1a39c77591f44dc) (cherry picked from commit 346c418b4a8c0e1f8c9aace44b00373a4bf76732) (cherry picked from commit 49061f8422cb6aa9ddc14edb507f50477624eb7a) (cherry picked from commit 8229d59b7e1ba61959de6ecd95d9dd49bc2436dc) (cherry picked from commit 70d45d919309d8127551c8ad44538a730b795638) [CI] Forgejo Actions based release process (squash) need node 18 (cherry picked from commit 722b1f45902ecca3179a92700a2f5c1080422a04) (cherry picked from commit a91d786169fb4694aed4af68792437a0a67de3fa) [CI] Forgejo Actions based release process (squash) fix indentation (cherry picked from commit fbdf9d6abb88fd5def3d0ced488a4dd72655d433) (cherry picked from commit 2deff90a13397339796ac5a94d63b0d8cd9760a9) (cherry picked from commit 5710a27fda58093f0db1605585e730c314b933f5) [CI] Forgejo Actions based release process (squash) FQIN for docker Refs: https://codeberg.org/forgejo/forgejo/issues/1600 (cherry picked from commit f63d38deb6a9933ce996a61a099f4b79e9171581) [CI] Forgejo Actions based release process (squash) use forgejo-curl.sh (cherry picked from commit c0c3ef506fa500cb9626034c5e00913b3c31e08c) (cherry picked from commit 933ca7ec5dcab55c8593dee4a6cd13281502c41e) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/1691 (cherry picked from commit 1068e48805de9d7464b41f32e1c5567d3747239a) [CI] Forgejo Actions based release process (squash) size optimization (cherry picked from commit 3c653ff7428dbf898a5131b5c817ce3b13ec0591) (cherry picked from commit 398567fc0cf9edd0be49541339800af985e8b1b6) (cherry picked from commit e585db9a970e7a84eaff06758a094a297ae6fc48) (cherry picked from commit 17e91c96e3259b0d8fa87294470339779d62aa71) [CI] Forgejo Actions based release process (squash) gitea to forgejo (cherry picked from commit 9c06a318b867ea8c60dd194ca393bac3b718b07b) (cherry picked from commit 95859da3b40306c1e07277230c2f401ef8b82a13) (cherry picked from commit e3a5f6c1ed4e5452f3664aa8d398805c3b9c0a51) (cherry picked from commit 7b9b259c75e0b2b805a2239ecf7c85a3f0dbd648) (cherry picked from commit c4a152c8dc4ab5d20c72f9f7d60ce6eee3be5cda) (cherry picked from commit b00bf599efa97a18adac134a1402418785c5bae2) (cherry picked from commit a7836ee2ee2638091f0f9ff5543548ae0bb94060) (cherry picked from commit 3ea7dcbd5b196b6fc9115d49d50678a1a5940c0b) (cherry picked from commit 454d705e830ade3a41a33341b82d4c8aff584dcd) (cherry picked from commit 35e06c3009f4a1942222dc35cc0993a623164b25) (cherry picked from commit 904468a38ffdfb8157dc4eaf92b3ba10c3a957db) (cherry picked from commit 890e86815a5a33b2930150a7460cd96b4360ac88) (cherry picked from commit bf9f94c63d8c15ce62881ccadc28681848b7ebd7) (cherry picked from commit d025d061d14929aaabbfc4603099e32cb888ac3b) (cherry picked from commit 32f209a8e1b2ee109f7ae8b150d4390318c0ff2a) (cherry picked from commit 38ef6802fca7301f4cb03769e8d6dae1e256933f) (cherry picked from commit 8a19bbd2a8160b7d3d5a1ea083507b4311070ab6) (cherry picked from commit f352dee786d2541fbe360fe8f859d3182c632240) (cherry picked from commit b53d9fc090b58848876b4f97e8ed03face85a63b) (cherry picked from commit 3dae21f4c87c82b75515d3db43c1bbd4d9f3f1ac) (cherry picked from commit 8b59e016c7a1eb3f6d0077d8e6f205b8bcefe402) (cherry picked from commit 6f54ea6a0eb0f9c4360237f78eb76c55678547e2) (cherry picked from commit ed8d90de6bb9513a2dcdc70aac446bbcaf0855c9) (cherry picked from commit 26ffd3fcace55279091fe95074a65dd1c4b7758a) (cherry picked from commit 287b3bbfb5a66e64d3490a282153bfd2393b7afa) (cherry picked from commit ab81378d0c88def332f43843eeac23ef768bb143) (cherry picked from commit f6bbe7e875e707fcbadf7434818edb897467a5ef) (cherry picked from commit 8968f34edf064e6bffc3cc7054307c6303256acd) (cherry picked from commit d3d914bba2bec4f50f9d71d347b510771df99656) (cherry picked from commit 4e4006a990dd22c23ffd6e9b7e3af6aac1855d52) (cherry picked from commit edb333569b38e38f94dbb769d793b53cdf39b96f) (cherry picked from commit 6c1a4baa15aebd1b27b742097181b1ca4afbd31c) (cherry picked from commit 51bda3bfc734eccee198d4ccb377520d7f16ccb3) (cherry picked from commit 6f5f318b8f1f9086ef981c181a97ebbcbe6e11be) (cherry picked from commit e128da23624c90f2817ccb3f15c5df9704f2c597) (cherry picked from commit 3e6735ff23ae6c6a6963629cf4bc5d8acd26f905) (cherry picked from commit 938c4441259e0ef1714d6e411bd49df15f048103) (cherry picked from commit 67f92dc9ab4ae8263c2f69e6729b3f1198943401) (cherry picked from commit ee31df71fb70c2938fcf82b5c9a518a54bd4c078) (cherry picked from commit 386f232191561867c7888ec94374f8f9505c4ff9) (cherry picked from commit 745785cd7f90cf2665f11fb9bed960a16e238fa4) (cherry picked from commit efa8564e762b5369a77a10422bd1f6dd1433c62b) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/2029 (cherry picked from commit f3dfb143216501411f2e2f522bcce64debfdc07d) (cherry picked from commit 5a0346ee95f2f30e8955ad886500e9f1c6508c18) (cherry picked from commit 7a2a6517f2a09cec7bba873696724455134b5734) (cherry picked from commit 87dcc87da9e20977a7e2c2104312a23c9d5dacb4) (cherry picked from commit df4099247f63d36e259642c0c84c3620ac3a93b0) (cherry picked from commit df23f83545a47fb058d321df760bb346a445679a)
2023-06-14 13:32:20 +02:00
STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null)
ifneq ($(STORED_VERSION),)
[RELEASE] Gitea version is for interoperability only Forgejo now has its own lifecycle and its version is derived from the tag. The Gitea tags are no longer found in the Forgejo codebase and can no longer be used for that purpose. When a Forgejo release is published, for interoperability with the existing tools in the ecosystem, it advertises the supported Gitea version via /api/v1/version. It is set in the Makefile manually and cannot be automatically set. https://codeberg.org/forgejo-contrib/delightful-forgejo#packaging Existing Forgejo packages rely on the Makefile to build and the change must be done in a way that tries to not break their assumptions. From the point of view of a Forgejo package build, the following will happen on the next major release: - The package version will bump from v1.21.x to v7.0.0 - /api/v1/version will bump from v1.21.x to v1.22.0 - /api/forgejo/v1/version will bump from v6.x to v7.0.0 The Makefile uses the following variables: GITEA_VERSION is returned by /api/v1/version FORGEJO_VERSION is returned by /api/forgejo/v1/version VERSION is used in the name the binary file and the source archive Before: GITEA_VERSION is the computed version FORGEJO_VERSION is set manually VERSION defaults to GITEA_VERSION After: FORGEJO_VERSION is the computed version GITEA_VERSION is set manually VERSION defaults to FORGEJO_VERSION When the version is computed, it comes from: - The content of the VERSION file if it exists. It is inserted in the source archive because it does not contain a git repository - Otherwise the output of `git describe`
2024-02-11 15:36:58 +01:00
FORGEJO_VERSION ?= $(STORED_VERSION)
else
ifneq ($(GITEA_VERSION),)
FORGEJO_VERSION ?= $(GITEA_VERSION)
FORGEJO_VERSION_API ?= $(GITEA_VERSION)+${GITEA_COMPATIBILITY}
else
# drop the "g" prefix prepended by git describe to the commit hash
FORGEJO_VERSION ?= $(shell git describe --exclude '*-test' --tags --always | sed 's/^v//' | sed 's/\-g/-/')+${GITEA_COMPATIBILITY}
endif
endif
FORGEJO_VERSION_MAJOR=$(shell echo $(FORGEJO_VERSION) | sed -e 's/\..*//')
FORGEJO_VERSION_MINOR=$(shell echo $(FORGEJO_VERSION) | sed -E -e 's/^([0-9]+\.[0-9]+).*/\1/')
show-version-full:
@echo ${FORGEJO_VERSION}
show-version-major:
@echo ${FORGEJO_VERSION_MAJOR}
show-version-minor:
@echo ${FORGEJO_VERSION_MINOR}
RELEASE_VERSION ?= ${FORGEJO_VERSION}
VERSION ?= ${RELEASE_VERSION}
FORGEJO_VERSION_API ?= ${FORGEJO_VERSION}
show-version-api:
@echo ${FORGEJO_VERSION_API}
LDFLAGS := $(LDFLAGS) -X "main.ReleaseVersion=$(RELEASE_VERSION)" -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(FORGEJO_VERSION)" -X "main.Tags=$(TAGS)" -X "main.ForgejoVersion=$(FORGEJO_VERSION_API)"
2015-11-03 18:16:43 +01:00
LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64
ifeq ($(HAS_GO), yes)
GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) $(shell $(GO) list code.gitea.io/gitea/models/forgejo_migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./...))
endif
REMOTE_CACHER_MODULES ?= cache nosql session queue
GO_TEST_REMOTE_CACHER_PACKAGES ?= $(addprefix code.gitea.io/gitea/modules/,$(REMOTE_CACHER_MODULES))
FOMANTIC_WORK_DIR := web_src/fomantic
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
Add tailwindcss (#29357) This will get tailwindcss working on a basic level. It provides only the utility classes, e.g. no tailwind base which we don't need because we have our own CSS reset. Without the base, we also do not have their CSS variables so a small amount of features do not work and I removed the generated classes for them. ***Note for future developers: This currently uses a `tw-` prefix, so we use it like `tw-p-3`.*** <details> <summary>Currently added CSS, all false-positives</summary> ``` .\!visible{ visibility: visible !important } .visible{ visibility: visible } .invisible{ visibility: hidden } .collapse{ visibility: collapse } .static{ position: static } .\!fixed{ position: fixed !important } .absolute{ position: absolute } .relative{ position: relative } .sticky{ position: sticky } .left-10{ left: 2.5rem } .isolate{ isolation: isolate } .float-right{ float: right } .float-left{ float: left } .mr-2{ margin-right: 0.5rem } .mr-3{ margin-right: 0.75rem } .\!block{ display: block !important } .block{ display: block } .inline-block{ display: inline-block } .inline{ display: inline } .flex{ display: flex } .inline-flex{ display: inline-flex } .\!table{ display: table !important } .inline-table{ display: inline-table } .table-caption{ display: table-caption } .table-cell{ display: table-cell } .table-column{ display: table-column } .table-column-group{ display: table-column-group } .table-footer-group{ display: table-footer-group } .table-header-group{ display: table-header-group } .table-row-group{ display: table-row-group } .table-row{ display: table-row } .flow-root{ display: flow-root } .inline-grid{ display: inline-grid } .contents{ display: contents } .list-item{ display: list-item } .\!hidden{ display: none !important } .hidden{ display: none } .flex-shrink{ flex-shrink: 1 } .shrink{ flex-shrink: 1 } .flex-grow{ flex-grow: 1 } .grow{ flex-grow: 1 } .border-collapse{ border-collapse: collapse } .select-all{ user-select: all } .resize{ resize: both } .flex-wrap{ flex-wrap: wrap } .overflow-visible{ overflow: visible } .rounded{ border-radius: 0.25rem } .border{ border-width: 1px } .text-justify{ text-align: justify } .uppercase{ text-transform: uppercase } .lowercase{ text-transform: lowercase } .capitalize{ text-transform: capitalize } .italic{ font-style: italic } .text-red{ color: var(--color-red) } .text-shadow{ color: var(--color-shadow) } .underline{ text-decoration-line: underline } .overline{ text-decoration-line: overline } .line-through{ text-decoration-line: line-through } .outline{ outline-style: solid } .ease-in{ transition-timing-function: cubic-bezier(0.4, 0, 1, 1) } .ease-in-out{ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) } .ease-out{ transition-timing-function: cubic-bezier(0, 0, 0.2, 1) } ``` </details> --------- Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit f4b92578b4601bc6e9b631b9a5a5f3766c27b0cb)
2024-02-25 17:46:46 +01:00
WEBPACK_CONFIGS := webpack.config.js tailwind.config.js
WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
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_TMP_DIR := .go-licenses
GO_LICENSE_FILE := assets/go-licenses.json
TAGS ?=
TAGS_SPLIT := $(subst $(COMMA), ,$(TAGS))
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
Use native git variants by default with go-git variants as build tag (#13673) * Move last commit cache back into modules/git Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from the interface for last commit cache Signed-off-by: Andrew Thornton <art27@cantab.net> * move cacheref to last_commit_cache Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from routers/private/hook Signed-off-by: Andrew Thornton <art27@cantab.net> * Move FindLFSFiles to pipeline Signed-off-by: Andrew Thornton <art27@cantab.net> * Make no-go-git variants Signed-off-by: Andrew Thornton <art27@cantab.net> * Submodule RefID Signed-off-by: Andrew Thornton <art27@cantab.net> * fix issue with GetCommitsInfo Signed-off-by: Andrew Thornton <art27@cantab.net> * fix GetLastCommitForPaths Signed-off-by: Andrew Thornton <art27@cantab.net> * Improve efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * More efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * even faster Signed-off-by: Andrew Thornton <art27@cantab.net> * Reduce duplication * As per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * attempt to fix drone Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test-tags Signed-off-by: Andrew Thornton <art27@cantab.net> * default to use no-go-git variants and add gogit build tag Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-12-17 15:00:47 +01:00
TEST_TAGS ?= sqlite sqlite_unlock_notify
TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) $(GO_LICENSE_TMP_DIR)
GO_DIRS := build cmd models modules routers services tests
WEB_DIRS := web_src/js web_src/css
Use native git variants by default with go-git variants as build tag (#13673) * Move last commit cache back into modules/git Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from the interface for last commit cache Signed-off-by: Andrew Thornton <art27@cantab.net> * move cacheref to last_commit_cache Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from routers/private/hook Signed-off-by: Andrew Thornton <art27@cantab.net> * Move FindLFSFiles to pipeline Signed-off-by: Andrew Thornton <art27@cantab.net> * Make no-go-git variants Signed-off-by: Andrew Thornton <art27@cantab.net> * Submodule RefID Signed-off-by: Andrew Thornton <art27@cantab.net> * fix issue with GetCommitsInfo Signed-off-by: Andrew Thornton <art27@cantab.net> * fix GetLastCommitForPaths Signed-off-by: Andrew Thornton <art27@cantab.net> * Improve efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * More efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * even faster Signed-off-by: Andrew Thornton <art27@cantab.net> * Reduce duplication * As per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * attempt to fix drone Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test-tags Signed-off-by: Andrew Thornton <art27@cantab.net> * default to use no-go-git variants and add gogit build tag Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-12-17 15:00:47 +01:00
ESLINT_FILES := web_src/js tools *.js tests/e2e/*.js tests/e2e/shared/*.js
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github $(wildcard *.go *.js *.md *.yml *.yaml *.toml)
GO_SOURCES := $(wildcard *.go)
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" ! -path modules/options/bindata.go ! -path modules/public/bindata.go ! -path modules/templates/bindata.go)
GO_SOURCES += $(GENERATED_GO_DEST)
GO_SOURCES_NO_BINDATA := $(GO_SOURCES)
ifeq ($(HAS_GO), yes)
MIGRATION_PACKAGES := $(shell $(GO) list code.gitea.io/gitea/models/migrations/... code.gitea.io/gitea/models/forgejo_migrations/...)
endif
ifeq ($(filter $(TAGS_SPLIT),bindata),bindata)
GO_SOURCES += $(BINDATA_DEST)
GENERATED_GO_DEST += $(BINDATA_DEST)
endif
# Force installation of playwright dependencies by setting this flag
ifdef DEPS_PLAYWRIGHT
PLAYWRIGHT_FLAGS += --with-deps
endif
[API] Forgejo API /api/forgejo/v1 (cherry picked from commit 20b56692693e054bb3c04b4ef12b29b0715b4530) (cherry picked from commit 1574643a6a9634e5b92c033a4bfb69062a86bd05) Update semantic version according to specification (cherry picked from commit 22510f41306f9c133a7e99b61f9c38dabfd4b810) Mise à jour de 'Makefile' (cherry picked from commit c3d85d8409f1bb18a45659a167cf1ffee057f3b6) (cherry picked from commit 5ea23098513c068444226af41faf9be9c4c998e6) (cherry picked from commit ec5217b9d1b94bb04e34ce8c27eecbdc6f3a247a) (cherry picked from commit 14f08e364b2ad7e3176b45d3ec8da5f5605b4315) (cherry picked from commit b4465c67b8737aed9fd79a43046aa3795a298e68) [API] [SEMVER] replace number with version (cherry picked from commit fba48e64977a75e77c9c6cf8e3f8a679a5e7b733) (cherry picked from commit 532ec5d8782703b62d7d02312764e50637cd016e) [API] [SEMVER] [v1.20] less is replaced by css (cherry picked from commit 01ca3a4f4291cf4c62df42cbd12a00638f3cdc70) (cherry picked from commit 1d928c3ab2e1fda6082e1400d89ea96d6605ebaa) (cherry picked from commit a39dc804cd1da86444ed709455857f069475e7db) Conflicts: webpack.config.js (cherry picked from commit adc68578b3eb41215338125edfca91804706f8a1) (cherry picked from commit 9b8d98475fd7efcc15bf0d91b0af6ef3aff64508) (cherry picked from commit 25161039745a63282257eded9616390241af8013) (cherry picked from commit 18e6287963a0e1863cd08fd514a4e732a1904a68) (cherry picked from commit e9694e67ab93ad74f7eae3152d88d95e8493e739) (cherry picked from commit a9763edaf002c8009a2cca4115cb8b926f8cdc85) (cherry picked from commit e2b550f4fba144f9637a212b56bfe30cac1adb3b) (cherry picked from commit 2edac36701e8fa1ff67f87dccfa34cfc00ab66de) [API] Forgejo API /api/forgejo/v1 (squash) Update semver as v1.20 is entering release candidate mode (cherry picked from commit 4995098ec3c6eee19a7ad7bc956b71c6e937c04c) (cherry picked from commit 578ccfdd27d7a280050bdf61d497d07decf98f2f) (cherry picked from commit 1bf6ac09520490f0a56b9b55d7836c2d8ea5d22c) (cherry picked from commit 2fe16b2bfed62c0386d0bfe104f7dcc621d1c3be) (cherry picked from commit 7cd9d027eec5a2b328d06a47f34545943560fe1b) (cherry picked from commit eaed4be2ae88055a15dcc96564440c301a13ba8e) (cherry picked from commit cc94f3115f844a0f16064e49e5eb719d33bc4441) (cherry picked from commit d7a77e35ccfd2d0fc2ba98932296ab7354edd2db) (cherry picked from commit cd8eb68ab7b3e2eaacf78d370c762f43cc19fd6a) (cherry picked from commit 68487ac95f742837e7ff38df902834b6173cd9ab) (cherry picked from commit 616dceb565456d6fac6f58b1c4de43e9d3254090) (cherry picked from commit 545fe5975b47d2eab348a57b87c6fd4590f33442) (cherry picked from commit c042cf8eda2dea805138bd64daa7fbe07865ed5a) (cherry picked from commit ae5e5a7468aa66312055a26841f658574a9b0dd7) (cherry picked from commit 8034ef5fa2648a127f8c84c572bec02a1ff6bb9f) (cherry picked from commit aaf0293034468505449d33ab1483ae65b4175754) (cherry picked from commit daafa8ce58e5e6077da585b13e5190856228a4a3) (cherry picked from commit 7ca3681d3e2ed5ec1ae44364cba476d642e2b557) (cherry picked from commit 39f72cba71ff3f9d2cbb05c88031b34933573a8c) (cherry picked from commit 60a591713097384935ba0ac51a5cd4793f7544a8) (cherry picked from commit 4853bd9e16bc8986ba8159349e93bc3093dc8ab9) [API] Move forgejo api file (squash) - Move the file to accommodate https://codeberg.org/forgejo/forgejo/commit/faa28b5a44912f1c63afddab9396bae9e6fe061c (cherry picked from commit bce89351d251bfa18c677b30bc7da80856d919fb) (cherry picked from commit 11ae7f6e85395b287c6f4108c531aa1a81fd964c) (cherry picked from commit 25e96cfcb28859406329090eb0c7990bea4e73eb) (cherry picked from commit 6d8d19b39156a7f8b4db5022915590593df94f1f) (cherry picked from commit 5afc5c454b7d70f95b83e6c3b4c9e2cb6e2d0ef5) (cherry picked from commit 86d07b4c249211bdb77c0520f99f2c8e5d89b516) (cherry picked from commit e54d869fdae44811faaa80f3757efbc93bf0bce4) (cherry picked from commit ab31ef1bba3bc5188e0f3ce5e5fa33335877cf47) (cherry picked from commit 511cbca2f3799646edf8eae00464b87f43ca280f) (cherry picked from commit 333916fea874509063f9449f07d79e4cafbcf06f) (cherry picked from commit 3802bcd7c9865b77151ef454c0bdc2ce32157a41) (cherry picked from commit 5d0fa034f77388ed21735a22cf1a2a23562245c3) (cherry picked from commit d15627aa0dfb4ffc2eb7ab0ce99b7c5b2bf06dcf) (cherry picked from commit ba0b21b9305b6fecf23aeec213f1a95d96ce72fb) (cherry picked from commit 39ade66aac7f8cccd980d1f435b92465a50be032)
2023-02-07 11:23:49 +01:00
FORGEJO_API_SPEC := public/assets/forgejo/api.v1.yml
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl \| JSEscape}}/api/v1"|g
SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl \| JSEscape}}/api/v1"|"basePath": "/api/v1"|g
SWAGGER_EXCLUDE := code.gitea.io/sdk
SWAGGER_NEWLINE_COMMAND := -e '$$a\'
[BRANDING] Replace branding in Swagger - "Gitea" is automatically being determined in Swagger and cannot be overridden, therefor we override it after `swagger generate spec` is run. - Resolves https://codeberg.org/forgejo/forgejo/issues/226 (cherry picked from commit 0b453807656b6fbe54284d865e59880460f3d253) [BRANDING] Change Swagger title to Forgejo API (cherry picked from commit 79f6a70b53421be9984a9ad96ebd0d06ab5af02e) (cherry picked from commit 6cd47afe3366a615d40655a435275d5543910065) (cherry picked from commit a7ae2e4c09431cd7a1f18c5b87b9dd87981b538d) (cherry picked from commit 59f837e4661233dafc202ded9ad907dbdf7e3e69) (cherry picked from commit c1c3d1f0e63b880baa32d285d3eba6034137b45a) (cherry picked from commit 4b088713fb0a55c2c37f734ce82f13190ca412dd) (cherry picked from commit 3df1d2137112a95279a8c84a8601e4c137d75d4f) (cherry picked from commit a4a5fdbde4f9ebbf5ba6ba66c8f20a89e54860de) (cherry picked from commit 57aa9ed710a95aa51ae3824873c3766b38da7850) (cherry picked from commit 948b49bf9449af744a1f2e1324187897ed1c0809) (cherry picked from commit be4929ab6a802d7d748f537ab8b798e30588c1d4) (cherry picked from commit 9ecb507457d8a6aa60713762a1a5d2995ed986e5) Conflicts: templates/swagger/ui.tmpl (cherry picked from commit 8e57e688637b9fbd3c33d3e38aed8768a2c07208) (cherry picked from commit f0b3f621e34130c75b35c113ad509ab73118e123) (cherry picked from commit 5b0a6d093ea5210a5ba27705b1d1636e23da8738) (cherry picked from commit 2e0f6b5de8837a439ecadaf3434d006d7014016c) (cherry picked from commit bb08076f5c26481d78855823c2daa1a76d3865fb) (cherry picked from commit 5c9360e38a41a4494b1b1b247f9d57b1a0d91ef0) (cherry picked from commit 2f277561489e1228af163fa4e5d153ceb7eec864) (cherry picked from commit 6fce7eeb511d949249e045a995cc637d3788a1f0) (cherry picked from commit 8d27e7bebd961468bd492c4d64e132a46d97f62b) (cherry picked from commit fda2ee2aaedac8f394d9fc38085f768c775d2c38) (cherry picked from commit fe0489a4d856655fdcf93c16a41995709c47f78f) (cherry picked from commit fe9479b357d2ef0f5fd8247e8356ce7c75135b88) (cherry picked from commit 1deadb2f35c8c0c87cd93b6f04675312b1e667bb) (cherry picked from commit d1cb84b2f225c484755172735841e3b75abce409) (cherry picked from commit 9de15d49f8ff0ef0803e8b3a7437a45358e924b9) (cherry picked from commit 461fbe219c30de7e756ce2cb6dbc354417655a6f) (cherry picked from commit f39bf3ba5b6325898968533e79fdfc5fe74c3810) (cherry picked from commit b3f31c2f7bc5b4f5ed3f7fb6e6a6649331eb179a) (cherry picked from commit b9f493c139bc40bb5aaf361b813019968be75968) (cherry picked from commit 83781b16411d49f2f27b622ac3e806234b477984) (cherry picked from commit 4438ee0434f88fc0dcb917304a5baf5b8c2d11a8) (cherry picked from commit 56b6b368334fe3d11fb55b8e35bbfc314f45405a) (cherry picked from commit dde88ed2fda2403159e78f174357c5e993bce1de) (cherry picked from commit 96bb13ce5428dd88866c92cd4d9b4e216d7e544f) (cherry picked from commit aacc824826922e1a17be556dfbaf36667950a5aa) (cherry picked from commit 0db579b0b365e832b4722fb1a70906c77d384afc) (cherry picked from commit c1fd3777defb547c1aef01b95d7a0feba2258ad9) Conflicts: templates/swagger/v1_json.tmpl https://codeberg.org/forgejo/forgejo/pulls/1832 (cherry picked from commit 5c8a6e1ca883cc0ac65b25ff4fde2e5d52b274f4) (cherry picked from commit ff145b32c729ace3ed11bfbb5a7f1aba5454e999) (cherry picked from commit db9b904b84158c27b1c6004b9ca7f1f7f89066c7) (cherry picked from commit a79e2b2b560851c895c776e737bcf44336e0b31d) (cherry picked from commit a5830247dfece7ee3609bfe89050743d175d924e) (cherry picked from commit 9120bc461727f35062bd2bc8129f422f7e435a0f) (cherry picked from commit cd873945b26ed3008b75de52c8a829880d684126) (cherry picked from commit 6a48e3ea5be6cf818dbccd36611ec07406d6bd35) (cherry picked from commit 489c1ac8fbd87e3f23d91b829728f77e6aafe57c) (cherry picked from commit a1f7fd771eda03c8009f2844f35ea1fdcc4fd158)
2023-01-09 22:28:04 +01:00
SWAGGER_SPEC_BRANDING := s|Gitea API|Forgejo API|g
SWAGGER_SPEC_LICENSE := s|"name": "MIT"|"name": "This file is distributed under the MIT license for the purpose of interoperability"|
TEST_MYSQL_HOST ?= mysql:3306
2024-07-15 17:32:36 +02:00
TEST_MYSQL_DBNAME ?= testgitea?multiStatements=true
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
.PHONY: all
all: build
.PHONY: help
help:
@echo "Make Routines:"
@echo " - \"\" equivalent to \"build\""
@echo " - build build everything"
@echo " - frontend build frontend files"
@echo " - backend build backend files"
@echo " - watch watch everything and continuously rebuild"
@echo " - watch-frontend watch frontend files and continuously rebuild"
@echo " - watch-backend watch backend files and continuously rebuild"
@echo " - clean delete backend and integration files"
@echo " - clean-all delete backend, frontend and integration files"
@echo " - deps install dependencies"
@echo " - deps-frontend install frontend dependencies"
@echo " - deps-backend install backend dependencies"
Split CI pipelines (#23385) - This PR attempts to split our various DB tests into separate pipelines. - It splits up some of the extra feature-related tests rather than having most of them in the MySQL test. - It disables the race detector for some of the pipelines as well, as it can cause slower runs and is mostly redundant when the pipelines just swap DBs. - It builds without SQLite support for any of the non-SQLite pipelines. - It moves the e2e test to using SQLite rather than PG (partially because I moved the minio tests to PG and that mucked up the test config, and partially because it avoids another running service) - It splits up the `go mod download` task in the Makefile from the tool installation, as the tools are only needed in the compliance pipeline. (Arguably even some of the tools aren't needed there, but that could be a follow-up PR) - SQLite is now the only arm64 pipeline, moving PG back to amd64 which can leverage autoscaler Should resolve #22010 - one thing that wasn't changed here but is mentioned in that issue, unit tests are needed in the same pipeline as an integration test in order to form a complete coverage report (at least as far as I could tell), so for now it remains in a pipeline with a DB integration test. Please let me know if I've inadvertently changed something that was how it was on purpose. --- I will say sometimes it's hard to pin down the average time, as a pipeline could be waiting for a runner for X minutes and that brings the total up by X minutes as well, but overall this does seem to be faster on average. --------- Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-10 07:13:17 +01:00
@echo " - deps-tools install tool dependencies"
@echo " - deps-py install python dependencies"
@echo " - lint lint everything"
@echo " - lint-fix lint everything and fix issues"
@echo " - lint-frontend lint frontend files"
@echo " - lint-frontend-fix lint frontend files and fix issues"
@echo " - lint-backend lint backend files"
@echo " - lint-backend-fix lint backend files and fix issues"
@echo " - lint-codespell lint typos"
@echo " - lint-codespell-fix lint typos and fix them automatically"
@echo " - lint-codespell-fix-i lint typos and fix them interactively"
@echo " - lint-go lint go files"
@echo " - lint-go-fix lint go files and fix issues"
@echo " - lint-go-vet lint go files with vet"
@echo " - lint-go-gopls lint go files with gopls"
@echo " - lint-js lint js files"
@echo " - lint-js-fix lint js files and fix issues"
@echo " - lint-css lint css files"
@echo " - lint-css-fix lint css files and fix issues"
@echo " - lint-md lint markdown files"
@echo " - lint-swagger lint swagger files"
@echo " - lint-templates lint template files"
@echo " - lint-renovate lint renovate files"
@echo " - lint-yaml lint yaml files"
@echo " - lint-spell lint spelling"
@echo " - lint-spell-fix lint spelling and fix issues"
@echo " - checks run various consistency checks"
@echo " - checks-frontend check frontend files"
@echo " - checks-backend check backend files"
@echo " - test test everything"
@echo " - show-version-full show the same version as the API endpoint"
@echo " - show-version-major show major release number only"
@echo " - test-frontend test frontend files"
@echo " - test-frontend-coverage test frontend files and display code coverage"
@echo " - test-backend test backend files"
@echo " - test-remote-cacher test backend files that use a remote cache"
2024-04-09 16:49:05 +02:00
@echo " - test-e2e-sqlite[\#name.test.e2e] test end to end using playwright and sqlite"
@echo " - webpack build webpack files"
@echo " - svg build svg files"
@echo " - fomantic build fomantic files"
@echo " - generate run \"go generate\""
@echo " - fmt format the Go code"
@echo " - generate-license update license files"
@echo " - generate-gitignore update gitignore files"
@echo " - generate-manpage generate manpage"
@echo " - generate-gomock generate gomock files"
[API] Forgejo API /api/forgejo/v1 (cherry picked from commit 20b56692693e054bb3c04b4ef12b29b0715b4530) (cherry picked from commit 1574643a6a9634e5b92c033a4bfb69062a86bd05) Update semantic version according to specification (cherry picked from commit 22510f41306f9c133a7e99b61f9c38dabfd4b810) Mise à jour de 'Makefile' (cherry picked from commit c3d85d8409f1bb18a45659a167cf1ffee057f3b6) (cherry picked from commit 5ea23098513c068444226af41faf9be9c4c998e6) (cherry picked from commit ec5217b9d1b94bb04e34ce8c27eecbdc6f3a247a) (cherry picked from commit 14f08e364b2ad7e3176b45d3ec8da5f5605b4315) (cherry picked from commit b4465c67b8737aed9fd79a43046aa3795a298e68) [API] [SEMVER] replace number with version (cherry picked from commit fba48e64977a75e77c9c6cf8e3f8a679a5e7b733) (cherry picked from commit 532ec5d8782703b62d7d02312764e50637cd016e) [API] [SEMVER] [v1.20] less is replaced by css (cherry picked from commit 01ca3a4f4291cf4c62df42cbd12a00638f3cdc70) (cherry picked from commit 1d928c3ab2e1fda6082e1400d89ea96d6605ebaa) (cherry picked from commit a39dc804cd1da86444ed709455857f069475e7db) Conflicts: webpack.config.js (cherry picked from commit adc68578b3eb41215338125edfca91804706f8a1) (cherry picked from commit 9b8d98475fd7efcc15bf0d91b0af6ef3aff64508) (cherry picked from commit 25161039745a63282257eded9616390241af8013) (cherry picked from commit 18e6287963a0e1863cd08fd514a4e732a1904a68) (cherry picked from commit e9694e67ab93ad74f7eae3152d88d95e8493e739) (cherry picked from commit a9763edaf002c8009a2cca4115cb8b926f8cdc85) (cherry picked from commit e2b550f4fba144f9637a212b56bfe30cac1adb3b) (cherry picked from commit 2edac36701e8fa1ff67f87dccfa34cfc00ab66de) [API] Forgejo API /api/forgejo/v1 (squash) Update semver as v1.20 is entering release candidate mode (cherry picked from commit 4995098ec3c6eee19a7ad7bc956b71c6e937c04c) (cherry picked from commit 578ccfdd27d7a280050bdf61d497d07decf98f2f) (cherry picked from commit 1bf6ac09520490f0a56b9b55d7836c2d8ea5d22c) (cherry picked from commit 2fe16b2bfed62c0386d0bfe104f7dcc621d1c3be) (cherry picked from commit 7cd9d027eec5a2b328d06a47f34545943560fe1b) (cherry picked from commit eaed4be2ae88055a15dcc96564440c301a13ba8e) (cherry picked from commit cc94f3115f844a0f16064e49e5eb719d33bc4441) (cherry picked from commit d7a77e35ccfd2d0fc2ba98932296ab7354edd2db) (cherry picked from commit cd8eb68ab7b3e2eaacf78d370c762f43cc19fd6a) (cherry picked from commit 68487ac95f742837e7ff38df902834b6173cd9ab) (cherry picked from commit 616dceb565456d6fac6f58b1c4de43e9d3254090) (cherry picked from commit 545fe5975b47d2eab348a57b87c6fd4590f33442) (cherry picked from commit c042cf8eda2dea805138bd64daa7fbe07865ed5a) (cherry picked from commit ae5e5a7468aa66312055a26841f658574a9b0dd7) (cherry picked from commit 8034ef5fa2648a127f8c84c572bec02a1ff6bb9f) (cherry picked from commit aaf0293034468505449d33ab1483ae65b4175754) (cherry picked from commit daafa8ce58e5e6077da585b13e5190856228a4a3) (cherry picked from commit 7ca3681d3e2ed5ec1ae44364cba476d642e2b557) (cherry picked from commit 39f72cba71ff3f9d2cbb05c88031b34933573a8c) (cherry picked from commit 60a591713097384935ba0ac51a5cd4793f7544a8) (cherry picked from commit 4853bd9e16bc8986ba8159349e93bc3093dc8ab9) [API] Move forgejo api file (squash) - Move the file to accommodate https://codeberg.org/forgejo/forgejo/commit/faa28b5a44912f1c63afddab9396bae9e6fe061c (cherry picked from commit bce89351d251bfa18c677b30bc7da80856d919fb) (cherry picked from commit 11ae7f6e85395b287c6f4108c531aa1a81fd964c) (cherry picked from commit 25e96cfcb28859406329090eb0c7990bea4e73eb) (cherry picked from commit 6d8d19b39156a7f8b4db5022915590593df94f1f) (cherry picked from commit 5afc5c454b7d70f95b83e6c3b4c9e2cb6e2d0ef5) (cherry picked from commit 86d07b4c249211bdb77c0520f99f2c8e5d89b516) (cherry picked from commit e54d869fdae44811faaa80f3757efbc93bf0bce4) (cherry picked from commit ab31ef1bba3bc5188e0f3ce5e5fa33335877cf47) (cherry picked from commit 511cbca2f3799646edf8eae00464b87f43ca280f) (cherry picked from commit 333916fea874509063f9449f07d79e4cafbcf06f) (cherry picked from commit 3802bcd7c9865b77151ef454c0bdc2ce32157a41) (cherry picked from commit 5d0fa034f77388ed21735a22cf1a2a23562245c3) (cherry picked from commit d15627aa0dfb4ffc2eb7ab0ce99b7c5b2bf06dcf) (cherry picked from commit ba0b21b9305b6fecf23aeec213f1a95d96ce72fb) (cherry picked from commit 39ade66aac7f8cccd980d1f435b92465a50be032)
2023-02-07 11:23:49 +01:00
@echo " - generate-forgejo-api generate the forgejo API from spec"
@echo " - forgejo-api-validate check if the forgejo API matches the specs"
@echo " - generate-swagger generate the swagger spec from code comments"
@echo " - swagger-validate check if the swagger spec is valid"
@echo " - go-licenses regenerate go licenses"
@echo " - tidy run go mod tidy"
@echo " - test[\#TestSpecificName] run unit test"
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
[CHORE] Support reproducible builds This is a step towards making Forgejo's binaries (the one listed in the release tab) reproducible. In order to make the actual binary reproducible, we have to ensure that the release workflow has the correct configuration to produce such reproducible binaries. The release workflow currently uses the Dockerfile to produce binaries, as this is one of the easiest ways to do cross-compiling for Go binaries with CGO enabled (due to SQLite). In the Dockerfile, two new arguments are being given to the build command. `-trimpath` ensures that the workpath directory doesn't get included in the binary; this means that file names (such as for panics) are relative (to the workpath) and not absolute, which shouldn't impact debugging. `-buildid=` is added to the linker flag; it sets the BuildID of the Go linker to be empty; the `-buildid` hashes the input actions and output content; these vary from build to build for unknown reasons, but likely because of the involvement of temporary file names, this doesn't have any effect on the behavior of the resulting binary. The Makefile receives a new command, `reproduce-build#$VERSION` which can be used by people to produce a reproducible Forgejo binary of a particular release; it roughly does what the release workflow also does. Build the Dockerfile and extract the Forgejo binary from it. This doesn't allow to produce a reproducible version for every release, only for those that include this patch, as it needs to call the makefile of that version in order to make a reproducible binary. There's one thing left to do: the Dockerfile pins the Go version to a minor level and not to a patch level. This means that if a new Go patch version is released, that will be used instead and will result in a different binary that isn't bit to bit the same as the one that Forgejo has released.
2024-08-15 20:53:47 +02:00
@echo " - reproduce-build\#version build a reproducible binary for the specified release version"
###
# Check system and environment requirements
###
.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 '.' ' ');))
2020-03-20 15:29:31 +01:00
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
echo "Forgejo requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \
exit 1; \
fi
2020-01-14 01:06:54 +01:00
.PHONY: git-check
git-check:
@if git lfs >/dev/null 2>&1 ; then : ; else \
echo "Forgejo requires git with lfs support to run tests." ; \
2020-01-14 01:06:54 +01:00
exit 1; \
fi
.PHONY: node-check
node-check:
$(eval MIN_NODE_VERSION_STR := $(shell grep -Eo '"node":.*[0-9.]+"' package.json | sed -n 's/.*[^0-9.]\([0-9.]*\)"/\1/p'))
$(eval MIN_NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_NODE_VERSION_STR)' | tr '.' ' ')))
$(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');))
$(eval NPM_MISSING := $(shell hash npm > /dev/null 2>&1 || echo 1))
2020-03-20 15:29:31 +01:00
@if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" -o "$(NPM_MISSING)" = "1" ]; then \
echo "Forgejo requires Node.js $(MIN_NODE_VERSION_STR) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \
exit 1; \
fi
###
# Basic maintenance, check and lint targets
###
.PHONY: clean-all
clean-all: clean
rm -rf $(WEBPACK_DEST_ENTRIES) node_modules
.PHONY: clean
clean:
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA_DEST) $(BINDATA_HASH) \
integrations*.test \
e2e*.test \
tests/integration/gitea-integration-* \
tests/integration/indexers-* \
tests/mysql.ini tests/pgsql.ini man/ \
tests/e2e/gitea-e2e-*/ \
tests/e2e/indexers-*/ \
tests/e2e/reports/ tests/e2e/test-artifacts/ tests/e2e/test-snapshots/
.PHONY: fmt
fmt:
@GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
$(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
@git diff --exit-code --color=always $(GO_SOURCES) templates $(WEB_DIRS) \
|| (code=$$?; echo "Please run 'make fmt' and commit the result"; exit $${code})
.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
OAPI_CODEGEN_PACKAGE ?= github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.12.4
KIN_OPENAPI_CODEGEN_PACKAGE ?= github.com/getkin/kin-openapi/cmd/validate@v0.114.0
[API] Forgejo API /api/forgejo/v1 (cherry picked from commit 20b56692693e054bb3c04b4ef12b29b0715b4530) (cherry picked from commit 1574643a6a9634e5b92c033a4bfb69062a86bd05) Update semantic version according to specification (cherry picked from commit 22510f41306f9c133a7e99b61f9c38dabfd4b810) Mise à jour de 'Makefile' (cherry picked from commit c3d85d8409f1bb18a45659a167cf1ffee057f3b6) (cherry picked from commit 5ea23098513c068444226af41faf9be9c4c998e6) (cherry picked from commit ec5217b9d1b94bb04e34ce8c27eecbdc6f3a247a) (cherry picked from commit 14f08e364b2ad7e3176b45d3ec8da5f5605b4315) (cherry picked from commit b4465c67b8737aed9fd79a43046aa3795a298e68) [API] [SEMVER] replace number with version (cherry picked from commit fba48e64977a75e77c9c6cf8e3f8a679a5e7b733) (cherry picked from commit 532ec5d8782703b62d7d02312764e50637cd016e) [API] [SEMVER] [v1.20] less is replaced by css (cherry picked from commit 01ca3a4f4291cf4c62df42cbd12a00638f3cdc70) (cherry picked from commit 1d928c3ab2e1fda6082e1400d89ea96d6605ebaa) (cherry picked from commit a39dc804cd1da86444ed709455857f069475e7db) Conflicts: webpack.config.js (cherry picked from commit adc68578b3eb41215338125edfca91804706f8a1) (cherry picked from commit 9b8d98475fd7efcc15bf0d91b0af6ef3aff64508) (cherry picked from commit 25161039745a63282257eded9616390241af8013) (cherry picked from commit 18e6287963a0e1863cd08fd514a4e732a1904a68) (cherry picked from commit e9694e67ab93ad74f7eae3152d88d95e8493e739) (cherry picked from commit a9763edaf002c8009a2cca4115cb8b926f8cdc85) (cherry picked from commit e2b550f4fba144f9637a212b56bfe30cac1adb3b) (cherry picked from commit 2edac36701e8fa1ff67f87dccfa34cfc00ab66de) [API] Forgejo API /api/forgejo/v1 (squash) Update semver as v1.20 is entering release candidate mode (cherry picked from commit 4995098ec3c6eee19a7ad7bc956b71c6e937c04c) (cherry picked from commit 578ccfdd27d7a280050bdf61d497d07decf98f2f) (cherry picked from commit 1bf6ac09520490f0a56b9b55d7836c2d8ea5d22c) (cherry picked from commit 2fe16b2bfed62c0386d0bfe104f7dcc621d1c3be) (cherry picked from commit 7cd9d027eec5a2b328d06a47f34545943560fe1b) (cherry picked from commit eaed4be2ae88055a15dcc96564440c301a13ba8e) (cherry picked from commit cc94f3115f844a0f16064e49e5eb719d33bc4441) (cherry picked from commit d7a77e35ccfd2d0fc2ba98932296ab7354edd2db) (cherry picked from commit cd8eb68ab7b3e2eaacf78d370c762f43cc19fd6a) (cherry picked from commit 68487ac95f742837e7ff38df902834b6173cd9ab) (cherry picked from commit 616dceb565456d6fac6f58b1c4de43e9d3254090) (cherry picked from commit 545fe5975b47d2eab348a57b87c6fd4590f33442) (cherry picked from commit c042cf8eda2dea805138bd64daa7fbe07865ed5a) (cherry picked from commit ae5e5a7468aa66312055a26841f658574a9b0dd7) (cherry picked from commit 8034ef5fa2648a127f8c84c572bec02a1ff6bb9f) (cherry picked from commit aaf0293034468505449d33ab1483ae65b4175754) (cherry picked from commit daafa8ce58e5e6077da585b13e5190856228a4a3) (cherry picked from commit 7ca3681d3e2ed5ec1ae44364cba476d642e2b557) (cherry picked from commit 39f72cba71ff3f9d2cbb05c88031b34933573a8c) (cherry picked from commit 60a591713097384935ba0ac51a5cd4793f7544a8) (cherry picked from commit 4853bd9e16bc8986ba8159349e93bc3093dc8ab9) [API] Move forgejo api file (squash) - Move the file to accommodate https://codeberg.org/forgejo/forgejo/commit/faa28b5a44912f1c63afddab9396bae9e6fe061c (cherry picked from commit bce89351d251bfa18c677b30bc7da80856d919fb) (cherry picked from commit 11ae7f6e85395b287c6f4108c531aa1a81fd964c) (cherry picked from commit 25e96cfcb28859406329090eb0c7990bea4e73eb) (cherry picked from commit 6d8d19b39156a7f8b4db5022915590593df94f1f) (cherry picked from commit 5afc5c454b7d70f95b83e6c3b4c9e2cb6e2d0ef5) (cherry picked from commit 86d07b4c249211bdb77c0520f99f2c8e5d89b516) (cherry picked from commit e54d869fdae44811faaa80f3757efbc93bf0bce4) (cherry picked from commit ab31ef1bba3bc5188e0f3ce5e5fa33335877cf47) (cherry picked from commit 511cbca2f3799646edf8eae00464b87f43ca280f) (cherry picked from commit 333916fea874509063f9449f07d79e4cafbcf06f) (cherry picked from commit 3802bcd7c9865b77151ef454c0bdc2ce32157a41) (cherry picked from commit 5d0fa034f77388ed21735a22cf1a2a23562245c3) (cherry picked from commit d15627aa0dfb4ffc2eb7ab0ce99b7c5b2bf06dcf) (cherry picked from commit ba0b21b9305b6fecf23aeec213f1a95d96ce72fb) (cherry picked from commit 39ade66aac7f8cccd980d1f435b92465a50be032)
2023-02-07 11:23:49 +01:00
FORGEJO_API_SERVER = routers/api/forgejo/v1/generated.go
.PHONY: generate-forgejo-api
generate-forgejo-api: $(FORGEJO_API_SPEC)
$(GO) run $(OAPI_CODEGEN_PACKAGE) -package v1 -generate chi-server,types $< > $(FORGEJO_API_SERVER)
.PHONY: forgejo-api-check
forgejo-api-check: generate-forgejo-api
@git diff --exit-code --color=always $(FORGEJO_API_SERVER) \
|| (code=$$?; echo "Please run 'make generate-forgejo-api' and commit the result"; exit $${code})
[API] Forgejo API /api/forgejo/v1 (cherry picked from commit 20b56692693e054bb3c04b4ef12b29b0715b4530) (cherry picked from commit 1574643a6a9634e5b92c033a4bfb69062a86bd05) Update semantic version according to specification (cherry picked from commit 22510f41306f9c133a7e99b61f9c38dabfd4b810) Mise à jour de 'Makefile' (cherry picked from commit c3d85d8409f1bb18a45659a167cf1ffee057f3b6) (cherry picked from commit 5ea23098513c068444226af41faf9be9c4c998e6) (cherry picked from commit ec5217b9d1b94bb04e34ce8c27eecbdc6f3a247a) (cherry picked from commit 14f08e364b2ad7e3176b45d3ec8da5f5605b4315) (cherry picked from commit b4465c67b8737aed9fd79a43046aa3795a298e68) [API] [SEMVER] replace number with version (cherry picked from commit fba48e64977a75e77c9c6cf8e3f8a679a5e7b733) (cherry picked from commit 532ec5d8782703b62d7d02312764e50637cd016e) [API] [SEMVER] [v1.20] less is replaced by css (cherry picked from commit 01ca3a4f4291cf4c62df42cbd12a00638f3cdc70) (cherry picked from commit 1d928c3ab2e1fda6082e1400d89ea96d6605ebaa) (cherry picked from commit a39dc804cd1da86444ed709455857f069475e7db) Conflicts: webpack.config.js (cherry picked from commit adc68578b3eb41215338125edfca91804706f8a1) (cherry picked from commit 9b8d98475fd7efcc15bf0d91b0af6ef3aff64508) (cherry picked from commit 25161039745a63282257eded9616390241af8013) (cherry picked from commit 18e6287963a0e1863cd08fd514a4e732a1904a68) (cherry picked from commit e9694e67ab93ad74f7eae3152d88d95e8493e739) (cherry picked from commit a9763edaf002c8009a2cca4115cb8b926f8cdc85) (cherry picked from commit e2b550f4fba144f9637a212b56bfe30cac1adb3b) (cherry picked from commit 2edac36701e8fa1ff67f87dccfa34cfc00ab66de) [API] Forgejo API /api/forgejo/v1 (squash) Update semver as v1.20 is entering release candidate mode (cherry picked from commit 4995098ec3c6eee19a7ad7bc956b71c6e937c04c) (cherry picked from commit 578ccfdd27d7a280050bdf61d497d07decf98f2f) (cherry picked from commit 1bf6ac09520490f0a56b9b55d7836c2d8ea5d22c) (cherry picked from commit 2fe16b2bfed62c0386d0bfe104f7dcc621d1c3be) (cherry picked from commit 7cd9d027eec5a2b328d06a47f34545943560fe1b) (cherry picked from commit eaed4be2ae88055a15dcc96564440c301a13ba8e) (cherry picked from commit cc94f3115f844a0f16064e49e5eb719d33bc4441) (cherry picked from commit d7a77e35ccfd2d0fc2ba98932296ab7354edd2db) (cherry picked from commit cd8eb68ab7b3e2eaacf78d370c762f43cc19fd6a) (cherry picked from commit 68487ac95f742837e7ff38df902834b6173cd9ab) (cherry picked from commit 616dceb565456d6fac6f58b1c4de43e9d3254090) (cherry picked from commit 545fe5975b47d2eab348a57b87c6fd4590f33442) (cherry picked from commit c042cf8eda2dea805138bd64daa7fbe07865ed5a) (cherry picked from commit ae5e5a7468aa66312055a26841f658574a9b0dd7) (cherry picked from commit 8034ef5fa2648a127f8c84c572bec02a1ff6bb9f) (cherry picked from commit aaf0293034468505449d33ab1483ae65b4175754) (cherry picked from commit daafa8ce58e5e6077da585b13e5190856228a4a3) (cherry picked from commit 7ca3681d3e2ed5ec1ae44364cba476d642e2b557) (cherry picked from commit 39f72cba71ff3f9d2cbb05c88031b34933573a8c) (cherry picked from commit 60a591713097384935ba0ac51a5cd4793f7544a8) (cherry picked from commit 4853bd9e16bc8986ba8159349e93bc3093dc8ab9) [API] Move forgejo api file (squash) - Move the file to accommodate https://codeberg.org/forgejo/forgejo/commit/faa28b5a44912f1c63afddab9396bae9e6fe061c (cherry picked from commit bce89351d251bfa18c677b30bc7da80856d919fb) (cherry picked from commit 11ae7f6e85395b287c6f4108c531aa1a81fd964c) (cherry picked from commit 25e96cfcb28859406329090eb0c7990bea4e73eb) (cherry picked from commit 6d8d19b39156a7f8b4db5022915590593df94f1f) (cherry picked from commit 5afc5c454b7d70f95b83e6c3b4c9e2cb6e2d0ef5) (cherry picked from commit 86d07b4c249211bdb77c0520f99f2c8e5d89b516) (cherry picked from commit e54d869fdae44811faaa80f3757efbc93bf0bce4) (cherry picked from commit ab31ef1bba3bc5188e0f3ce5e5fa33335877cf47) (cherry picked from commit 511cbca2f3799646edf8eae00464b87f43ca280f) (cherry picked from commit 333916fea874509063f9449f07d79e4cafbcf06f) (cherry picked from commit 3802bcd7c9865b77151ef454c0bdc2ce32157a41) (cherry picked from commit 5d0fa034f77388ed21735a22cf1a2a23562245c3) (cherry picked from commit d15627aa0dfb4ffc2eb7ab0ce99b7c5b2bf06dcf) (cherry picked from commit ba0b21b9305b6fecf23aeec213f1a95d96ce72fb) (cherry picked from commit 39ade66aac7f8cccd980d1f435b92465a50be032)
2023-02-07 11:23:49 +01:00
.PHONY: forgejo-api-validate
forgejo-api-validate:
$(GO) run $(KIN_OPENAPI_CODEGEN_PACKAGE) $(FORGEJO_API_SPEC)
.PHONY: generate-swagger
generate-swagger: $(SWAGGER_SPEC)
$(SWAGGER_SPEC): $(GO_SOURCES_NO_BINDATA)
$(GO) run $(SWAGGER_PACKAGE) generate spec -x "$(SWAGGER_EXCLUDE)" -o './$(SWAGGER_SPEC)'
$(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
$(SED_INPLACE) $(SWAGGER_NEWLINE_COMMAND) './$(SWAGGER_SPEC)'
[BRANDING] Replace branding in Swagger - "Gitea" is automatically being determined in Swagger and cannot be overridden, therefor we override it after `swagger generate spec` is run. - Resolves https://codeberg.org/forgejo/forgejo/issues/226 (cherry picked from commit 0b453807656b6fbe54284d865e59880460f3d253) [BRANDING] Change Swagger title to Forgejo API (cherry picked from commit 79f6a70b53421be9984a9ad96ebd0d06ab5af02e) (cherry picked from commit 6cd47afe3366a615d40655a435275d5543910065) (cherry picked from commit a7ae2e4c09431cd7a1f18c5b87b9dd87981b538d) (cherry picked from commit 59f837e4661233dafc202ded9ad907dbdf7e3e69) (cherry picked from commit c1c3d1f0e63b880baa32d285d3eba6034137b45a) (cherry picked from commit 4b088713fb0a55c2c37f734ce82f13190ca412dd) (cherry picked from commit 3df1d2137112a95279a8c84a8601e4c137d75d4f) (cherry picked from commit a4a5fdbde4f9ebbf5ba6ba66c8f20a89e54860de) (cherry picked from commit 57aa9ed710a95aa51ae3824873c3766b38da7850) (cherry picked from commit 948b49bf9449af744a1f2e1324187897ed1c0809) (cherry picked from commit be4929ab6a802d7d748f537ab8b798e30588c1d4) (cherry picked from commit 9ecb507457d8a6aa60713762a1a5d2995ed986e5) Conflicts: templates/swagger/ui.tmpl (cherry picked from commit 8e57e688637b9fbd3c33d3e38aed8768a2c07208) (cherry picked from commit f0b3f621e34130c75b35c113ad509ab73118e123) (cherry picked from commit 5b0a6d093ea5210a5ba27705b1d1636e23da8738) (cherry picked from commit 2e0f6b5de8837a439ecadaf3434d006d7014016c) (cherry picked from commit bb08076f5c26481d78855823c2daa1a76d3865fb) (cherry picked from commit 5c9360e38a41a4494b1b1b247f9d57b1a0d91ef0) (cherry picked from commit 2f277561489e1228af163fa4e5d153ceb7eec864) (cherry picked from commit 6fce7eeb511d949249e045a995cc637d3788a1f0) (cherry picked from commit 8d27e7bebd961468bd492c4d64e132a46d97f62b) (cherry picked from commit fda2ee2aaedac8f394d9fc38085f768c775d2c38) (cherry picked from commit fe0489a4d856655fdcf93c16a41995709c47f78f) (cherry picked from commit fe9479b357d2ef0f5fd8247e8356ce7c75135b88) (cherry picked from commit 1deadb2f35c8c0c87cd93b6f04675312b1e667bb) (cherry picked from commit d1cb84b2f225c484755172735841e3b75abce409) (cherry picked from commit 9de15d49f8ff0ef0803e8b3a7437a45358e924b9) (cherry picked from commit 461fbe219c30de7e756ce2cb6dbc354417655a6f) (cherry picked from commit f39bf3ba5b6325898968533e79fdfc5fe74c3810) (cherry picked from commit b3f31c2f7bc5b4f5ed3f7fb6e6a6649331eb179a) (cherry picked from commit b9f493c139bc40bb5aaf361b813019968be75968) (cherry picked from commit 83781b16411d49f2f27b622ac3e806234b477984) (cherry picked from commit 4438ee0434f88fc0dcb917304a5baf5b8c2d11a8) (cherry picked from commit 56b6b368334fe3d11fb55b8e35bbfc314f45405a) (cherry picked from commit dde88ed2fda2403159e78f174357c5e993bce1de) (cherry picked from commit 96bb13ce5428dd88866c92cd4d9b4e216d7e544f) (cherry picked from commit aacc824826922e1a17be556dfbaf36667950a5aa) (cherry picked from commit 0db579b0b365e832b4722fb1a70906c77d384afc) (cherry picked from commit c1fd3777defb547c1aef01b95d7a0feba2258ad9) Conflicts: templates/swagger/v1_json.tmpl https://codeberg.org/forgejo/forgejo/pulls/1832 (cherry picked from commit 5c8a6e1ca883cc0ac65b25ff4fde2e5d52b274f4) (cherry picked from commit ff145b32c729ace3ed11bfbb5a7f1aba5454e999) (cherry picked from commit db9b904b84158c27b1c6004b9ca7f1f7f89066c7) (cherry picked from commit a79e2b2b560851c895c776e737bcf44336e0b31d) (cherry picked from commit a5830247dfece7ee3609bfe89050743d175d924e) (cherry picked from commit 9120bc461727f35062bd2bc8129f422f7e435a0f) (cherry picked from commit cd873945b26ed3008b75de52c8a829880d684126) (cherry picked from commit 6a48e3ea5be6cf818dbccd36611ec07406d6bd35) (cherry picked from commit 489c1ac8fbd87e3f23d91b829728f77e6aafe57c) (cherry picked from commit a1f7fd771eda03c8009f2844f35ea1fdcc4fd158)
2023-01-09 22:28:04 +01:00
$(SED_INPLACE) '$(SWAGGER_SPEC_BRANDING)' './$(SWAGGER_SPEC)'
$(SED_INPLACE) '$(SWAGGER_SPEC_LICENSE)' './$(SWAGGER_SPEC)'
2018-04-20 11:13:50 +02:00
.PHONY: swagger-check
swagger-check: generate-swagger
@git diff --exit-code --color=always '$(SWAGGER_SPEC)' \
|| (code=$$?; echo "Please run 'make generate-swagger' and commit the result"; exit $${code})
2018-04-20 11:13:50 +02:00
.PHONY: swagger-validate
swagger-validate:
$(SED_INPLACE) '$(SWAGGER_SPEC_S_JSON)' './$(SWAGGER_SPEC)'
$(GO) run $(SWAGGER_PACKAGE) validate './$(SWAGGER_SPEC)'
$(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
.PHONY: checks
checks: checks-frontend checks-backend
.PHONY: checks-frontend
checks-frontend: lockfile-check svg-check
.PHONY: checks-backend
checks-backend: tidy-check swagger-check fmt-check swagger-validate security-check
.PHONY: lint
lint: lint-frontend lint-backend lint-spell
.PHONY: lint-fix
lint-fix: lint-frontend-fix lint-backend-fix lint-spell-fix
.PHONY: lint-frontend
lint-frontend: lint-js lint-css
.PHONY: lint-frontend-fix
lint-frontend-fix: lint-js-fix lint-css-fix
.PHONY: lint-backend
lint-backend: lint-go lint-go-vet lint-editorconfig lint-renovate
.PHONY: lint-backend-fix
lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig
.PHONY: lint-codespell
lint-codespell:
codespell
.PHONY: lint-codespell-fix
lint-codespell-fix:
codespell -w
.PHONY: lint-codespell-fix-i
lint-codespell-fix-i:
codespell -w -i 3 -C 2
.PHONY: lint-js
lint-js: node_modules
npx eslint --color --max-warnings=0 --ext js,vue $(ESLINT_FILES)
.PHONY: lint-js-fix
lint-js-fix: node_modules
npx eslint --color --max-warnings=0 --ext js,vue $(ESLINT_FILES) --fix
.PHONY: lint-css
lint-css: node_modules
npx stylelint --color --max-warnings=0 $(STYLELINT_FILES)
.PHONY: lint-css-fix
lint-css-fix: node_modules
npx stylelint --color --max-warnings=0 $(STYLELINT_FILES) --fix
.PHONY: lint-swagger
lint-swagger: node_modules
npx spectral lint -q -F hint $(SWAGGER_SPEC)
.PHONY: lint-renovate
lint-renovate: node_modules
npx --yes --package $(RENOVATE_NPM_PACKAGE) -- renovate-config-validator --strict > .lint-renovate 2>&1 || true
@if grep --quiet --extended-regexp -e '^( WARN:|ERROR:)' .lint-renovate ; then cat .lint-renovate ; rm .lint-renovate ; exit 1 ; fi
@rm .lint-renovate
.PHONY: lint-md
lint-md: node_modules
npx markdownlint docs *.md
.PHONY: lint-spell
lint-spell: lint-codespell
@go run $(MISSPELL_PACKAGE) -error $(SPELLCHECK_FILES)
.PHONY: lint-spell-fix
lint-spell-fix: lint-codespell-fix
@go run $(MISSPELL_PACKAGE) -w $(SPELLCHECK_FILES)
RUN_DEADCODE = $(GO) run $(DEADCODE_PACKAGE) -generated=false -f='{{println .Path}}{{range .Funcs}}{{printf "\t%s\n" .Name}}{{end}}{{println}}' -test code.gitea.io/gitea
.PHONY: lint-go
lint-go:
[TESTS] add GOLANGCI_LINT_ARGS to control golangci calls It is for instance useful with: GOLANGCI_LINT_ARGS="--concurrency $(expr $(nproc) / 2)" make lint-backend on a laptop where overcommitting the CPU degrades the UI performances. (cherry picked from commit 76023319c4275645b9c8c3bd896c1e60e1d57ae7) (cherry picked from commit 55eb05b03db15355745af83e612406baccc2b126) (cherry picked from commit 49c84de3dff883c89a3c0115ab7e0a06aad7bb45) (cherry picked from commit e8e26f08a6f31fc68797d6e0a927e75565abc350) (cherry picked from commit 401aa12cac3ad50ffa21c5e141d72e1d7cfd45ff) (cherry picked from commit 4ae8f663ad287269e1dc8bee19b3edcf41a431f8) (cherry picked from commit 2d87e4953b93204d2da530315e03bf311cd22e10) (cherry picked from commit e79be7d80e24effa110d4752525ab704ab6b16c0) (cherry picked from commit 65e367399867e13a9565e2553901be60036e27d8) (cherry picked from commit 54e5a5dca264a83ade0cbcf52a5f66660b8a4d86) (cherry picked from commit 99e8725e680bd0b7a297ac163aef0e5fecac2363) (cherry picked from commit c2048b352f955978bd8caa67f606cd0d8431b791) (cherry picked from commit ad142d18a8326c147b076e058cdd2a637f2ef80a) (cherry picked from commit 489d42770e1224b20a0b815be31a13bfe4e03a7f) (cherry picked from commit 2de9069ed409071f423b3c6a4032cdc8dbb2be2b) (cherry picked from commit 782d8ef6df8b02086ab0486ab0cfcc5b62b4d7ce) (cherry picked from commit 2068b26cd93bcec3f99af3bafcb3c7cd6a71ca15) (cherry picked from commit 1857f062dd1423d279a619a2588bc1b41a512f74) (cherry picked from commit beced6a2cca433d6dc4d680b2b241be7de65081f) (cherry picked from commit 538ca28ee88cdbfaa2414d58163d377d1768ce56) (cherry picked from commit cc25e3f35f426688a35cf518205f296377e38f58)
2023-09-10 16:47:22 +02:00
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS)
$(RUN_DEADCODE) > .cur-deadcode-out
@$(DIFF) .deadcode-out .cur-deadcode-out \
|| (code=$$?; echo "Please run 'make lint-go-fix' and commit the result"; exit $${code})
.PHONY: lint-go-fix
lint-go-fix:
[TESTS] add GOLANGCI_LINT_ARGS to control golangci calls It is for instance useful with: GOLANGCI_LINT_ARGS="--concurrency $(expr $(nproc) / 2)" make lint-backend on a laptop where overcommitting the CPU degrades the UI performances. (cherry picked from commit 76023319c4275645b9c8c3bd896c1e60e1d57ae7) (cherry picked from commit 55eb05b03db15355745af83e612406baccc2b126) (cherry picked from commit 49c84de3dff883c89a3c0115ab7e0a06aad7bb45) (cherry picked from commit e8e26f08a6f31fc68797d6e0a927e75565abc350) (cherry picked from commit 401aa12cac3ad50ffa21c5e141d72e1d7cfd45ff) (cherry picked from commit 4ae8f663ad287269e1dc8bee19b3edcf41a431f8) (cherry picked from commit 2d87e4953b93204d2da530315e03bf311cd22e10) (cherry picked from commit e79be7d80e24effa110d4752525ab704ab6b16c0) (cherry picked from commit 65e367399867e13a9565e2553901be60036e27d8) (cherry picked from commit 54e5a5dca264a83ade0cbcf52a5f66660b8a4d86) (cherry picked from commit 99e8725e680bd0b7a297ac163aef0e5fecac2363) (cherry picked from commit c2048b352f955978bd8caa67f606cd0d8431b791) (cherry picked from commit ad142d18a8326c147b076e058cdd2a637f2ef80a) (cherry picked from commit 489d42770e1224b20a0b815be31a13bfe4e03a7f) (cherry picked from commit 2de9069ed409071f423b3c6a4032cdc8dbb2be2b) (cherry picked from commit 782d8ef6df8b02086ab0486ab0cfcc5b62b4d7ce) (cherry picked from commit 2068b26cd93bcec3f99af3bafcb3c7cd6a71ca15) (cherry picked from commit 1857f062dd1423d279a619a2588bc1b41a512f74) (cherry picked from commit beced6a2cca433d6dc4d680b2b241be7de65081f) (cherry picked from commit 538ca28ee88cdbfaa2414d58163d377d1768ce56) (cherry picked from commit cc25e3f35f426688a35cf518205f296377e38f58)
2023-09-10 16:47:22 +02:00
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS) --fix
$(RUN_DEADCODE) > .deadcode-out
# workaround step for the lint-go-windows CI task because 'go run' can not
# have distinct GOOS/GOARCH for its build and run steps
.PHONY: lint-go-windows
lint-go-windows:
@GOOS= GOARCH= $(GO) install $(GOLANGCI_LINT_PACKAGE)
golangci-lint run
.PHONY: lint-go-vet
lint-go-vet:
@echo "Running go vet..."
@$(GO) vet ./...
.PHONY: lint-go-gopls
lint-go-gopls:
@echo "Running gopls check..."
@GO=$(GO) GOPLS_PACKAGE=$(GOPLS_PACKAGE) tools/lint-go-gopls.sh $(GO_SOURCES_NO_BINDATA)
.PHONY: lint-editorconfig
lint-editorconfig:
$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates .forgejo/workflows
.PHONY: lint-templates
lint-templates: .venv node_modules
@node tools/lint-templates-svg.js
@poetry run djlint $(shell find templates -type f -iname '*.tmpl')
.PHONY: lint-yaml
lint-yaml: .venv
@poetry run yamllint .
.PHONY: security-check
security-check:
go run $(GOVULNCHECK_PACKAGE) ./...
###
# Development and testing targets
###
.PHONY: watch
watch:
@bash tools/watch.sh
.PHONY: watch-frontend
watch-frontend: node-check node_modules
@rm -rf $(WEBPACK_DEST_ENTRIES)
NODE_ENV=development npx webpack --watch --progress
.PHONY: watch-backend
watch-backend: go-check
GITEA_RUN_MODE=dev $(GO) run $(AIR_PACKAGE) -c .air.toml
.PHONY: test
test: test-frontend test-backend
.PHONY: test-backend
test-backend:
@echo "Running go test with $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..."
@$(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' $(GO_TEST_PACKAGES)
.PHONY: test-remote-cacher
test-remote-cacher:
@echo "Running go test with $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..."
@$(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' $(GO_TEST_REMOTE_CACHER_PACKAGES)
.PHONY: test-frontend
test-frontend: node_modules
npx vitest
.PHONY: test-frontend-coverage
test-frontend-coverage: node_modules
npx vitest --coverage --coverage.include 'web_src/**'
.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:"; \
echo "$${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
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
2019-10-16 15:42:42 +02:00
.PHONY: test\#%
test\#%:
Use native git variants by default with go-git variants as build tag (#13673) * Move last commit cache back into modules/git Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from the interface for last commit cache Signed-off-by: Andrew Thornton <art27@cantab.net> * move cacheref to last_commit_cache Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from routers/private/hook Signed-off-by: Andrew Thornton <art27@cantab.net> * Move FindLFSFiles to pipeline Signed-off-by: Andrew Thornton <art27@cantab.net> * Make no-go-git variants Signed-off-by: Andrew Thornton <art27@cantab.net> * Submodule RefID Signed-off-by: Andrew Thornton <art27@cantab.net> * fix issue with GetCommitsInfo Signed-off-by: Andrew Thornton <art27@cantab.net> * fix GetLastCommitForPaths Signed-off-by: Andrew Thornton <art27@cantab.net> * Improve efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * More efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * even faster Signed-off-by: Andrew Thornton <art27@cantab.net> * Reduce duplication * As per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * attempt to fix drone Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test-tags Signed-off-by: Andrew Thornton <art27@cantab.net> * default to use no-go-git variants and add gogit build tag Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-12-17 15:00:47 +01:00
@echo "Running go test with -tags '$(TEST_TAGS)'..."
@$(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_TEST_PACKAGES)
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however. ## Features - [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.) - [x] Verify commits signed with the default gpg as valid - [x] Signer, Committer and Author can all be different - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon. - [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg - [x] Try to match the default key with a user on gitea - this is done at verification time - [x] Make things configurable? - app.ini configuration done - [x] when checking commits are signed need to check if they're actually verifiable too - [x] Add documentation I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
2019-10-16 15:42:42 +02:00
2017-09-07 19:22:15 +02:00
.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 build/gocovmerge.go integration.coverage-bodged.out coverage-bodged.out > coverage.all
.PHONY: unit-test-coverage
unit-test-coverage:
@echo "Running unit-test-coverage $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..."
@$(GO) test $(GOTESTFLAGS) -timeout=20m -tags='$(TEST_TAGS)' -cover -coverprofile coverage.out $(GO_TEST_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
2015-11-08 20:31:49 +01:00
.PHONY: tidy
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
@git diff --exit-code --color=always go.mod go.sum $(GO_LICENSE_FILE) \
|| (code=$$?; echo "Please run 'make tidy' and commit the result"; exit $${code})
.PHONY: go-licenses
go-licenses: $(GO_LICENSE_FILE)
$(GO_LICENSE_FILE): go.mod go.sum
-$(shell $(GO) env GOROOT)/bin/go run $(GO_LICENSES_PACKAGE) save . --force --ignore code.gitea.io/gitea --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null
$(GO) run build/generate-go-licenses.go $(GO_LICENSE_TMP_DIR) $(GO_LICENSE_FILE)
@rm -rf $(GO_LICENSE_TMP_DIR)
generate-ini-sqlite:
sed -e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
-e 's|{{TEST_TYPE}}|$(or $(TEST_TYPE),integration)|g' \
tests/sqlite.ini.tmpl > tests/sqlite.ini
.PHONY: test-sqlite
test-sqlite: integrations.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./integrations.sqlite.test
.PHONY: test-sqlite\#%
test-sqlite\#%: integrations.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./integrations.sqlite.test -test.run $(subst .,/,$*)
.PHONY: test-sqlite-migration
test-sqlite-migration: migrations.sqlite.test migrations.individual.sqlite.test
generate-ini-mysql:
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
-e 's|{{TEST_TYPE}}|$(or $(TEST_TYPE),integration)|g' \
tests/mysql.ini.tmpl > tests/mysql.ini
.PHONY: test-mysql
test-mysql: integrations.mysql.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./integrations.mysql.test
.PHONY: test-mysql\#%
test-mysql\#%: integrations.mysql.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./integrations.mysql.test -test.run $(subst .,/,$*)
.PHONY: test-mysql-migration
test-mysql-migration: migrations.mysql.test migrations.individual.mysql.test
generate-ini-pgsql:
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
-e 's|{{TEST_PGSQL_SCHEMA}}|${TEST_PGSQL_SCHEMA}|g' \
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
-e 's|{{TEST_TYPE}}|$(or $(TEST_TYPE),integration)|g' \
tests/pgsql.ini.tmpl > tests/pgsql.ini
.PHONY: test-pgsql
test-pgsql: integrations.pgsql.test generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./integrations.pgsql.test
.PHONY: test-pgsql\#%
test-pgsql\#%: integrations.pgsql.test generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./integrations.pgsql.test -test.run $(subst .,/,$*)
.PHONY: test-pgsql-migration
test-pgsql-migration: migrations.pgsql.test migrations.individual.pgsql.test
.PHONY: playwright
playwright: deps-frontend
npx playwright install $(PLAYWRIGHT_FLAGS)
.PHONY: test-e2e%
test-e2e%: TEST_TYPE ?= e2e
# Clear display env variable. Otherwise, chromium tests can fail.
DISPLAY=
.PHONY: test-e2e
test-e2e: test-e2e-sqlite
.PHONY: test-e2e-sqlite
test-e2e-sqlite: playwright e2e.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./e2e.sqlite.test -test.run TestE2e
.PHONY: test-e2e-sqlite\#%
test-e2e-sqlite\#%: playwright e2e.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./e2e.sqlite.test -test.run TestE2e/$*
2024-04-09 16:49:05 +02:00
.PHONY: test-e2e-sqlite-firefox\#%
test-e2e-sqlite-firefox\#%: playwright e2e.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini PLAYWRIGHT_PROJECT=firefox ./e2e.sqlite.test -test.run TestE2e/$*
.PHONY: test-e2e-mysql
test-e2e-mysql: playwright e2e.mysql.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./e2e.mysql.test -test.run TestE2e
.PHONY: test-e2e-mysql\#%
test-e2e-mysql\#%: playwright e2e.mysql.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./e2e.mysql.test -test.run TestE2e/$*
.PHONY: test-e2e-pgsql
test-e2e-pgsql: playwright e2e.pgsql.test generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./e2e.pgsql.test -test.run TestE2e
.PHONY: test-e2e-pgsql\#%
test-e2e-pgsql\#%: playwright e2e.pgsql.test generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./e2e.pgsql.test -test.run TestE2e/$*
.PHONY: test-e2e-debugserver
test-e2e-debugserver: e2e.sqlite.test generate-ini-sqlite
sed -i s/3003/3000/g tests/sqlite.ini
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./e2e.sqlite.test -test.run TestDebugserver -test.timeout 24h
.PHONY: bench-sqlite
bench-sqlite: integrations.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
.PHONY: bench-mysql
bench-mysql: integrations.mysql.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./integrations.mysql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
.PHONY: bench-pgsql
bench-pgsql: integrations.pgsql.test generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./integrations.pgsql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
.PHONY: integration-test-coverage
integration-test-coverage: integrations.cover.test generate-ini-mysql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
.PHONY: integration-test-coverage-sqlite
integration-test-coverage-sqlite: integrations.cover.sqlite.test generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./integrations.cover.sqlite.test -test.coverprofile=integration.coverage.out
2020-01-14 01:06:54 +01:00
integrations.mysql.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.mysql.test
2020-01-14 01:06:54 +01:00
integrations.pgsql.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.pgsql.test
2020-01-14 01:06:54 +01:00
integrations.sqlite.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.sqlite.test -tags '$(TEST_TAGS)'
integrations.cover.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -coverpkg $(shell echo $(GO_TEST_PACKAGES) | tr ' ' ',') -o integrations.cover.test
integrations.cover.sqlite.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -coverpkg $(shell echo $(GO_TEST_PACKAGES) | tr ' ' ',') -o integrations.cover.sqlite.test -tags '$(TEST_TAGS)'
.PHONY: migrations.mysql.test
migrations.mysql.test: $(GO_SOURCES) generate-ini-mysql
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.mysql.test
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./migrations.mysql.test
.PHONY: migrations.pgsql.test
migrations.pgsql.test: $(GO_SOURCES) generate-ini-pgsql
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.pgsql.test
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./migrations.pgsql.test
.PHONY: migrations.sqlite.test
migrations.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.sqlite.test -tags '$(TEST_TAGS)'
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini ./migrations.sqlite.test
.PHONY: migrations.individual.mysql.test
migrations.individual.mysql.test: $(GO_SOURCES)
for pkg in $(MIGRATION_PACKAGES); do \
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' $$pkg || exit 1; \
done
.PHONY: migrations.individual.sqlite.test\#%
migrations.individual.sqlite.test\#%: $(GO_SOURCES) generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*
.PHONY: migrations.individual.pgsql.test
migrations.individual.pgsql.test: $(GO_SOURCES)
for pkg in $(MIGRATION_PACKAGES); do \
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' $$pkg || exit 1;\
done
.PHONY: migrations.individual.pgsql.test\#%
migrations.individual.pgsql.test\#%: $(GO_SOURCES) generate-ini-pgsql
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*
.PHONY: migrations.individual.sqlite.test
migrations.individual.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
for pkg in $(MIGRATION_PACKAGES); do \
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' $$pkg || exit 1; \
done
.PHONY: migrations.individual.sqlite.test\#%
migrations.individual.sqlite.test\#%: $(GO_SOURCES) generate-ini-sqlite
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*
e2e.mysql.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.mysql.test
e2e.pgsql.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.pgsql.test
e2e.sqlite.test: $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.sqlite.test -tags '$(TEST_TAGS)'
.PHONY: check
check: test
###
# Production / build targets
###
.PHONY: install $(TAGS_PREREQ)
2016-11-24 14:38:37 +01:00
install: $(wildcard *.go)
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
.PHONY: build
build: frontend backend
.PHONY: frontend
frontend: $(WEBPACK_DEST)
.PHONY: backend
backend: go-check generate-backend $(EXECUTABLE)
# 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
.PHONY: generate-backend
generate-backend: $(TAGS_PREREQ) generate-go
.PHONY: generate-go
generate-go: $(TAGS_PREREQ)
@echo "Running go generate..."
Fix cross-compilation errors when CGO_CFLAGS/CGO_LDFLAGS is set (#30749) When you cross-compile Gitea and you specify one of the envrionment variables related to C flags, cgo will fail to build the generator programs (e.g. generate-bindata) because GOOS and GOARCH are unset, but those additional flags variables are not unset together with those. To solve this issue, the simplest way that I've found is to disable cgo in the `go generate` command as it's not really used there. For example, I've had this problem with cross-compiling Gitea on FreeBSD x86_64 to ARMv7 where it's necessary to pass `--target` to `clang` via `CGO_CFLAGS`: ``` GOOS=freebsd \ GOARCH=arm \ GGOARM=7 \ CGO_ENABLED=1 \ SYSROOT=/usr/local/freebsd-sysroot/armv7 \ CC=clang \ CGO_CFLAGS="--target=armv7-unknown-freebsd13.2-gnueabihf" \ TAGS="bindata sqlite sqlite_unlock_notify" \ make SHELL='sh -x' build ``` ``` Running go generate... # runtime/cgo In file included from gcc_freebsd_amd64.c:9: In file included from /usr/include/signal.h:42: /usr/include/sys/_ucontext.h:44:2: error: unknown type name 'mcontext_t' modules/migration/schemas_bindata.go:8: running "go": exit status 1 # runtime/cgo In file included from gcc_freebsd_amd64.c:9: In file included from /usr/include/signal.h:42: /usr/include/sys/_ucontext.h:44:2: error: unknown type name 'mcontext_t' modules/options/options_bindata.go:8: running "go": exit status 1 # runtime/cgo In file included from gcc_freebsd_amd64.c:9: In file included from /usr/include/signal.h:42: /usr/include/sys/_ucontext.h:44:2: error: unknown type name 'mcontext_t' modules/public/public_bindata.go:8: running "go": exit status 1 # runtime/cgo In file included from gcc_freebsd_amd64.c:9: In file included from /usr/include/signal.h:42: /usr/include/sys/_ucontext.h:44:2: error: unknown type name 'mcontext_t' modules/templates/templates_bindata.go:8: running "go": exit status 1 gmake[1]: *** [Makefile:781: generate-go] Error 1 *** Error code 2 Stop. ``` But with this fix Gitea compiles successfully. (cherry picked from commit d11133b83652238023b52576e0d3e57a4f4b21c9)
2024-04-29 05:45:53 +02:00
@CC= GOOS= GOARCH= CGO_ENABLED=0 $(GO) generate -tags '$(TAGS)' ./...
2016-07-25 20:48:17 +02:00
.PHONY: merge-locales
merge-locales:
@echo "NOT NEEDED: THIS IS A NOOP AS OF Forgejo 7.0 BUT KEPT FOR BACKWARD COMPATIBILITY"
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
[BRANDING] add forgejo target to Makefile The gitea target is kept as is, for the sake of compatibility with build systems that rely on it. The forgejo target creates a hard link with forgejo. (cherry picked from commit ce156c7cb4265e3d94ad41db26d6a5be9667200e) (cherry picked from commit b2cb23282534cfdf756fcce3e494be756841a9d1) (cherry picked from commit 85543c22bdd3cf268c77055f644dad42ff4f456e) (cherry picked from commit 302955a20d3130ef83458810ca6368c612c0a76f) (cherry picked from commit 4b1be0858ef652ad79c69c1d6331884408cbc2cb) (cherry picked from commit afed1a6e202386588738a7af08562b9073a5f992) (cherry picked from commit e81304bcd167c2ca838b2c89db47c44c59a48543) (cherry picked from commit 479cd51a038b7f98f576dda946595885327082f7) (cherry picked from commit 8baab7c0c1b826884b02649ec5ccf34d01f0e9d5) (cherry picked from commit 5d25ad9f092e9ee3066de6c002d1e3169aec884f) (cherry picked from commit f36942789feb73f48944e570dbf65a570a8dfb23) (cherry picked from commit 9abfbae8a0f9eafa762c002951494fbd520c6bd4) (cherry picked from commit 079e0efb011b761b1948623b26737d55ad2e6b36) (cherry picked from commit 0f1b83005ae8fe7f3f1fd91b1ec3daa19f5f3d47) (cherry picked from commit 3cc227aaff2a100be20697bc38adb3791410ad9a) (cherry picked from commit 245310c68280883057b1026b7a758f028ff4913e) (cherry picked from commit 3f83e30c93cc7f31c04a708e8aed7a7dfcedceb2) (cherry picked from commit e2bdd6af3d598b1f699034ba0684f1fa24ba3c7c) (cherry picked from commit fb3ac3a20bc227a511e0776e977119d995d05ed9) (cherry picked from commit 0ffbd4603293af14a200c5ef14eced48e4d14749) (cherry picked from commit 1ba9e954e26dea165967776ba80783fef0761cd3) (cherry picked from commit d4bc10d1e753cbcff6797ea07a4a3adbe552b96f) (cherry picked from commit e54dc7293e7c182229e7b1ac871f4d7cc3b3e334) (cherry picked from commit f50e5132d480c944d659aedf102695abcd326a25) (cherry picked from commit 335abddaa0fa825cde86d39e43db55d521c3dcab) (cherry picked from commit 61e80ffb1fa8c943874d480a8c2957add95b5639) (cherry picked from commit 48321672355de15dd9504016d364bd28884864da) (cherry picked from commit 1bbe7816b2b33eb45237dbfa54cb3f354754caa7)
2023-07-21 11:36:24 +02:00
forgejo: $(EXECUTABLE)
ln -f $(EXECUTABLE) forgejo
[CI] Forgejo Actions based release process Refs: https://codeberg.org/forgejo/website/pulls/230 (cherry picked from commit 87d56bf6c73d726dae8aafbc7e147969f1899931) [CI] Forgejo Actions based release process (squash) base64 -w0 to avoid wrapping when the doer name is long as it creates a broken config.json (cherry picked from commit 9efdc27e49bdfb3e62401baf27b224385f9f3e5e) [CI] Forgejo Actions based release process (squash) generate .xz files and sources Generate .xz files Check .sha256 Generate the source tarbal (cherry picked from commit 7afec520c4b1032d7e67a05a41e4e2913bcd9312) [CI] Forgejo Actions based release process (squash) release notes (cherry picked from commit d8f4f4807b28297b318d2f555a76d0efef762cf7) [CI] Forgejo Actions based release process (squash) publish and sign release (cherry picked from commit a52778c74785fe57cdee3b64b4c6c8a326471532) (cherry picked from commit cf2ec6274094ac7aebda71d54c64581f528df00a) [CI] Forgejo Actions based release process (squash) version use Actions environment variables in Makefile (#25319) (#25318) uses Actions variable to determine the version. But Forgejo builds happen in a container where they are not available. Do not use them. Also verify the version of the binary is as expected for sanity check. (cherry picked from commit 6decf111a132a869f9e5c6f4d20e368b8f74309f) (cherry picked from commit 206d0b3886b2d56b585bf552e53d952b35f07284) [CI] read STORED_VERSION_FILE if available (cherry picked from commit af74085ebf51c91a51db865a66667fca511838d5) [CI] backward compatible executable compilation Add a new static-executable target to use in Dockerfiles and restore the $(EXECUTABLE) target to what it was before to for backward compatibility. The release process now builds static executables instead of dynamically linked ones which makes them more portable. It changes the requirements at compile time and is not backward compatible. In particular it may break packaging that rely on the target that currently creates a dynamically linked executable. (cherry picked from commit 84d02a174a4398b1f8ee62e08db5483a9859650f) (cherry picked from commit 854be47328cc0283119dfb78f9ba0b8306c85f75) [CI] Forgejo Actions based release process (squash) doc / ca / verbosity - Document workflow - Increase verbosity if VERBOSE=true - Download the Certificate Authority if behind the VPN (cherry picked from commit 168d5d586904835762d213b2b8815b458a38c78f) (cherry picked from commit 8756c9a72a40830441124256b7382f900a1052f8) (cherry picked from commit 2dad7ef20f3bf9ebe2425e2e28b66a4ca21c6786) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commit 5531d01f1981df665f5b8f642e9241e8ea4f4578) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal bindata.go is a file, not a directory Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commit bd88a4477817be34ea86ebb2f460b9fe8ab5f1b7) (cherry picked from commit b408085138c578dfaacafbd4b7719ca926456855) [CI] Forgejo Actions based release process (squash) public/assets moved (cherry picked from commit d8c921d5a643ed05f2935348531996fe4d08c654) (cherry picked from commit f29e50b1a09b1a22fc2dbdb77e9a1def1196175b) [CI] Fix release notes link - Use substitution to replace all dots with dashes. - Resolves https://codeberg.org/forgejo/forgejo/issues/1163 (cherry picked from commit 96783728f53a072915cace392aa269adfe9a5c73) (cherry picked from commit c8d8bf8996beb650cd86cafb110e85e1e05917a0) [CI] pin go v1.20 for testing Refs: https://codeberg.org/forgejo/forgejo/issues/1228 (cherry picked from commit fd4b5a013ee0f31453b623d12001a8b810cd7ebc) (cherry picked from commit 00bb15f57f2ae5a11abc8b044ed99dc949e812a7) Conflicts: Dockerfile Dockerfile.rootless see https://codeberg.org/forgejo/forgejo/pulls/1303 (cherry picked from commit 6e2be54a6d95412ce770d4bab1a39c77591f44dc) (cherry picked from commit 346c418b4a8c0e1f8c9aace44b00373a4bf76732) (cherry picked from commit 49061f8422cb6aa9ddc14edb507f50477624eb7a) (cherry picked from commit 8229d59b7e1ba61959de6ecd95d9dd49bc2436dc) (cherry picked from commit 70d45d919309d8127551c8ad44538a730b795638) [CI] Forgejo Actions based release process (squash) need node 18 (cherry picked from commit 722b1f45902ecca3179a92700a2f5c1080422a04) (cherry picked from commit a91d786169fb4694aed4af68792437a0a67de3fa) [CI] Forgejo Actions based release process (squash) fix indentation (cherry picked from commit fbdf9d6abb88fd5def3d0ced488a4dd72655d433) (cherry picked from commit 2deff90a13397339796ac5a94d63b0d8cd9760a9) (cherry picked from commit 5710a27fda58093f0db1605585e730c314b933f5) [CI] Forgejo Actions based release process (squash) FQIN for docker Refs: https://codeberg.org/forgejo/forgejo/issues/1600 (cherry picked from commit f63d38deb6a9933ce996a61a099f4b79e9171581) [CI] Forgejo Actions based release process (squash) use forgejo-curl.sh (cherry picked from commit c0c3ef506fa500cb9626034c5e00913b3c31e08c) (cherry picked from commit 933ca7ec5dcab55c8593dee4a6cd13281502c41e) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/1691 (cherry picked from commit 1068e48805de9d7464b41f32e1c5567d3747239a) [CI] Forgejo Actions based release process (squash) size optimization (cherry picked from commit 3c653ff7428dbf898a5131b5c817ce3b13ec0591) (cherry picked from commit 398567fc0cf9edd0be49541339800af985e8b1b6) (cherry picked from commit e585db9a970e7a84eaff06758a094a297ae6fc48) (cherry picked from commit 17e91c96e3259b0d8fa87294470339779d62aa71) [CI] Forgejo Actions based release process (squash) gitea to forgejo (cherry picked from commit 9c06a318b867ea8c60dd194ca393bac3b718b07b) (cherry picked from commit 95859da3b40306c1e07277230c2f401ef8b82a13) (cherry picked from commit e3a5f6c1ed4e5452f3664aa8d398805c3b9c0a51) (cherry picked from commit 7b9b259c75e0b2b805a2239ecf7c85a3f0dbd648) (cherry picked from commit c4a152c8dc4ab5d20c72f9f7d60ce6eee3be5cda) (cherry picked from commit b00bf599efa97a18adac134a1402418785c5bae2) (cherry picked from commit a7836ee2ee2638091f0f9ff5543548ae0bb94060) (cherry picked from commit 3ea7dcbd5b196b6fc9115d49d50678a1a5940c0b) (cherry picked from commit 454d705e830ade3a41a33341b82d4c8aff584dcd) (cherry picked from commit 35e06c3009f4a1942222dc35cc0993a623164b25) (cherry picked from commit 904468a38ffdfb8157dc4eaf92b3ba10c3a957db) (cherry picked from commit 890e86815a5a33b2930150a7460cd96b4360ac88) (cherry picked from commit bf9f94c63d8c15ce62881ccadc28681848b7ebd7) (cherry picked from commit d025d061d14929aaabbfc4603099e32cb888ac3b) (cherry picked from commit 32f209a8e1b2ee109f7ae8b150d4390318c0ff2a) (cherry picked from commit 38ef6802fca7301f4cb03769e8d6dae1e256933f) (cherry picked from commit 8a19bbd2a8160b7d3d5a1ea083507b4311070ab6) (cherry picked from commit f352dee786d2541fbe360fe8f859d3182c632240) (cherry picked from commit b53d9fc090b58848876b4f97e8ed03face85a63b) (cherry picked from commit 3dae21f4c87c82b75515d3db43c1bbd4d9f3f1ac) (cherry picked from commit 8b59e016c7a1eb3f6d0077d8e6f205b8bcefe402) (cherry picked from commit 6f54ea6a0eb0f9c4360237f78eb76c55678547e2) (cherry picked from commit ed8d90de6bb9513a2dcdc70aac446bbcaf0855c9) (cherry picked from commit 26ffd3fcace55279091fe95074a65dd1c4b7758a) (cherry picked from commit 287b3bbfb5a66e64d3490a282153bfd2393b7afa) (cherry picked from commit ab81378d0c88def332f43843eeac23ef768bb143) (cherry picked from commit f6bbe7e875e707fcbadf7434818edb897467a5ef) (cherry picked from commit 8968f34edf064e6bffc3cc7054307c6303256acd) (cherry picked from commit d3d914bba2bec4f50f9d71d347b510771df99656) (cherry picked from commit 4e4006a990dd22c23ffd6e9b7e3af6aac1855d52) (cherry picked from commit edb333569b38e38f94dbb769d793b53cdf39b96f) (cherry picked from commit 6c1a4baa15aebd1b27b742097181b1ca4afbd31c) (cherry picked from commit 51bda3bfc734eccee198d4ccb377520d7f16ccb3) (cherry picked from commit 6f5f318b8f1f9086ef981c181a97ebbcbe6e11be) (cherry picked from commit e128da23624c90f2817ccb3f15c5df9704f2c597) (cherry picked from commit 3e6735ff23ae6c6a6963629cf4bc5d8acd26f905) (cherry picked from commit 938c4441259e0ef1714d6e411bd49df15f048103) (cherry picked from commit 67f92dc9ab4ae8263c2f69e6729b3f1198943401) (cherry picked from commit ee31df71fb70c2938fcf82b5c9a518a54bd4c078) (cherry picked from commit 386f232191561867c7888ec94374f8f9505c4ff9) (cherry picked from commit 745785cd7f90cf2665f11fb9bed960a16e238fa4) (cherry picked from commit efa8564e762b5369a77a10422bd1f6dd1433c62b) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/2029 (cherry picked from commit f3dfb143216501411f2e2f522bcce64debfdc07d) (cherry picked from commit 5a0346ee95f2f30e8955ad886500e9f1c6508c18) (cherry picked from commit 7a2a6517f2a09cec7bba873696724455134b5734) (cherry picked from commit 87dcc87da9e20977a7e2c2104312a23c9d5dacb4) (cherry picked from commit df4099247f63d36e259642c0c84c3620ac3a93b0) (cherry picked from commit df23f83545a47fb058d321df760bb346a445679a)
2023-06-14 13:32:20 +02:00
static-executable: $(GO_SOURCES) $(TAGS_PREREQ)
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags 'netgo osusergo $(TAGS)' -ldflags '-s -w -linkmode external -extldflags "-static" $(LDFLAGS)' -o $(EXECUTABLE)
.PHONY: release
[CI] Makefile: release: only supported platforms (cherry picked from commit 16381262c5231f5dddf94d3dac7274366f4ca991) (cherry picked from commit c93f41dcef679f35cb51f93b34b21cfd202ed68a) (cherry picked from commit cf17c69487cd5ad9e5338d6dadd49c208d604ca1) (cherry picked from commit 174b8cf3275cfb4efd483b04ad6cb6eaca069030) (cherry picked from commit ae1b8dd441b9902b098620dbbf4e88592460f91e) (cherry picked from commit 1b56d9049f2954b852fea1ae6e0c52076fdb4a0c) (cherry picked from commit 6b00196175db59d2c6b71a8aa01308265c92f26c) (cherry picked from commit 087b38c3f381cd589ccc708df102cf1594c09912) (cherry picked from commit 70fcc63816e57f277293b10a23777c4ad796e212) (cherry picked from commit 81e2f27426ec91c0a9ab7dd6f0eed11e360beb56) (cherry picked from commit 9741a9960b6bef27e36e679764cfa63b5cb7066b) (cherry picked from commit 0625fc7ad86344ab45d50a85ee68391994f2ca07) (cherry picked from commit e7758aaa94471aecc08071400a1dbeaa1adc71be) (cherry picked from commit be254326876508aa6c333cd22cd25a0198d2f5cd) (cherry picked from commit 64c6d2f26327883af5b61e5436d38070de61f2fa) (cherry picked from commit 3445ae53e3bbda1db229ae849b893657fb6ec268) (cherry picked from commit 3e359ef3cde62848bcc7f12b792baf731359ea10) (cherry picked from commit 3c44026cc5169bd728d1f60dd3b37ffdb6adecf0) (cherry picked from commit 9528250188f6a50bfc728174e491cdbb6859029d) (cherry picked from commit 840a307a2541d2747a5fa7371febf07600463547) (cherry picked from commit 1c486047ac2f9fab513d5df46f5f80765b6b1200) (cherry picked from commit 7e6ccb52ff5159e39bc4d9d4bbd9b432a77e8703) (cherry picked from commit 7a1b3fef59301d19c60122d10deca3b3154d188e)
2023-08-22 08:20:19 +02:00
release: frontend generate release-linux release-copy release-compress vendor release-sources release-check
[CI] Forgejo Actions based release process Refs: https://codeberg.org/forgejo/website/pulls/230 (cherry picked from commit 87d56bf6c73d726dae8aafbc7e147969f1899931) [CI] Forgejo Actions based release process (squash) base64 -w0 to avoid wrapping when the doer name is long as it creates a broken config.json (cherry picked from commit 9efdc27e49bdfb3e62401baf27b224385f9f3e5e) [CI] Forgejo Actions based release process (squash) generate .xz files and sources Generate .xz files Check .sha256 Generate the source tarbal (cherry picked from commit 7afec520c4b1032d7e67a05a41e4e2913bcd9312) [CI] Forgejo Actions based release process (squash) release notes (cherry picked from commit d8f4f4807b28297b318d2f555a76d0efef762cf7) [CI] Forgejo Actions based release process (squash) publish and sign release (cherry picked from commit a52778c74785fe57cdee3b64b4c6c8a326471532) (cherry picked from commit cf2ec6274094ac7aebda71d54c64581f528df00a) [CI] Forgejo Actions based release process (squash) version use Actions environment variables in Makefile (#25319) (#25318) uses Actions variable to determine the version. But Forgejo builds happen in a container where they are not available. Do not use them. Also verify the version of the binary is as expected for sanity check. (cherry picked from commit 6decf111a132a869f9e5c6f4d20e368b8f74309f) (cherry picked from commit 206d0b3886b2d56b585bf552e53d952b35f07284) [CI] read STORED_VERSION_FILE if available (cherry picked from commit af74085ebf51c91a51db865a66667fca511838d5) [CI] backward compatible executable compilation Add a new static-executable target to use in Dockerfiles and restore the $(EXECUTABLE) target to what it was before to for backward compatibility. The release process now builds static executables instead of dynamically linked ones which makes them more portable. It changes the requirements at compile time and is not backward compatible. In particular it may break packaging that rely on the target that currently creates a dynamically linked executable. (cherry picked from commit 84d02a174a4398b1f8ee62e08db5483a9859650f) (cherry picked from commit 854be47328cc0283119dfb78f9ba0b8306c85f75) [CI] Forgejo Actions based release process (squash) doc / ca / verbosity - Document workflow - Increase verbosity if VERBOSE=true - Download the Certificate Authority if behind the VPN (cherry picked from commit 168d5d586904835762d213b2b8815b458a38c78f) (cherry picked from commit 8756c9a72a40830441124256b7382f900a1052f8) (cherry picked from commit 2dad7ef20f3bf9ebe2425e2e28b66a4ca21c6786) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commit 5531d01f1981df665f5b8f642e9241e8ea4f4578) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal bindata.go is a file, not a directory Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commit bd88a4477817be34ea86ebb2f460b9fe8ab5f1b7) (cherry picked from commit b408085138c578dfaacafbd4b7719ca926456855) [CI] Forgejo Actions based release process (squash) public/assets moved (cherry picked from commit d8c921d5a643ed05f2935348531996fe4d08c654) (cherry picked from commit f29e50b1a09b1a22fc2dbdb77e9a1def1196175b) [CI] Fix release notes link - Use substitution to replace all dots with dashes. - Resolves https://codeberg.org/forgejo/forgejo/issues/1163 (cherry picked from commit 96783728f53a072915cace392aa269adfe9a5c73) (cherry picked from commit c8d8bf8996beb650cd86cafb110e85e1e05917a0) [CI] pin go v1.20 for testing Refs: https://codeberg.org/forgejo/forgejo/issues/1228 (cherry picked from commit fd4b5a013ee0f31453b623d12001a8b810cd7ebc) (cherry picked from commit 00bb15f57f2ae5a11abc8b044ed99dc949e812a7) Conflicts: Dockerfile Dockerfile.rootless see https://codeberg.org/forgejo/forgejo/pulls/1303 (cherry picked from commit 6e2be54a6d95412ce770d4bab1a39c77591f44dc) (cherry picked from commit 346c418b4a8c0e1f8c9aace44b00373a4bf76732) (cherry picked from commit 49061f8422cb6aa9ddc14edb507f50477624eb7a) (cherry picked from commit 8229d59b7e1ba61959de6ecd95d9dd49bc2436dc) (cherry picked from commit 70d45d919309d8127551c8ad44538a730b795638) [CI] Forgejo Actions based release process (squash) need node 18 (cherry picked from commit 722b1f45902ecca3179a92700a2f5c1080422a04) (cherry picked from commit a91d786169fb4694aed4af68792437a0a67de3fa) [CI] Forgejo Actions based release process (squash) fix indentation (cherry picked from commit fbdf9d6abb88fd5def3d0ced488a4dd72655d433) (cherry picked from commit 2deff90a13397339796ac5a94d63b0d8cd9760a9) (cherry picked from commit 5710a27fda58093f0db1605585e730c314b933f5) [CI] Forgejo Actions based release process (squash) FQIN for docker Refs: https://codeberg.org/forgejo/forgejo/issues/1600 (cherry picked from commit f63d38deb6a9933ce996a61a099f4b79e9171581) [CI] Forgejo Actions based release process (squash) use forgejo-curl.sh (cherry picked from commit c0c3ef506fa500cb9626034c5e00913b3c31e08c) (cherry picked from commit 933ca7ec5dcab55c8593dee4a6cd13281502c41e) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/1691 (cherry picked from commit 1068e48805de9d7464b41f32e1c5567d3747239a) [CI] Forgejo Actions based release process (squash) size optimization (cherry picked from commit 3c653ff7428dbf898a5131b5c817ce3b13ec0591) (cherry picked from commit 398567fc0cf9edd0be49541339800af985e8b1b6) (cherry picked from commit e585db9a970e7a84eaff06758a094a297ae6fc48) (cherry picked from commit 17e91c96e3259b0d8fa87294470339779d62aa71) [CI] Forgejo Actions based release process (squash) gitea to forgejo (cherry picked from commit 9c06a318b867ea8c60dd194ca393bac3b718b07b) (cherry picked from commit 95859da3b40306c1e07277230c2f401ef8b82a13) (cherry picked from commit e3a5f6c1ed4e5452f3664aa8d398805c3b9c0a51) (cherry picked from commit 7b9b259c75e0b2b805a2239ecf7c85a3f0dbd648) (cherry picked from commit c4a152c8dc4ab5d20c72f9f7d60ce6eee3be5cda) (cherry picked from commit b00bf599efa97a18adac134a1402418785c5bae2) (cherry picked from commit a7836ee2ee2638091f0f9ff5543548ae0bb94060) (cherry picked from commit 3ea7dcbd5b196b6fc9115d49d50678a1a5940c0b) (cherry picked from commit 454d705e830ade3a41a33341b82d4c8aff584dcd) (cherry picked from commit 35e06c3009f4a1942222dc35cc0993a623164b25) (cherry picked from commit 904468a38ffdfb8157dc4eaf92b3ba10c3a957db) (cherry picked from commit 890e86815a5a33b2930150a7460cd96b4360ac88) (cherry picked from commit bf9f94c63d8c15ce62881ccadc28681848b7ebd7) (cherry picked from commit d025d061d14929aaabbfc4603099e32cb888ac3b) (cherry picked from commit 32f209a8e1b2ee109f7ae8b150d4390318c0ff2a) (cherry picked from commit 38ef6802fca7301f4cb03769e8d6dae1e256933f) (cherry picked from commit 8a19bbd2a8160b7d3d5a1ea083507b4311070ab6) (cherry picked from commit f352dee786d2541fbe360fe8f859d3182c632240) (cherry picked from commit b53d9fc090b58848876b4f97e8ed03face85a63b) (cherry picked from commit 3dae21f4c87c82b75515d3db43c1bbd4d9f3f1ac) (cherry picked from commit 8b59e016c7a1eb3f6d0077d8e6f205b8bcefe402) (cherry picked from commit 6f54ea6a0eb0f9c4360237f78eb76c55678547e2) (cherry picked from commit ed8d90de6bb9513a2dcdc70aac446bbcaf0855c9) (cherry picked from commit 26ffd3fcace55279091fe95074a65dd1c4b7758a) (cherry picked from commit 287b3bbfb5a66e64d3490a282153bfd2393b7afa) (cherry picked from commit ab81378d0c88def332f43843eeac23ef768bb143) (cherry picked from commit f6bbe7e875e707fcbadf7434818edb897467a5ef) (cherry picked from commit 8968f34edf064e6bffc3cc7054307c6303256acd) (cherry picked from commit d3d914bba2bec4f50f9d71d347b510771df99656) (cherry picked from commit 4e4006a990dd22c23ffd6e9b7e3af6aac1855d52) (cherry picked from commit edb333569b38e38f94dbb769d793b53cdf39b96f) (cherry picked from commit 6c1a4baa15aebd1b27b742097181b1ca4afbd31c) (cherry picked from commit 51bda3bfc734eccee198d4ccb377520d7f16ccb3) (cherry picked from commit 6f5f318b8f1f9086ef981c181a97ebbcbe6e11be) (cherry picked from commit e128da23624c90f2817ccb3f15c5df9704f2c597) (cherry picked from commit 3e6735ff23ae6c6a6963629cf4bc5d8acd26f905) (cherry picked from commit 938c4441259e0ef1714d6e411bd49df15f048103) (cherry picked from commit 67f92dc9ab4ae8263c2f69e6729b3f1198943401) (cherry picked from commit ee31df71fb70c2938fcf82b5c9a518a54bd4c078) (cherry picked from commit 386f232191561867c7888ec94374f8f9505c4ff9) (cherry picked from commit 745785cd7f90cf2665f11fb9bed960a16e238fa4) (cherry picked from commit efa8564e762b5369a77a10422bd1f6dd1433c62b) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/2029 (cherry picked from commit f3dfb143216501411f2e2f522bcce64debfdc07d) (cherry picked from commit 5a0346ee95f2f30e8955ad886500e9f1c6508c18) (cherry picked from commit 7a2a6517f2a09cec7bba873696724455134b5734) (cherry picked from commit 87dcc87da9e20977a7e2c2104312a23c9d5dacb4) (cherry picked from commit df4099247f63d36e259642c0c84c3620ac3a93b0) (cherry picked from commit df23f83545a47fb058d321df760bb346a445679a)
2023-06-14 13:32:20 +02:00
# just the sources, with all assets builtin and frontend resources generated
sources-tarbal: frontend generate vendor release-sources release-check
$(DIST_DIRS):
mkdir -p $(DIST_DIRS)
2015-11-03 18:16:43 +01:00
.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 '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
.PHONY: release-linux
release-linux: | $(DIST_DIRS)
[CI] implementation: publish forgejo- binaries instead of gitea- (cherry picked from commit 6d910daafb28b79402b8190fa749f4ff18991505) (cherry picked from commit d447861cc911aa89539cbbcdbbf0e68d0bc23e53) (cherry picked from commit dc6e9d87990f72d870100934be32a5fc1dc119ad) (cherry picked from commit ef232fa20c99c6c52599025967a5af2f5839bdce) (cherry picked from commit 290c55517a84f6e8b80459372b9b63ec19cadcb4) (cherry picked from commit db48af1784e94851c066845324c3e680e79ab7c3) (cherry picked from commit 85f33237a2f5da88ec2fcab76ea91ee3cec56065) (cherry picked from commit 76899ee33e8196c66f882fca5facf5268c8fabf8) (cherry picked from commit 148b3ee9cb03aa614b59ab98d2d8c11f343d38d1) (cherry picked from commit 1f6ad8f465819cc6adb8061845822398a33e14e1) (cherry picked from commit c330afdba3354ff59591bd07046b6993bfeea777) (cherry picked from commit b1f87075a79c8e0d1a8626958f90bfee4d003de1) (cherry picked from commit 7da40992cc82d719094a748339c385fbc1251afe) (cherry picked from commit 7ab19ff5e528b9e1ef53e95639022facca70466e) (cherry picked from commit e61e44921bbabc7ba12da51afde1c6fe8203679b) (cherry picked from commit 83646119fb8af975a114601ee7bbaf7c5d25f93f) (cherry picked from commit 20cf748e61f35378745629dcb38b459818c8ad52) (cherry picked from commit 0a99919cec90dc1374c67199a0bbb90e7f8c7525) (cherry picked from commit 21215222a6d036551dca0b54a09c388845c3565f) (cherry picked from commit 0f6c5658d77fe47d4c67b327190f88af829905da) (cherry picked from commit 1752e43d3c0d71533680d2dcbcbb056d0c91371e) (cherry picked from commit 2332080929c9eb65d512956773bf7ac821fa6736) (cherry picked from commit 590aabf2a2a47f4a5a53a9d0b8b12486f5998400) (cherry picked from commit 87d8b7b315c3e25bd3fcf9dc9c1d359bcd107281) (cherry picked from commit ff37de38be04b8c1ca6f04b4ef5566c9f9a125ad) (cherry picked from commit cee32c9e7ab58af6cb07109df4b88420c30c6156) (cherry picked from commit 39faade524215d5527c5d24e90a9be62aa40f422) (cherry picked from commit 0e5ca477b6e7ae926cd32454a6ed372b83626b34) (cherry picked from commit 70e2730f7b2efe4c2ee9ef047583bf9ee5eed409) (cherry picked from commit 2ad4003944e0d32d1e45b9276316e189f9b5b176) (cherry picked from commit 2429de9e87e3fdbfa2df8741c9400e9f056ef124) (cherry picked from commit c133915fc1a4eb8aa1e4766e720e47de14db0d61) (cherry picked from commit c607dcaf9f01e454921e07b758bdde1c4dba5504) (cherry picked from commit 00f006637f659bd617d05d1017be7bd4b78e618b) (cherry picked from commit 0de6646475195e0cf210781c98b8fcede010b94d) (cherry picked from commit b05e83bb1e45e67d96f0b4b138ffe2df8329e01d) (cherry picked from commit cb71f139f081c14d17ee904931ab64ccd2199c20) (cherry picked from commit 2a8b08ee4fdbceb5b8196a89c017405546ec0f79) (cherry picked from commit 3ebab73c4eee7b43ab0a30ad1f32c23ac969cbac) (cherry picked from commit 07626c088c2e9927bf200803178530be515831e8) (cherry picked from commit 844e9bc9999f2b94e2fc0f727dec06d128042b8e) (cherry picked from commit c315e247514fee9b2fcd3a91e16237b8986b78f0) (cherry picked from commit f5f2b41f3cdfc6258191859a7c1914b52b868c09) (cherry picked from commit 09134424a8c3c5136373c7760cf3d3dd26382610) (cherry picked from commit 6fc63d48c4b2a568ddafb92d566e607977cc1b1b) (cherry picked from commit a0be5c783e145601ca80eadfff7e104c980d1f32) (cherry picked from commit 124bad8230535626187165341c369668bb71c4f2) (cherry picked from commit 57069811d1d4d89bee498d8cbd9e23e212e48b7b) (cherry picked from commit 8871d1aac7fa64a97fbc740f548151e239257de5)
2022-11-19 11:41:18 +01:00
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out forgejo-$(VERSION) .
ifeq ($(CI),true)
cp /build/* $(DIST)/binaries
endif
.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 '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
2015-11-03 18:16:43 +01:00
.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 '$(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
[CI] implementation: publish forgejo- binaries instead of gitea- (cherry picked from commit 6d910daafb28b79402b8190fa749f4ff18991505) (cherry picked from commit d447861cc911aa89539cbbcdbbf0e68d0bc23e53) (cherry picked from commit dc6e9d87990f72d870100934be32a5fc1dc119ad) (cherry picked from commit ef232fa20c99c6c52599025967a5af2f5839bdce) (cherry picked from commit 290c55517a84f6e8b80459372b9b63ec19cadcb4) (cherry picked from commit db48af1784e94851c066845324c3e680e79ab7c3) (cherry picked from commit 85f33237a2f5da88ec2fcab76ea91ee3cec56065) (cherry picked from commit 76899ee33e8196c66f882fca5facf5268c8fabf8) (cherry picked from commit 148b3ee9cb03aa614b59ab98d2d8c11f343d38d1) (cherry picked from commit 1f6ad8f465819cc6adb8061845822398a33e14e1) (cherry picked from commit c330afdba3354ff59591bd07046b6993bfeea777) (cherry picked from commit b1f87075a79c8e0d1a8626958f90bfee4d003de1) (cherry picked from commit 7da40992cc82d719094a748339c385fbc1251afe) (cherry picked from commit 7ab19ff5e528b9e1ef53e95639022facca70466e) (cherry picked from commit e61e44921bbabc7ba12da51afde1c6fe8203679b) (cherry picked from commit 83646119fb8af975a114601ee7bbaf7c5d25f93f) (cherry picked from commit 20cf748e61f35378745629dcb38b459818c8ad52) (cherry picked from commit 0a99919cec90dc1374c67199a0bbb90e7f8c7525) (cherry picked from commit 21215222a6d036551dca0b54a09c388845c3565f) (cherry picked from commit 0f6c5658d77fe47d4c67b327190f88af829905da) (cherry picked from commit 1752e43d3c0d71533680d2dcbcbb056d0c91371e) (cherry picked from commit 2332080929c9eb65d512956773bf7ac821fa6736) (cherry picked from commit 590aabf2a2a47f4a5a53a9d0b8b12486f5998400) (cherry picked from commit 87d8b7b315c3e25bd3fcf9dc9c1d359bcd107281) (cherry picked from commit ff37de38be04b8c1ca6f04b4ef5566c9f9a125ad) (cherry picked from commit cee32c9e7ab58af6cb07109df4b88420c30c6156) (cherry picked from commit 39faade524215d5527c5d24e90a9be62aa40f422) (cherry picked from commit 0e5ca477b6e7ae926cd32454a6ed372b83626b34) (cherry picked from commit 70e2730f7b2efe4c2ee9ef047583bf9ee5eed409) (cherry picked from commit 2ad4003944e0d32d1e45b9276316e189f9b5b176) (cherry picked from commit 2429de9e87e3fdbfa2df8741c9400e9f056ef124) (cherry picked from commit c133915fc1a4eb8aa1e4766e720e47de14db0d61) (cherry picked from commit c607dcaf9f01e454921e07b758bdde1c4dba5504) (cherry picked from commit 00f006637f659bd617d05d1017be7bd4b78e618b) (cherry picked from commit 0de6646475195e0cf210781c98b8fcede010b94d) (cherry picked from commit b05e83bb1e45e67d96f0b4b138ffe2df8329e01d) (cherry picked from commit cb71f139f081c14d17ee904931ab64ccd2199c20) (cherry picked from commit 2a8b08ee4fdbceb5b8196a89c017405546ec0f79) (cherry picked from commit 3ebab73c4eee7b43ab0a30ad1f32c23ac969cbac) (cherry picked from commit 07626c088c2e9927bf200803178530be515831e8) (cherry picked from commit 844e9bc9999f2b94e2fc0f727dec06d128042b8e) (cherry picked from commit c315e247514fee9b2fcd3a91e16237b8986b78f0) (cherry picked from commit f5f2b41f3cdfc6258191859a7c1914b52b868c09) (cherry picked from commit 09134424a8c3c5136373c7760cf3d3dd26382610) (cherry picked from commit 6fc63d48c4b2a568ddafb92d566e607977cc1b1b) (cherry picked from commit a0be5c783e145601ca80eadfff7e104c980d1f32) (cherry picked from commit 124bad8230535626187165341c369668bb71c4f2) (cherry picked from commit 57069811d1d4d89bee498d8cbd9e23e212e48b7b) (cherry picked from commit 8871d1aac7fa64a97fbc740f548151e239257de5)
2022-11-19 11:41:18 +01:00
$(eval TRANSFORM := $(shell tar --help | grep -q bsdtar && echo "-s '/^./forgejo-src-$(VERSION)/'" || echo "--transform 's|^./|forgejo-src-$(VERSION)/|'"))
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) $(TRANSFORM) -czf $(DIST)/release/forgejo-src-$(VERSION).tar.gz .
rm -f $(STORED_VERSION_FILE)
.PHONY: release-docs
release-docs: | $(DIST_DIRS) docs
tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs .
[CHORE] Support reproducible builds This is a step towards making Forgejo's binaries (the one listed in the release tab) reproducible. In order to make the actual binary reproducible, we have to ensure that the release workflow has the correct configuration to produce such reproducible binaries. The release workflow currently uses the Dockerfile to produce binaries, as this is one of the easiest ways to do cross-compiling for Go binaries with CGO enabled (due to SQLite). In the Dockerfile, two new arguments are being given to the build command. `-trimpath` ensures that the workpath directory doesn't get included in the binary; this means that file names (such as for panics) are relative (to the workpath) and not absolute, which shouldn't impact debugging. `-buildid=` is added to the linker flag; it sets the BuildID of the Go linker to be empty; the `-buildid` hashes the input actions and output content; these vary from build to build for unknown reasons, but likely because of the involvement of temporary file names, this doesn't have any effect on the behavior of the resulting binary. The Makefile receives a new command, `reproduce-build#$VERSION` which can be used by people to produce a reproducible Forgejo binary of a particular release; it roughly does what the release workflow also does. Build the Dockerfile and extract the Forgejo binary from it. This doesn't allow to produce a reproducible version for every release, only for those that include this patch, as it needs to call the makefile of that version in order to make a reproducible binary. There's one thing left to do: the Dockerfile pins the Go version to a minor level and not to a patch level. This means that if a new Go patch version is released, that will be used instead and will result in a different binary that isn't bit to bit the same as the one that Forgejo has released.
2024-08-15 20:53:47 +02:00
.PHONY: reproduce-build
reproduce-build:
# Start building the Dockerfile with the RELEASE_VERSION tag set. GOPROXY is set
# for convience, because the default of the Dockerfile is `direct` which can be
# quite slow.
@docker build --build-arg="RELEASE_VERSION=$(RELEASE_VERSION)" --build-arg="GOPROXY=$(shell $(GO) env GOPROXY)" --tag "forgejo-reproducibility" .
@id=$$(docker create forgejo-reproducibility); \
docker cp $$id:/app/gitea/gitea ./forgejo; \
docker rm -v $$id; \
docker image rm forgejo-reproducibility:latest
.PHONY: reproduce-build\#%
reproduce-build\#%:
@git switch -d "$*"
# All the current variables are based on information before the git checkout happened.
# Call the makefile again, so these variables are correct and can be used for building
# a reproducible binary. Always execute git switch -, to go back to the previous branch.
@make reproduce-build; \
(code=$$?; git switch -; exit $${code})
###
# Dependency management
###
.PHONY: deps
deps: deps-frontend deps-backend deps-tools deps-py
.PHONY: deps-py
deps-py: .venv
.PHONY: deps-frontend
deps-frontend: node_modules
.PHONY: deps-backend
deps-backend:
$(GO) mod download
Split CI pipelines (#23385) - This PR attempts to split our various DB tests into separate pipelines. - It splits up some of the extra feature-related tests rather than having most of them in the MySQL test. - It disables the race detector for some of the pipelines as well, as it can cause slower runs and is mostly redundant when the pipelines just swap DBs. - It builds without SQLite support for any of the non-SQLite pipelines. - It moves the e2e test to using SQLite rather than PG (partially because I moved the minio tests to PG and that mucked up the test config, and partially because it avoids another running service) - It splits up the `go mod download` task in the Makefile from the tool installation, as the tools are only needed in the compliance pipeline. (Arguably even some of the tools aren't needed there, but that could be a follow-up PR) - SQLite is now the only arm64 pipeline, moving PG back to amd64 which can leverage autoscaler Should resolve #22010 - one thing that wasn't changed here but is mentioned in that issue, unit tests are needed in the same pipeline as an integration test in order to form a complete coverage report (at least as far as I could tell), so for now it remains in a pipeline with a DB integration test. Please let me know if I've inadvertently changed something that was how it was on purpose. --- I will say sometimes it's hard to pin down the average time, as a pipeline could be waiting for a runner for X minutes and that brings the total up by X minutes as well, but overall this does seem to be faster on average. --------- Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-03-10 07:13:17 +01:00
.PHONY: deps-tools
deps-tools:
$(GO) install $(AIR_PACKAGE)
$(GO) install $(EDITORCONFIG_CHECKER_PACKAGE)
$(GO) install $(GOFUMPT_PACKAGE)
$(GO) install $(GOLANGCI_LINT_PACKAGE)
$(GO) install $(GXZ_PACKAGE)
$(GO) install $(MISSPELL_PACKAGE)
$(GO) install $(SWAGGER_PACKAGE)
$(GO) install $(XGO_PACKAGE)
$(GO) install $(GO_LICENSES_PACKAGE)
$(GO) install $(GOVULNCHECK_PACKAGE)
refactor: redis queue backend test cleanup Summary: - Move existing test under a `testify` Suite as `baseRedisWithServerTestSuite` - Those tests require real redis server. - Add `go.uber.org/mock/mockgen@latest` as dependency - as a tool (Makefile). - in the `go.mod` file. - Mock redis client lives under a `mock` directory under the queue module. - That mock module has an extra hand-written mock in-memory redis-like struct. - Add tests using the mock redis client. - Changed the logic around queue provider creation. - Now the `getNewQueue` returns a Queue provider directly, not an init function to create it. The whole Queue module is close to impossible to test properly because everything is private, everything goes through a struct route. Because of that, we can't test for example what keys are used for given queue. To overcome this, as a first step I removed one step from that hard route by allowing custom calls to create new queue provider. To achieve this, I moved the creation logic into the `getNewQueue` (previously it was `getNewQueueFn`). That changes nothing on that side, everything goes as before, except the `newXXX` call happens directly in that function and not outside that. That made it possible to add extra provider specific parameters to those function (`newXXX`). For example a client on redis. Calling it through the `getNewQueue` function, it gets `nil`. - If the provided client is not `nil`, it will use that instead of the connection string. - If it's `nil` (default behaviour), it creates a new redis client as it did before, no changes to that. The rest of the provider code is unchanged. All these changes were required to make it possible to generate mock clients for providers and use them. For the tests, the existing two test cases are good with redis server, and they need some extra helpers, for example to start a new redis server if required, or waiting on a redis server to be ready to use. These helpers are only required for test cases using real redis server. For better isolation, moved existing test under a testify Suite, and moved them into a new test file called `base_redis_with_server_test.go` because, well they test the code with server. These tests do exactly the same as before, calling the same sub-tests the same way as before, the only change is the structure of the test (remove repetition, scope server related helper functions). Finally, we can create unit tests without redis server. The main focus of this group of tests are higher level overview of operations. With the mock redis client we can set up expectations about used queue names, received values, return value to simulate faulty state. These new unit test functions don't test all functionality, at least it's not aimed for it now. It's more about the possibility of doing that and add extra tests around parts we couldn't test before, for example key. What extra features can test the new unit test group: - What is the received key for given queue? For example using `prefix`, or if all the `SXxx` calls are expected to use `queue_unique` if it's a unique queue. - If it's not a unique queue, no `SXxx` functions are called, because those sets are used only to check if a value is unique or not. - `HasItem` return `false` always if it's a non-unique queue. - All functions are called exactly `N` times, and we don't have any unexpected calls to redis from the code. Signed-off-by: Victoria Nadasdi <victoria@efertone.me>
2024-05-20 19:13:42 +02:00
$(GO) install $(GOMOCK_PACKAGE)
$(GO) install $(GOPLS_PACKAGE)
node_modules: package-lock.json
npm install --no-save
@touch node_modules
.venv: poetry.lock
poetry install
@touch .venv
.PHONY: fomantic
fomantic:
rm -rf $(FOMANTIC_WORK_DIR)/build
cd $(FOMANTIC_WORK_DIR) && npm install --no-save
cp -f $(FOMANTIC_WORK_DIR)/theme.config.less $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/theme.config
cp -rf $(FOMANTIC_WORK_DIR)/_site $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/
$(SED_INPLACE) -e 's/ overrideBrowserslist\r/ overrideBrowserslist: ["defaults"]\r/g' $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/tasks/config/tasks.js
cd $(FOMANTIC_WORK_DIR) && npx gulp -f node_modules/fomantic-ui/gulpfile.js build
# fomantic uses "touchstart" as click event for some browsers, it's not ideal, so we force fomantic to always use "click" as click event
$(SED_INPLACE) -e 's/clickEvent[ \t]*=/clickEvent = "click", unstableClickEvent =/g' $(FOMANTIC_WORK_DIR)/build/semantic.js
$(SED_INPLACE) -e 's/\r//g' $(FOMANTIC_WORK_DIR)/build/semantic.css $(FOMANTIC_WORK_DIR)/build/semantic.js
rm -f $(FOMANTIC_WORK_DIR)/build/*.min.*
.PHONY: webpack
webpack: $(WEBPACK_DEST)
$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json
@$(MAKE) -s node-check node_modules
@rm -rf $(WEBPACK_DEST_ENTRIES)
@echo "Running webpack..."
@BROWSERSLIST_IGNORE_OLD_DATA=true npx webpack
@touch $(WEBPACK_DEST)
.PHONY: svg
svg: node-check | node_modules
rm -rf $(SVG_DEST_DIR)
node tools/generate-svg.js
.PHONY: svg-check
svg-check: svg
@git add $(SVG_DEST_DIR)
@git diff --exit-code --color=always --cached $(SVG_DEST_DIR) \
|| (code=$$?; echo "Please run 'make svg' and commit the result"; exit $${code})
.PHONY: lockfile-check
lockfile-check:
npm install --package-lock-only
@git diff --exit-code --color=always package-lock.json \
|| (code=$$?; echo "Please run 'npm install --package-lock-only' and commit the result"; exit $${code})
.PHONY: generate-license
generate-license:
$(GO) run build/generate-licenses.go
.PHONY: generate-gitignore
generate-gitignore:
$(GO) run build/generate-gitignores.go
.PHONY: generate-gomock
generate-gomock:
$(GO) run $(GOMOCK_PACKAGE) -package mock -destination ./modules/queue/mock/redisuniversalclient.go github.com/redis/go-redis/v9 UniversalClient
.PHONY: generate-images
generate-images: | node_modules
npm install --no-save fabric@6 imagemin-zopfli@7
node tools/generate-images.js $(TAGS)
.PHONY: 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
# This endif closes the if at the top of the file
endif
# 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: