2023-08-14 13:49:17 +00:00
|
|
|
DOCS_BASE_URL:=/
|
2023-08-14 13:44:23 +00:00
|
|
|
HUGO_VERSION:=0.117.0
|
|
|
|
|
2021-12-06 16:25:19 +00:00
|
|
|
default: lint frontend_lint test
|
2021-04-03 12:11:47 +00:00
|
|
|
|
2023-08-14 13:44:23 +00:00
|
|
|
build_prod: frontend_prod
|
|
|
|
go build \
|
|
|
|
-trimpath \
|
|
|
|
-mod=readonly \
|
|
|
|
-ldflags "-X main.version=$(shell git describe --tags --always || echo dev)"
|
|
|
|
|
2021-04-03 12:11:47 +00:00
|
|
|
lint:
|
2021-12-06 16:25:19 +00:00
|
|
|
golangci-lint run
|
2021-04-03 12:11:47 +00:00
|
|
|
|
2023-07-14 14:15:58 +00:00
|
|
|
publish: frontend_prod
|
2021-04-03 12:11:47 +00:00
|
|
|
curl -sSLo golang.sh https://raw.githubusercontent.com/Luzifer/github-publish/master/golang.sh
|
|
|
|
bash golang.sh
|
|
|
|
|
|
|
|
test:
|
2021-08-19 13:33:56 +00:00
|
|
|
go test -cover -v ./...
|
2021-04-03 12:11:47 +00:00
|
|
|
|
2021-09-22 13:36:45 +00:00
|
|
|
# --- Editor frontend
|
|
|
|
|
2023-07-14 14:15:58 +00:00
|
|
|
frontend_prod: export NODE_ENV=production
|
|
|
|
frontend_prod: frontend
|
|
|
|
|
2021-12-06 16:25:19 +00:00
|
|
|
frontend: node_modules
|
|
|
|
node ci/build.mjs
|
|
|
|
|
|
|
|
frontend_lint: node_modules
|
|
|
|
./node_modules/.bin/eslint \
|
|
|
|
--ext .js,.vue \
|
|
|
|
--fix \
|
|
|
|
src
|
|
|
|
|
|
|
|
node_modules:
|
|
|
|
npm ci
|
2021-09-22 13:36:45 +00:00
|
|
|
|
2023-04-07 22:41:00 +00:00
|
|
|
# --- Tools
|
|
|
|
|
|
|
|
update_ua_list:
|
|
|
|
# User-Agents provided by https://www.useragents.me/
|
|
|
|
curl -sSf https://www.useragents.me/api | jq -r '.data[].ua' | grep -v 'Trident' >internal/linkcheck/user-agents.txt
|
2023-06-12 21:35:54 +00:00
|
|
|
|
|
|
|
# -- Vulnerability scanning --
|
|
|
|
|
|
|
|
trivy:
|
|
|
|
trivy fs . \
|
|
|
|
--dependency-tree \
|
|
|
|
--exit-code 1 \
|
|
|
|
--format table \
|
|
|
|
--ignore-unfixed \
|
|
|
|
--quiet \
|
|
|
|
--scanners config,license,secret,vuln \
|
|
|
|
--severity HIGH,CRITICAL \
|
|
|
|
--skip-dirs docs
|
2023-08-14 13:44:23 +00:00
|
|
|
|
|
|
|
# -- Documentation Site --
|
|
|
|
|
2023-08-25 21:37:37 +00:00
|
|
|
docs: actor_docs template_docs
|
|
|
|
|
2023-08-14 13:44:23 +00:00
|
|
|
actor_docs:
|
|
|
|
go run . --storage-conn-string $(shell mktemp).db actor-docs >docs/content/configuration/actors.md
|
|
|
|
|
2023-08-25 21:37:37 +00:00
|
|
|
template_docs:
|
|
|
|
go run . --storage-conn-string $(shell mktemp).db tpl-docs >docs/content/configuration/templating.md
|
|
|
|
|
2023-08-14 13:44:23 +00:00
|
|
|
eventclient_docs:
|
|
|
|
echo -e "---\ntitle: EventClient\nweight: 10000\n---\n" >docs/content/overlays/eventclient.md
|
|
|
|
docker run --rm -i -v $(CURDIR):$(CURDIR) -w $(CURDIR) node:18-alpine sh -ec 'npx --yes jsdoc-to-markdown --files ./internal/apimodules/overlays/default/eventclient.js' >>docs/content/overlays/eventclient.md
|
|
|
|
|
|
|
|
render_docs: hugo_$(HUGO_VERSION)
|
2023-08-14 13:49:17 +00:00
|
|
|
./hugo_$(HUGO_VERSION) \
|
|
|
|
--baseURL "$(DOCS_BASE_URL)" \
|
|
|
|
--cleanDestinationDir \
|
|
|
|
--gc \
|
|
|
|
--source docs
|
2023-08-14 13:44:23 +00:00
|
|
|
|
|
|
|
hugo_$(HUGO_VERSION):
|
|
|
|
curl -sSfL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_extended_$(HUGO_VERSION)_linux-amd64.tar.gz | tar -xz hugo
|
|
|
|
mv hugo $@
|