Skip to content

Commit 2c1245d

Browse files
committed
Add new ".license-check" Make target which runs as part of CI check and
verifies pack contains LICENSE file with Apache 2.0 license text.
1 parent 8d85c05 commit 2c1245d

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.circle/Makefile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ COMPONENTS_RUNNERS := $(wildcard /tmp/st2/contrib/runners/*)
2222
all: requirements lint packs-resource-register packs-tests
2323

2424
.PHONY: all-ci
25-
all-ci: compile .flake8 .pylint .copy-pack-to-subdirectory .configs-check .metadata-check .packs-resource-register .packs-tests
25+
all-ci: compile .license-check .flake8 .pylint .copy-pack-to-subdirectory .configs-check .metadata-check .packs-resource-register .packs-tests
2626

2727
.PHONY: lint
2828
lint: requirements flake8 pylint configs-check metadata-check
@@ -195,6 +195,25 @@ compile:
195195
st2-check-print-pack-tests-coverage $(ROOT_DIR) || exit 1; \
196196
fi;
197197

198+
# Target which veries repo root contains LICENSE file with ASF 2.0 content
199+
.PHONY: .license-check
200+
.license-check:
201+
@echo
202+
@echo "==================== license-check ===================="
203+
@echo
204+
if [ -z "${CHANGED_FILES}" ] && [ "$${FORCE_CHECK_ALL_FILES}" = "false" ]; then \
205+
echo "No files have changed, skipping run..."; \
206+
else \
207+
if [ ! -f "$(ROOT_DIR)/LICENSE" ]; then \
208+
echo "Missing LICENSE file in $(ROOT_DIR)"; \
209+
exit 2;\
210+
fi;\
211+
cat $(ROOT_DIR)/LICENSE | grep -q "Apache License" || (echo "LICENSE file doesn't contain Apache 2.0 license text" ; exit 2); \
212+
cat $(ROOT_DIR)/LICENSE | grep -q "Version 2.0" || (echo "LICENSE file doesn't contain Apache 2.0 license text" ; exit 2); \
213+
cat $(ROOT_DIR)/LICENSE | grep -q "www.apache.org/licenses/LICENSE-2.0" || (echo "LICENSE file doesn't contain Apache 2.0 license text" ; exit 2); \
214+
fi;
215+
216+
198217
.PHONY: .clone_st2_repo
199218
.clone_st2_repo: /tmp/st2
200219
/tmp/st2:

0 commit comments

Comments
 (0)