2023-02-09 12:16:36 +01:00
|
|
|
LINT_ARGS ?= --timeout 5m
|
|
|
|
GITCHLOG_ARGS ?=
|
|
|
|
SHELL := /bin/bash
|
|
|
|
|
2023-04-06 14:47:37 +02:00
|
|
|
GOTEST_ARGS ?= -short -timeout 60s
|
2023-02-09 12:16:36 +01:00
|
|
|
|
|
|
|
ESBUILD_VERSION ?= v0.17.5
|
|
|
|
|
2023-04-18 17:57:16 +02:00
|
|
|
APP_PATH ?= misc/client-sdk-testsuite/dist
|
|
|
|
RUN_APP_ARGS ?=
|
2023-09-13 06:03:25 +02:00
|
|
|
RUN_STORAGE_SERVER_ARGS ?=
|
|
|
|
|
2023-09-28 22:25:34 +02:00
|
|
|
GORELEASER_VERSION ?= v1.21.2
|
|
|
|
GORELEASER_ARGS ?= release --snapshot --clean
|
|
|
|
|
2023-04-18 17:57:16 +02:00
|
|
|
SHELL := bash
|
2023-02-09 12:16:36 +01:00
|
|
|
|
2023-09-13 06:03:25 +02:00
|
|
|
|
|
|
|
build: build-cli build-storage-server build-client-sdk-test-app
|
2023-02-09 12:16:36 +01:00
|
|
|
|
2023-04-20 13:57:40 +02:00
|
|
|
watch: tools/modd/bin/modd
|
|
|
|
tools/modd/bin/modd
|
2023-02-09 12:16:36 +01:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: test-go
|
|
|
|
|
|
|
|
test-go:
|
2023-09-13 06:03:25 +02:00
|
|
|
go test -count=1 $(GOTEST_ARGS) ./...
|
2023-02-09 12:16:36 +01:00
|
|
|
|
|
|
|
lint:
|
|
|
|
golangci-lint run --enable-all $(LINT_ARGS)
|
|
|
|
|
2023-09-13 06:03:25 +02:00
|
|
|
build-cli: build-sdk
|
2023-02-09 12:16:36 +01:00
|
|
|
CGO_ENABLED=0 go build \
|
|
|
|
-v \
|
|
|
|
-o ./bin/cli \
|
|
|
|
./cmd/cli
|
|
|
|
|
2023-09-13 06:03:25 +02:00
|
|
|
build-storage-server: build-sdk
|
|
|
|
CGO_ENABLED=0 go build \
|
|
|
|
-v \
|
|
|
|
-o ./bin/storage-server \
|
|
|
|
./cmd/storage-server
|
|
|
|
|
2023-04-06 14:47:51 +02:00
|
|
|
build-client-sdk-test-app:
|
|
|
|
cd misc/client-sdk-testsuite && $(MAKE) dist
|
|
|
|
|
2023-02-09 12:16:36 +01:00
|
|
|
install-git-hooks:
|
|
|
|
git config core.hooksPath .githooks
|
|
|
|
|
|
|
|
tools/esbuild/bin/esbuild:
|
|
|
|
mkdir -p tools/esbuild/bin
|
|
|
|
curl -fsSL https://esbuild.github.io/dl/$(ESBUILD_VERSION) | sh
|
|
|
|
mv -f esbuild tools/esbuild/bin/esbuild
|
|
|
|
|
|
|
|
build-sdk: pkg/sdk/client/dist/client.js
|
|
|
|
|
|
|
|
.PHONY: pkg/sdk/client/dist/client.js
|
|
|
|
pkg/sdk/client/dist/client.js: tools/esbuild/bin/esbuild node_modules
|
|
|
|
mkdir -p pkg/sdk/client/dist
|
|
|
|
tools/esbuild/bin/esbuild \
|
|
|
|
pkg/sdk/client/src/index.ts \
|
2023-04-20 10:41:03 +02:00
|
|
|
--minify \
|
2023-02-09 12:16:36 +01:00
|
|
|
--bundle \
|
|
|
|
--sourcemap \
|
2023-04-14 16:23:50 +02:00
|
|
|
--target=es2015 \
|
2023-02-09 12:16:36 +01:00
|
|
|
--format=iife \
|
|
|
|
--global-name=Edge \
|
|
|
|
--define:global=window \
|
|
|
|
--platform=browser \
|
2023-04-18 17:57:16 +02:00
|
|
|
--loader:.svg=dataurl \
|
2023-02-09 12:16:36 +01:00
|
|
|
--outfile=pkg/sdk/client/dist/client.js
|
|
|
|
|
|
|
|
node_modules:
|
|
|
|
npm ci
|
|
|
|
|
2023-04-18 17:57:16 +02:00
|
|
|
run-app: .env
|
|
|
|
( set -o allexport && source .env && set +o allexport && bin/cli app run -p $(APP_PATH) $$RUN_APP_ARGS )
|
|
|
|
|
2023-09-13 06:03:25 +02:00
|
|
|
run-storage-server: .env
|
|
|
|
( set -o allexport && source .env && set +o allexport && bin/storage-server run $$RUN_STORAGE_SERVER_ARGS )
|
|
|
|
|
2023-04-18 17:57:16 +02:00
|
|
|
.env:
|
|
|
|
cp .env.dist .env
|
|
|
|
|
2023-10-02 23:26:16 +02:00
|
|
|
gitea-release: .mktools tools/yq/bin/yq tools/gitea-release/bin/gitea-release.sh goreleaser build
|
2023-02-09 12:16:36 +01:00
|
|
|
mkdir -p .gitea-release
|
|
|
|
rm -rf .gitea-release/*
|
|
|
|
|
2023-09-28 22:25:34 +02:00
|
|
|
cp dist/*.deb .gitea-release/
|
|
|
|
cp dist/*.tar.gz .gitea-release/
|
|
|
|
cp dist/*.apk .gitea-release/
|
|
|
|
cp CHANGELOG.md .gitea-release/
|
2023-02-09 12:16:36 +01:00
|
|
|
|
|
|
|
# Create client-sdk-testsuite package
|
2023-09-28 22:25:34 +02:00
|
|
|
tools/yq/bin/yq -i '.version = "$(MKT_PROJECT_VERSION)"' ./misc/client-sdk-testsuite/dist/manifest.yml
|
|
|
|
bin/cli app package -d ./misc/client-sdk-testsuite/dist -o .gitea-release
|
2023-02-09 12:16:36 +01:00
|
|
|
|
|
|
|
GITEA_RELEASE_PROJECT="edge" \
|
|
|
|
GITEA_RELEASE_ORG="arcad" \
|
|
|
|
GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \
|
2023-09-28 22:25:34 +02:00
|
|
|
GITEA_RELEASE_VERSION="$(MKT_PROJECT_VERSION)" \
|
|
|
|
GITEA_RELEASE_NAME="$(MKT_PROJECT_VERSION)" \
|
|
|
|
GITEA_RELEASE_COMMITISH_TARGET="$$(git rev-parse HEAD)" \
|
2023-02-09 12:16:36 +01:00
|
|
|
GITEA_RELEASE_IS_DRAFT="false" \
|
|
|
|
GITEA_RELEASE_IS_PRERELEASE="true" \
|
|
|
|
GITEA_RELEASE_BODY="" \
|
2023-04-02 18:01:47 +02:00
|
|
|
GITEA_RELEASE_ATTACHMENTS="$$(find .gitea-release/* -type f)" \
|
2023-02-09 12:16:36 +01:00
|
|
|
tools/gitea-release/bin/gitea-release.sh
|
|
|
|
|
|
|
|
tools/gitea-release/bin/gitea-release.sh:
|
|
|
|
mkdir -p tools/gitea-release/bin
|
|
|
|
curl --output tools/gitea-release/bin/gitea-release.sh https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/gitea/gitea-release.sh
|
2023-03-23 19:13:47 +01:00
|
|
|
chmod +x tools/gitea-release/bin/gitea-release.sh
|
|
|
|
|
|
|
|
tools/yq/bin/yq:
|
|
|
|
mkdir -p tools/yq/bin
|
|
|
|
curl -L --output tools/yq/bin/yq https://github.com/mikefarah/yq/releases/download/v4.31.1/yq_linux_amd64
|
2023-04-20 13:57:40 +02:00
|
|
|
chmod +x tools/yq/bin/yq
|
|
|
|
|
|
|
|
tools/modd/bin/modd:
|
|
|
|
mkdir -p tools/modd/bin
|
2023-09-28 22:25:34 +02:00
|
|
|
GOBIN=$(PWD)/tools/modd/bin go install -mod=readonly github.com/cortesi/modd/cmd/modd@latest
|
|
|
|
|
|
|
|
.PHONY: goreleaser
|
2023-10-02 23:18:23 +02:00
|
|
|
goreleaser: .env .mktools changelog
|
2023-10-02 23:26:16 +02:00
|
|
|
( set -o allexport && source .env && set +o allexport && curl -sfL https://goreleaser.com/static/run | VERSION="$(GORELEASER_VERSION)" GORELEASER_CURRENT_TAG="$$MKT_PROJECT_VERSION" bash /dev/stdin $(GORELEASER_ARGS) )
|
2023-09-28 22:25:34 +02:00
|
|
|
|
|
|
|
.PHONY: changelog
|
|
|
|
changelog: .mktools
|
2023-10-02 23:26:16 +02:00
|
|
|
$(MAKE) MKT_GIT_CHGLOG_ARGS='--next-tag "$(MKT_PROJECT_VERSION)" --tag-filter-pattern "$(MKT_PROJECT_VERSION_CHANNEL)" --output CHANGELOG.md' mkt-changelog
|
2023-09-28 22:25:34 +02:00
|
|
|
|
|
|
|
.PHONY: mktools
|
|
|
|
mktools:
|
|
|
|
rm -rf .mktools
|
|
|
|
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL)
|
|
|
|
|
|
|
|
.mktools:
|
|
|
|
$(MAKE) mktools
|
|
|
|
|
|
|
|
-include .mktools/*.mk
|