From 6e17ef560bcdd8e202c86868f985db846b244a31 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 28 Oct 2025 11:25:24 -0400 Subject: [PATCH] Improve packaging routines and checks Signed-off-by: Juan Cruz Viotti --- .github/workflows/ci.yml | 1 + Makefile | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c9c58fd..ba5f02d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,3 +21,4 @@ jobs: - uses: actions/checkout@v4 - run: make lint - run: make test + - run: make dist diff --git a/Makefile b/Makefile index 52e5b658..c4acbe15 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,10 @@ SHELLCHECK ?= shellcheck PYTHON ?= python3 CURL ?= curl BSDTAR ?= bsdtar +TAR ?= tar +ZIP ?= zip +UNZIP ?= unzip +GZIP ?= gzip MKDIRP ?= mkdir -p RMRF ?= rm -rf @@ -12,6 +16,7 @@ TESTS = $(shell find test/ -type f -name '*.json') VERSION = $(shell tr -d '\n\r' < VERSION) +# TODO: Make `jsonschema fmt` automatically detect test files all: common test $(JSONSCHEMA) fmt schemas meta --verbose $(JSONSCHEMA) fmt test --verbose --default-dialect "https://json-schema.org/draft/2020-12/schema" @@ -25,6 +30,7 @@ common: $(SHELLCHECK) scripts/*.sh ./scripts/schemas-tests-mirror.sh +# TODO: Make `jsonschema fmt` automatically detect test files .PHONY: lint lint: common $(JSONSCHEMA) fmt schemas meta --verbose --check @@ -41,9 +47,15 @@ include generate/iso/country/include.mk external: $(EXTERNAL) generate: $(GENERATE) +# TODO: Add a `jsonschema pkg` command instead .PHONY: dist dist: $(RMRF) $@ $(MKDIRP) $@ - $(BSDTAR) -caf $@/sourcemeta-std-v$(VERSION).zip -s '|^schemas/||' --exclude '.DS_Store' schemas/* LICENSE - $(BSDTAR) -czf $@/sourcemeta-std-v$(VERSION).tar.gz -s '|^schemas/||' --exclude '.DS_Store' schemas/* LICENSE + cd schemas && $(ZIP) -r ../$@/sourcemeta-std-v$(VERSION).zip * -x '*.DS_Store' + $(ZIP) $@/sourcemeta-std-v$(VERSION).zip LICENSE + $(UNZIP) -l $@/sourcemeta-std-v$(VERSION).zip + cd schemas && $(TAR) -cf ../$@/sourcemeta-std-v$(VERSION).tar --exclude '.DS_Store' * + $(TAR) -rf $@/sourcemeta-std-v$(VERSION).tar LICENSE + $(GZIP) $@/sourcemeta-std-v$(VERSION).tar + $(TAR) -tzf $@/sourcemeta-std-v$(VERSION).tar.gz