2022-03-22 09:21:55 +01:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
LINT_ARGS ?= --timeout 5m
|
|
|
|
FRMD_CMD ?=
|
|
|
|
SHELL = /bin/bash
|
2022-05-04 12:23:53 +02:00
|
|
|
TAILWINDCSS_ARGS ?=
|
|
|
|
GORELEASER_VERSION ?= v1.8.3
|
|
|
|
GORELEASER_ARGS ?= --auto-snapshot --rm-dist
|
|
|
|
GITCHLOG_ARGS ?=
|
2022-05-10 22:38:05 +02:00
|
|
|
SHELL := /bin/bash
|
2022-07-29 17:47:11 +02:00
|
|
|
RUN_INSTALL_TESTS ?= yes
|
2022-03-22 09:21:55 +01:00
|
|
|
|
2022-08-01 10:36:00 +02:00
|
|
|
FORMIDABLE_VERSION := 0.0.5
|
|
|
|
|
2022-03-22 09:21:55 +01:00
|
|
|
.PHONY: help
|
|
|
|
help: ## Display this help
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
2022-05-10 22:38:05 +02:00
|
|
|
watch: deps ## Watching updated files - live reload
|
|
|
|
( set -o allexport && source .env && set +o allexport && go run -mod=readonly github.com/cortesi/modd/cmd/modd@latest )
|
2022-03-22 09:21:55 +01:00
|
|
|
|
2022-07-29 17:47:11 +02:00
|
|
|
.PHONY: test
|
|
|
|
test: test-go ## Executing tests
|
|
|
|
|
|
|
|
ifeq ($(RUN_INSTALL_TESTS), yes)
|
|
|
|
test: test-install-script
|
|
|
|
endif
|
2022-06-15 21:09:18 +02:00
|
|
|
|
|
|
|
test-go: deps
|
2022-03-22 09:21:55 +01:00
|
|
|
( set -o allexport && source .env && set +o allexport && go test -v -race -count=1 $(GOTEST_ARGS) ./... )
|
|
|
|
|
2022-06-15 21:09:18 +02:00
|
|
|
test-install-script: tools/bin/bash_unit
|
|
|
|
tools/bin/bash_unit ./misc/script/test_install.sh
|
|
|
|
|
|
|
|
tools/bin/bash_unit:
|
|
|
|
mkdir -p tools/bin
|
|
|
|
cd tools/bin && bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh)
|
|
|
|
|
2022-03-22 09:21:55 +01:00
|
|
|
lint: ## Lint sources code
|
|
|
|
golangci-lint run --enable-all $(LINT_ARGS)
|
|
|
|
|
|
|
|
build: build-frmd ## Build artefacts
|
|
|
|
|
2022-05-12 18:27:27 +02:00
|
|
|
build-frmd: deps tailwind ## Build executable
|
2022-08-01 15:29:14 +02:00
|
|
|
CGO_ENABLED=0 go build \
|
|
|
|
-v \
|
|
|
|
-ldflags "\
|
|
|
|
-X 'main.GitRef=$(shell git rev-parse --short HEAD)' \
|
|
|
|
-X 'main.ProjectVersion=$(shell git describe --always)' \
|
|
|
|
-X 'main.BuildDate=$(shell date --utc --rfc-3339=seconds)' \
|
|
|
|
" \
|
|
|
|
-o ./bin/frmd \
|
|
|
|
./cmd/frmd
|
2022-03-22 09:21:55 +01:00
|
|
|
|
2022-05-04 12:23:53 +02:00
|
|
|
.PHONY: tailwind
|
2022-05-12 18:27:27 +02:00
|
|
|
tailwind: deps
|
2022-05-04 12:23:53 +02:00
|
|
|
npx tailwindcss -i ./internal/server/assets/src/main.css -o ./internal/server/assets/dist/main.css $(TAILWINDCSS_ARGS)
|
|
|
|
|
|
|
|
internal/server/assets/dist/main.css: tailwind
|
|
|
|
|
2022-03-22 09:21:55 +01:00
|
|
|
.env:
|
|
|
|
cp .env.dist .env
|
|
|
|
|
2022-05-04 12:23:53 +02:00
|
|
|
.PHONY: deps
|
2022-05-10 22:38:05 +02:00
|
|
|
deps: .env node_modules
|
2022-05-04 12:23:53 +02:00
|
|
|
|
|
|
|
node_modules:
|
|
|
|
npm ci
|
2022-03-22 09:21:55 +01:00
|
|
|
|
|
|
|
.PHONY: release
|
2022-05-04 12:23:53 +02:00
|
|
|
release: deps
|
2022-05-10 22:38:05 +02:00
|
|
|
( set -o allexport && source .env && set +o allexport && VERSION=$(GORELEASER_VERSION) curl -sfL https://goreleaser.com/static/run | bash /dev/stdin $(GORELEASER_ARGS) )
|
2022-05-04 12:23:53 +02:00
|
|
|
|
2022-08-01 10:36:00 +02:00
|
|
|
.PHONY: start-release
|
|
|
|
start-release:
|
|
|
|
#git flow release start $(FORMIDABLE_VERSION)
|
|
|
|
|
|
|
|
# Update package.json version
|
|
|
|
jq '.version = "$(FORMIDABLE_VERSION)"' package.json | sponge package.json
|
|
|
|
git add package.json
|
|
|
|
git commit -m "chore: bump to version $(FORMIDABLE_VERSION)"
|
|
|
|
|
|
|
|
# Generate updated changelog
|
|
|
|
$(MAKE) GITCHLOG_ARGS='--next-tag $(FORMIDABLE_VERSION)' changelog
|
|
|
|
git add CHANGELOG.md
|
|
|
|
git commit -m "chore: update changelog for version $(FORMIDABLE_VERSION)"
|
|
|
|
|
|
|
|
echo "Commit you additional modifications then execute 'make finish-release'"
|
|
|
|
|
|
|
|
.PHONY: finish-release
|
|
|
|
finish-release:
|
|
|
|
git flow release finish -m "v$(FORMIDABLE_VERSION)"
|
|
|
|
git push --all
|
|
|
|
git push --tags
|
|
|
|
|
2022-05-04 12:23:53 +02:00
|
|
|
.PHONY: changelog
|
|
|
|
changelog:
|
2022-08-01 10:36:00 +02:00
|
|
|
go run -mod=readonly github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.1 $(GITCHLOG_ARGS) > CHANGELOG.md
|
2022-05-04 12:23:53 +02:00
|
|
|
|
|
|
|
install-git-hooks:
|
|
|
|
git config core.hooksPath .githooks
|