0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 15:23:14 -05:00

Hook go-licenses into tidy again (#21353)

Running it as part of the build is really unnecessary because we have a
valid output file in the repo and assuming go dependencies do not change
unless go.mod also changes, tidy really is the best target to run the
license generation after.

Also, regenerate the file as I missed to do so during the chroma update,
and mark all json files in assets as generated.
This commit is contained in:
silverwind 2022-10-10 20:45:02 +02:00 committed by GitHub
parent 083ac164dc
commit 94037ada24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 19 deletions

View file

@ -100,7 +100,7 @@ steps:
- name: checks-backend - name: checks-backend
image: golang:1.19 image: golang:1.19
commands: commands:
- make checks-backend - make --always-make checks-backend # ensure the 'go-licenses' make target runs
depends_on: [deps-backend] depends_on: [deps-backend]
volumes: volumes:
- name: deps - name: deps
@ -112,16 +112,11 @@ steps:
- make test-frontend - make test-frontend
depends_on: [lint-frontend] depends_on: [lint-frontend]
- name: generate-frontend
image: golang:1.19
commands:
- make generate-frontend
- name: build-frontend - name: build-frontend
image: node:18 image: node:18
commands: commands:
- make frontend - make frontend
depends_on: [deps-frontend, generate-frontend] depends_on: [deps-frontend]
- name: build-backend-no-gcc - name: build-backend-no-gcc
image: golang:1.18 # this step is kept as the lowest version of golang that we support image: golang:1.18 # this step is kept as the lowest version of golang that we support
@ -549,16 +544,11 @@ steps:
commands: commands:
- make deps-frontend - make deps-frontend
- name: generate-frontend
image: golang:1.18
commands:
- make generate-frontend
- name: build-frontend - name: build-frontend
image: node:18 image: node:18
commands: commands:
- make frontend - make frontend
depends_on: [deps-frontend, generate-frontend] depends_on: [deps-frontend]
- name: deps-backend - name: deps-backend
image: golang:1.18 image: golang:1.18

1
.gitattributes vendored
View file

@ -1,5 +1,6 @@
* text=auto eol=lf * text=auto eol=lf
*.tmpl linguist-language=Handlebars *.tmpl linguist-language=Handlebars
/assets/*.json linguist-generated
/public/vendor/** -text -eol linguist-vendored /public/vendor/** -text -eol linguist-vendored
/vendor/** -text -eol linguist-vendored /vendor/** -text -eol linguist-vendored
/web_src/fomantic/build/** linguist-generated /web_src/fomantic/build/** linguist-generated

View file

@ -406,6 +406,7 @@ unit-test-coverage:
tidy: tidy:
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2)) $(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) $(GO) mod tidy -compat=$(MIN_GO_VERSION)
@$(MAKE) --no-print-directory $(GO_LICENSE_FILE)
vendor: go.mod go.sum vendor: go.mod go.sum
$(GO) mod vendor $(GO) mod vendor
@ -413,7 +414,7 @@ vendor: go.mod go.sum
.PHONY: tidy-check .PHONY: tidy-check
tidy-check: tidy tidy-check: tidy
@diff=$$(git diff go.mod go.sum); \ @diff=$$(git diff go.mod go.sum $(GO_LICENSE_FILE)); \
if [ -n "$$diff" ]; then \ if [ -n "$$diff" ]; then \
echo "Please run 'make tidy' and commit the result:"; \ echo "Please run 'make tidy' and commit the result:"; \
echo "$${diff}"; \ echo "$${diff}"; \
@ -709,17 +710,14 @@ install: $(wildcard *.go)
build: frontend backend build: frontend backend
.PHONY: frontend .PHONY: frontend
frontend: generate-frontend $(WEBPACK_DEST) frontend: $(WEBPACK_DEST)
.PHONY: backend .PHONY: backend
backend: go-check generate-backend $(EXECUTABLE) 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 # 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 .PHONY: generate
generate: generate-backend generate-frontend generate: generate-backend
.PHONY: generate-frontend
generate-frontend: $(GO_LICENSE_FILE)
.PHONY: generate-backend .PHONY: generate-backend
generate-backend: $(TAGS_PREREQ) generate-go generate-backend: $(TAGS_PREREQ) generate-go