feat: make 'check' target

This commit is contained in:
Lance R. Vick 2024-08-25 20:56:43 -07:00
parent 93dcff0984
commit d879eb12c4
No known key found for this signature in database
GPG key ID: 8E47A1EC35A1551D
2 changed files with 14 additions and 27 deletions

View file

@ -2,6 +2,7 @@ export PLATFORM := linux/amd64
export BUILDER := $(shell which docker)
export REGISTRY_LOCAL := stagex-local
export REGISTRY_REMOTE := stagex
export CHECK ?= 0
export NOCACHE ?= 0
export MIRRORS := \
git.distrust.co \
@ -12,6 +13,13 @@ else
NOCACHE_FLAG=
endif
export NOCACHE_FLAG
ifeq ($(CHECK), 1)
CHECK_FLAG=--check
else
CHECK_FLAG=
endif
export CHECK_FLAG
clean_logs := $(shell rm *.log 2>&1 >/dev/null || :)
DEFAULT_GOAL := default
@ -28,6 +36,10 @@ all: \
$(shell find packages/* -type d -exec sh -c 'basename {} | tr "\n" " "' \; ) \
digests.txt
.PHONY: check
check:
$(MAKE) CHECK=1 all
.PHONY: compat
compat:
./src/compat.sh

View file

@ -20,7 +20,7 @@
# - actually output OCI files for each build (vs plain tar)
# - output manifest.txt of all tar/digest hashes for an easy git diff
# - support buildah and podman
define build-pkg
define build
$(eval NAME := $(1))
$(eval VERSION := $(if $(2),$(2),latest))
$(eval TARGET := $(if $(3),$(3),package))
@ -46,6 +46,7 @@ define build-pkg
$(shell ./src/context.sh $(NAME)) \
$(EXTRA_ARGS) \
$(NOCACHE_FLAG) \
$(CHECK_FLAG) \
-f packages/$(NAME)/Containerfile \
packages/$(NAME) \
)
@ -56,29 +57,3 @@ define build-pkg
&& $(BUILD_CMD) \
&& echo $(TIMESTAMP) $(BUILD_CMD) end >> out/build.log;
endef
define check-pkg
$(eval NAME := $(1))
$(eval BUILD_CMD := \
DOCKER_BUILDKIT=1 \
BUILDKIT_MULTI_PLATFORM=1 \
SOURCE_DATE_EPOCH=1 \
$(BUILDER) \
build \
--check \
--progress=plain \
-f packages/$(NAME)/Containerfile \
packages/$(NAME) \
)
$(BUILD_CMD)
endef
define build
$(eval NAME := $(1))
$(eval VERSION := $(if $(2),$(2),))
$(eval TARGET := $(if $(3),$(3),))
$(eval EXTRA_ARGS := $(if $(4),$(4),))
$(call check-pkg,$(NAME))
$(call build-pkg,$(NAME),$(VERSION),$(TARGET),$(EXTRA_ARGS))
endef