Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ jobs:
- uses: actions/checkout@v4
- run: make lint
- run: make test
- run: make dist
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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