Jelajahi Sumber

ci: break when test fail (#1671)

thinkerou 7 tahun lalu
induk
melakukan
cce49582d6
2 mengubah file dengan 8 tambahan dan 1 penghapusan
  1. 2 0
      .gitignore
  2. 6 1
      Makefile

+ 2 - 0
.gitignore

@@ -3,3 +3,5 @@ vendor/*
 coverage.out
 count.out
 test
+profile.out
+tmp.out

+ 6 - 1
Makefile

@@ -14,7 +14,12 @@ install: deps
 test:
 	echo "mode: count" > coverage.out
 	for d in $(TESTFOLDER); do \
-		$(GO) test -v -covermode=count -coverprofile=profile.out $$d; \
+		$(GO) test -v -covermode=count -coverprofile=profile.out $$d > tmp.out; \
+		cat tmp.out; \
+		if grep -q "^--- FAIL" tmp.out; then \
+			rm tmp.out; \
+			exit 1;\
+		fi; \
 		if [ -f profile.out ]; then \
 			cat profile.out | grep -v "mode:" >> coverage.out; \
 			rm profile.out; \