@@ -76,14 +76,30 @@ jobs:
7676 docker :
7777 - image : circleci/openjdk:8-jdk
7878 steps :
79+ # TODO: factor out this code with the `build` workflow, possibly using yaml reference
7980 - checkout
81+ # # Download and cache dependencies as advised by the circleci ui when adding gradle project
82+ # - restore_cache:
83+ # keys:
84+ # - v1-dependencies-{{ checksum "build.gradle" }}
85+ # # fallback to using the latest cache if no exact match is found
86+ # - v1-dependencies-
87+ # - run: ./gradlew dependencies
88+ # - save_cache:
89+ # paths:
90+ # - ~/.gradle
91+ # key: v1-dependencies-{{ checksum "build.gradle" }}
92+ #
8093 - attach_workspace :
8194 at : ~/osb-cmdb-spike
8295 - run :
83- name : building artefacts
96+ name : Run unit and component tests
97+ # environment:
98+ # #Workaround OpenJdk8 regression which crashes JVM. See https://stackoverflow.com/a/53085816
99+ # - _JAVA_OPTIONS: "-Djdk.net.URLClassPath.disableClassPathURLCheck=true"
100+ # Note: we exclude AT from circle using junit tags to be flexible on unit tests selection.
84101 command : |
85- rm -f ./artefacts/*.jar osb-cmdb/build/libs/osb-cmdb*.jar
86- ./gradlew :osb-cmdb:assemble
102+ ./gradlew --continue -DexcludeTags=AcceptanceTest,scab clean :osb-cmdb:check osb-cmdb:assemble -x checkstyleNohttp -x checkstyleMain -x checkstyleTest -x pmdMain -x pmdTest
87103 - run :
88104 name : save jar artefacts
89105 command : |
@@ -92,20 +108,33 @@ jobs:
92108 when : always
93109 - store_artifacts :
94110 path : ./artefacts
111+ when : always
95112 - run :
96113 name : Save test results
97114 # pending aggregation of multi modules report into a single html file
115+ # sample output during failures:
116+ # Execution failed for task ':osb-cmdb:test'.
117+ # > There were failing tests. See the report at: file:///home/circleci/osb-cmdb-spike/osb-cmdb/build/reports/tests/test/index.html
118+ # Since circle ci does not support support serving directories, html pages are broken: theyr can't resolve dependent css/js
119+ # Workaround is to download tgz archive
120+ # https://github.com/gradle/gradle/issues/5934#issuecomment-404217166
121+ # xml report can be found under build/test-results/<test-task-name>
98122 command : |
99- mkdir -p ~/test-results/junit/
100- cp -r build/reports/tests/test/* ~/test-results/junit/
101- cp -r spring-cloud-app-broker-acceptance-tests/build/reports/tests/test/* ~/test-results/junit/
123+ mkdir -p ~/test-results/junit/xml
124+ ls -alR osb-cmdb/build/
125+ cp -r osb-cmdb/build/reports/tests/test ~/test-results/junit/html
126+ tar cvfz ~/test-results/junit/html/test-results.tgz osb-cmdb/build/reports/tests osb-cmdb/build/test-results
127+ find osb-cmdb/build/test-results -type f -exec cp {} ~/test-results/junit/xml/ \;
102128 when : always
103- # have test results (number of tests) displayed in circleci UI
129+ # have test results (number of tests) displayed in circleci UI: expects junit xml format
130+ # See https://circleci.com/docs/2.0/configuration-reference/#store_test_results
104131 - store_test_results :
105- path : ~/test-results
106- # archive test reports in the build for interactive browsing in circle ci UI
132+ path : ~/test-results/junit/xml
133+ when : always
134+ # archive html test reports in the build for interactive browsing in circle ci UI
107135 - store_artifacts :
108- path : ~/test-results/junit
136+ path : ~/test-results/junit/html
137+
109138 - persist_to_workspace :
110139 root : .
111140 paths :
0 commit comments