Skip to content

Commit

Permalink
upload all test result to job artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
sunchunqiang committed Jan 11, 2019
1 parent 9ab7b6b commit ad2fe2c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
9 changes: 8 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ jobs:
python3 CircleciScripts/run_unittest.py test_results "$currentfolder"
- run:
name : check unit test result
command : bash CircleciScripts/check_testresult.sh test_results
command : |
echo "sdkVersion=$sdkVersion"
echo "testresult=$testresult"
if $testresult != "0"
then
echo "There are test failures"
exit 1
fi
- store_artifacts:
path: test_results

Expand Down
20 changes: 10 additions & 10 deletions CircleciScripts/copy_resourcefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
from functions import runcommand
from shutil import copyfile

root = sys.argv[1]
dest = sys.argv[2]
files = {
"LICENSE.AMAZON.txt":"LICENSE.AMAZON.txt",
"LICENSE.txt":"LICENSE.txt",
"NOTICE.txt":"NOTICE.txt",
"README.md":"README.md",
"CircleciScripts/source.htmlcat":"src/source.htmlcat",
"CircleciScripts/source.html":"src/source.html",
"LICENSE.APACHE.txt":"LICENSE.APACHE.txt",
"Logging.html":"Logging.html",
"Proguard.htm":"Proguard.htm",
"Proguard.html":"Proguard.html",
"CircleciScripts/samples.html":"samples/samples.html"

}

for source,target in files.items:
s = os.path.join(root, source)
t = os.path.join(root,t)
runcommand("mkdir -p '{0}'".format(os.path.dirname(t)))
rn = copyfile(s,t)
if rn != 0 :
print("failed to copy {0} to {1}".format(s,t))
exit(1)
for source,target in files.items():
s = os.path.join(root, source)
t = os.path.join(dest, target)
runcommand("mkdir -p '{0}'".format(os.path.dirname(t)))
copyfile(s,t)

17 changes: 10 additions & 7 deletions CircleciScripts/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ def runtest(module, testtype, results):
testcommand = "bash gradlew {0}:{1} ".format(module, testtype.testAction)
print("Running {0} for {1} .......".format(testtype.displayString, module))
exit_code = runcommand(testcommand)
if exit_code != 0 :
print("test failed for {0}".format(module))
dest = "{0}/{1}".format(results, module)
runcommand("mkdir {0} ".format(dest))
source = "{0}/build/reports/*".format(module)
if runcommand("cp -rf {0} {1}".format(source,dest)) != 0 :
return 1
print("test failed for {0}".format(module))
dest = "{0}/{1}".format(results, module)
runcommand("mkdir {0} ".format(dest))
source = "{0}/build/reports/*".format(module)
runcommand('echo "export testresult=0" >> $BASH_ENV')
if runcommand("cp -rf {0} {1}".format(source,dest)) != 0 :
return 1
if exit_code != 0 :
runcommand('echo "export testresult=1" >> $BASH_ENV')
runcommand('echo "export testresult=1" >> $BASH_ENV')

return 0

Expand Down

0 comments on commit ad2fe2c

Please sign in to comment.