Skip to content

Commit 7b9ae7d

Browse files
authored
Merge pull request #80 from StackStorm-Exchange/pack_license_check
Add license check to the pack test script
2 parents 8d85c05 + d7384f8 commit 7b9ae7d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.circle/Makefile

Lines changed: 19 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,24 @@ 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+
198216
.PHONY: .clone_st2_repo
199217
.clone_st2_repo: /tmp/st2
200218
/tmp/st2:

0 commit comments

Comments
 (0)