53 lines
1.6 KiB
Makefile
53 lines
1.6 KiB
Makefile
IMAGE := localhost/agent-sandbox:dev
|
|
ROUTER_IMAGE := localhost/agent-sandbox-router:dev
|
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
SHELL_FILES := agent-sandbox router/start.sh router/forwarder tests/test.sh scripts/build-rpm.sh
|
|
|
|
.PHONY: all build test lint pre-commit rpm clean patch minor major _tag
|
|
|
|
all: build
|
|
|
|
# Local images; the in-repo launcher (VERSION=dev) runs these by default.
|
|
build:
|
|
podman build --format docker -t $(IMAGE) .
|
|
podman build --format docker -t $(ROUTER_IMAGE) router
|
|
|
|
test:
|
|
tests/test.sh
|
|
|
|
lint:
|
|
uvx --from shellcheck-py shellcheck $(SHELL_FILES)
|
|
uvx --from hadolint-py hadolint Containerfile router/Containerfile
|
|
|
|
pre-commit:
|
|
@uvx pre-commit run --all-files
|
|
|
|
rpm:
|
|
./scripts/build-rpm.sh $(VERSION)
|
|
|
|
clean:
|
|
rm -rf dist
|
|
|
|
# Bump helpers — reads the latest semver tag and creates the next one.
|
|
# If no tag exists yet, starts from v0.0.0.
|
|
_LATEST := $(shell git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' | head -1)
|
|
_BASE := $(if $(_LATEST),$(_LATEST),v0.0.0)
|
|
_MAJ := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f1)
|
|
_MIN := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f2)
|
|
_PAT := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f3)
|
|
|
|
patch:
|
|
@NEW=v$(_MAJ).$(_MIN).$(shell expr $(_PAT) + 1); \
|
|
git tag $$NEW && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
|
|
|
|
minor:
|
|
@NEW=v$(_MAJ).$(shell expr $(_MIN) + 1).0; \
|
|
git tag $$NEW && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
|
|
|
|
major:
|
|
@NEW=v$(shell expr $(_MAJ) + 1).0.0; \
|
|
git tag $$NEW && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
|
|
|
|
_tag:
|
|
git push origin $(TAG)
|