Add Travis CI Integration

This commit is contained in:
Wenxuan Zhao 2017-12-14 20:37:16 -08:00
parent fcf53f1ae9
commit 749ce6ec2c
No known key found for this signature in database
GPG Key ID: 0B45B13F10587A57
2 changed files with 42 additions and 0 deletions

2
.travis.yml Normal file
View File

@ -0,0 +1,2 @@
language: ruby
script: make check

40
Makefile Normal file
View File

@ -0,0 +1,40 @@
RULES := rule-source-added \
rule-translation-requested \
rule-translation-completed \
rule-translation-revised \
rule-translation-published
.PHONY: check match $(RULES)
CHANGE_FILE := /tmp/changes
check: $(CHANGE_FILE)
echo 'PR #$(TRAVIS_PULL_REQUEST) Changes:'
cat $(CHANGE_FILE)
echo
echo 'Check for rules...'
make -k $(RULES) 2>/dev/null | grep '^Rule Matched: '
$(CHANGE_FILE):
git --no-pager diff '$(TRAVIS_PULL_REQUEST_BRANCH)' FETCH_HEAD --no-renames --name-status > $@
rule-source-added:
[[ $(shell grep '^A\s\+sources/' $(CHANGE_FILE) | wc -l) -ge 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-requested:
[[ $(shell grep '^M\s\+sources/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-completed:
[[ $(shell grep '^D\s\+sources/' $(CHANGE_FILE) | wc -l) = 1 ]]
[[ $(shell grep '^A\s\+translated/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-revised:
[[ $(shell grep '^M\s\+translated/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'
rule-translation-published:
[[ $(shell grep '^D\s\+translated/' $(CHANGE_FILE) | wc -l) = 1 ]]
[[ $(shell grep '^A\s\+published/' $(CHANGE_FILE) | wc -l) = 1 ]]
echo 'Rule Matched: $(@)'