Skip to content

Commit

Permalink
Merge pull request grafana#230 from aajisaka/use-jsonnetfmt
Browse files Browse the repository at this point in the history
Upgrade jsonnet to 0.16.0 and use jsonnetfmt command for test
  • Loading branch information
trotttrotttrott authored Jun 8, 2020
2 parents fbc4c9a + 7d0eb3a commit 8fb95bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
UID = $(shell id -u $(USER))
GID = $(shell id -g $(USER))

help: # Show this message.
@echo "\nAvailable Targets:\n"
@sed -ne '/@sed/!s/# //p' $(MAKEFILE_LIST)
Expand All @@ -6,16 +9,18 @@ test: # Run all unit tests.
@docker run --rm \
-w $$PWD \
-v $$PWD:$$PWD \
--entrypoint sh \
sparkprime/jsonnet \
-u $(UID):$(GID) \
--entrypoint bash \
bitnami/jsonnet:0.16.0 \
tests.sh

test-update: # Run all unit tests while copying test_output.json to compiled.json file.
@docker run --rm \
-w $$PWD \
-v $$PWD:$$PWD \
--entrypoint sh \
sparkprime/jsonnet \
-u $(UID):$(GID) \
--entrypoint bash \
bitnami/jsonnet:0.16.0 \
tests.sh update

gen-api-docs: # Generate api-docs.md from source code comments.
Expand Down
4 changes: 2 additions & 2 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ for i in `find . -name '*.jsonnet' -or -name '*.libsonnet'`
do
t="Formatting $i..."
if [[ "$1" == "update" ]]; then
jsonnet fmt -i $jsonnet_fmt $i
jsonnetfmt -i $jsonnet_fmt $i
fi
if jsonnet fmt --test $jsonnet_fmt $i;
if jsonnetfmt --test $jsonnet_fmt $i;
then
echo $t OK
else
Expand Down

0 comments on commit 8fb95bd

Please sign in to comment.