From bcdb598b6e55502b032ab36d6afe9c76b38f2f42 Mon Sep 17 00:00:00 2001 From: Luca Favatella Date: Sun, 1 Jan 2017 00:20:48 +0000 Subject: [PATCH 1/2] plant CI --- .travis.yml | 9 +++++++++ ci | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 .travis.yml create mode 100755 ci diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3559146 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +sudo: false + +language: python + +python: + - 2.7 + +script: + - ./ci script diff --git a/ci b/ci new file mode 100755 index 0000000..8f48af7 --- /dev/null +++ b/ci @@ -0,0 +1,9 @@ +#!/bin/bash + +set -ev # Ref https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps + +case "${1:?}" in + script) + ./merge.py + ;; +esac From d191f50a32c1dbe5c0af0c42cbfe274c4e4935c6 Mon Sep 17 00:00:00 2001 From: Luca Favatella Date: Sun, 1 Jan 2017 00:52:34 +0000 Subject: [PATCH 2/2] teach merge.py script to exit with non-0 exit status if any failure Also delete unused code in merge.py wrt skipping, in order to avoid deciding what exit status to return in case of no failures but a skip. --- merge.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/merge.py b/merge.py index 8887bdb..4c4bb3d 100755 --- a/merge.py +++ b/merge.py @@ -2,6 +2,7 @@ import glob import re +import sys def morphgnt(): @@ -35,19 +36,12 @@ class Counter: def __init__(self, show_all=False): self.show_all = show_all self.success_count = 0 - self.skip_count = 0 self.fail_count = 0 self.first_fail = None - self.first_skip = None def success(self): self.success_count += 1 - def skip(self, message): - self.skip_count += 1 - if self.first_skip is None: - self.first_skip = message - def fail(self, message): if self.show_all: print(message) @@ -56,11 +50,9 @@ def fail(self, message): self.first_fail = message def results(self): - print("{} success; {} fail; {} skipped".format(self.success_count, self.fail_count, self.skip_count)) + print("{} success; {} fail".format(self.success_count, self.fail_count)) if self.first_fail: print("first fail: {}".format(self.first_fail)) - if self.first_skip: - print("first skip: {}".format(self.first_skip)) counter = Counter() @@ -75,3 +67,4 @@ def results(self): counter.fail("{}: {}".format(row["bcv"], " ".join(data))) counter.results() +sys.exit(0 if counter.fail_count == 0 else 1)