process-compose/Makefile

84 lines
2.1 KiB
Makefile
Raw Normal View History

2022-11-01 18:16:41 +03:00
NAME=process-compose
2022-04-16 01:44:27 +03:00
RM=rm
2023-06-13 02:00:45 +03:00
#VERSION = v0.51.0
VERSION = $(shell git describe --abbrev=0)
GIT_REV ?= $(shell git rev-parse --short HEAD)
DATE ?= $(shell TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%dT%H:%M:%SZ' --format="%cd")
2022-11-01 18:16:41 +03:00
NUMVER = $(shell echo ${VERSION} | cut -d"v" -f 2)
PKG = github.com/f1bonacc1/${NAME}
2022-12-17 03:16:52 +03:00
SHELL := /bin/bash
PROJ_NAME := Process Compose
LD_FLAGS := -ldflags="-X ${PKG}/src/config.Version=${VERSION} \
-X ${PKG}/src/config.CheckForUpdates=true \
-X ${PKG}/src/config.Commit=${GIT_REV} \
-X ${PKG}/src/config.Date=${DATE} \
-X '${PKG}/src/config.ProjectName=${PROJ_NAME} 🔥' \
-X '${PKG}/src/config.RemoteProjectName=${PROJ_NAME} ⚡' \
-s -w"
2022-04-16 01:44:27 +03:00
ifeq ($(OS),Windows_NT)
EXT=.exe
RM = cmd /C del /Q /F
endif
2022-04-06 00:26:50 +03:00
2022-05-02 01:49:19 +03:00
.PHONY: test run testrace
2022-04-06 00:26:50 +03:00
buildrun: build run
2023-11-15 01:12:51 +03:00
setup:
go mod tidy
ci: setup build testrace
swag:
~/go/bin/swag init --dir src --output src/docs --parseDependency --parseInternal --parseDepth 1
2022-04-06 00:26:50 +03:00
build:
2023-09-08 20:10:48 +03:00
CGO_ENABLED=0 go build -o bin/${NAME}${EXT} ${LD_FLAGS} ./src
2022-11-01 18:16:41 +03:00
build-nix:
nix build .
nixver:
sed -i 's/version = ".*"/version = "${NUMVER}"/' default.nix
2023-12-08 00:19:09 +03:00
build-pi:
GOOS=linux GOARCH=arm go build ${LD_FLAGS} -o bin/${NAME}-linux-arm ./src
2022-04-06 00:26:50 +03:00
compile:
2022-11-01 18:16:41 +03:00
for arch in amd64 386 arm64 arm; do \
2022-11-01 20:52:00 +03:00
GOOS=linux GOARCH=$$arch go build ${LD_FLAGS} -o bin/${NAME}-linux-$$arch ./src ; \
2022-11-01 18:16:41 +03:00
done;
2022-04-16 01:44:27 +03:00
2022-11-01 18:16:41 +03:00
for arch in amd64 arm64; do \
2022-11-01 20:52:00 +03:00
GOOS=darwin GOARCH=$$arch go build ${LD_FLAGS} -o bin/${NAME}-darwin-$$arch ./src ; \
2022-11-01 18:16:41 +03:00
done;
2022-04-16 12:55:05 +03:00
2022-11-01 18:16:41 +03:00
for arch in amd64 arm64; do \
2022-11-01 20:52:00 +03:00
GOOS=windows GOARCH=$$arch go build ${LD_FLAGS} -o bin/${NAME}-windows-$$arch.exe ./src ; \
2022-11-01 18:16:41 +03:00
done;
2022-06-08 21:47:01 +03:00
2022-04-06 00:26:50 +03:00
test:
go test -cover ./src/...
2022-05-02 01:49:19 +03:00
testrace:
go test -race ./src/...
2022-04-06 00:26:50 +03:00
coverhtml:
2023-01-22 22:15:04 +03:00
go test -coverprofile=coverage.out ./src/...
2022-04-06 00:26:50 +03:00
go tool cover -html=coverage.out
run:
2022-11-01 18:16:41 +03:00
PC_DEBUG_MODE=1 ./bin/${NAME}${EXT}
2022-04-06 00:26:50 +03:00
clean:
2022-11-01 18:16:41 +03:00
$(RM) bin/${NAME}*
2022-12-17 03:16:52 +03:00
release:
source exports
2023-06-13 02:00:45 +03:00
goreleaser release --clean --skip-validate
snapshot:
2023-06-13 02:00:45 +03:00
goreleaser release --snapshot --clean
2024-05-18 00:04:11 +03:00
github-workflows:
act -W ./.github/workflows/go.yml -j build
act -W ./.github/workflows/nix.yml -j build