Skip to content

Instantly share code, notes, and snippets.

@dpetersen
Created March 11, 2015 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpetersen/b054edc91163af8af590 to your computer and use it in GitHub Desktop.
Save dpetersen/b054edc91163af8af590 to your computer and use it in GitHub Desktop.
CircleCI junit integration
commit 744cfc17ad795077a427b19d02c10e4f0b5008b7
Author: Don Petersen <don@donpetersen.net>
Date: Tue Mar 10 15:43:22 2015 -0600
Include circle-compatible test output.
diff --git a/circle.yml b/circle.yml
index a2763cf..ece9b30 100644
--- a/circle.yml
+++ b/circle.yml
@@ -9,5 +9,17 @@ dependencies:
- ls
test:
+ pre:
+ - mkdir -p $CIRCLE_TEST_REPORTS/gotest
+
override:
- - docker run -v $(pwd):/src dpetersen/golang-tester
+ # Run the tests:
+ # 1) Using golang-tester to honor godeps.
+ # 2) Preserving STDOUT while saving output to a file for processing.
+ # 3) Preserving the original exit code of 'go test'.
+ - docker run -v $(pwd):/src dpetersen/golang-tester 2>&1 | tee $CIRCLE_TEST_REPORTS/gotest/original.txt ; test ${PIPESTATUS[0]} -eq 0
+
+ post:
+ - mkdir -p $CIRCLE_TEST_REPORTS/gotest
+ - go get -v github.com/jstemmer/go-junit-report
+ - cat $CIRCLE_TEST_REPORTS/gotest/original.txt | go-junit-report > $CIRCLE_TEST_REPORTS/gotest/junit.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment