Example #1
0
def runCmd(_cmd, _nobanner=False, _miner=False):
    if _miner:
        w3.miner.start(1)
    if _nobanner:
        executed_fmt = '{}'
    else:
        executed_fmt = 'EXECUTED:\n{}'
    print(executed_fmt.format(" ".join(_cmd)))
    ret = runcommand(_cmd)
    if _miner:
        w3.miner.stop()
    return ret
from utils import runcommand
from utils import runtest
from utils import TestTypes
from utils import getmodules
import sys
import os

test_results = sys.argv[1]
root = sys.argv[2]
print(root)
testmodules = getmodules(root)

runcommand('echo "export testresult=0" >> $BASH_ENV')
runcommand("rm -rf {0}".format(test_results))
runcommand("mkdir {0}".format(test_results))
for module in testmodules:
    testfolder = os.path.join(root, module, "src/test")
    if (os.path.isdir(testfolder)):
        if runtest(module, TestTypes.UnitTest, test_results) != 0:
            exit(1)
Example #3
0
import os
import sys
from utils 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.html": "src/source.html",
    "LICENSE.APACHE.txt": "LICENSE.APACHE.txt",
    "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(dest, target)
    runcommand("mkdir -p '{0}'".format(os.path.dirname(t)))
    copyfile(s,t)

from utils import runcommand
import time 

ncount = 0 
print("unlocking emulator screen ...")
while True:
    rn = runcommand("adb shell input keyevent 82 ")
    if rn == 0 :
        print("Unlocked emulator screen")
        exit(0)
    if ncount > 10 :
        print("Failed to unlock emulator screen")
        exit(1)
    time.sleep(10)
    ncount = ncount + 1
import os
import sys
import datetime
from utils import runcommand

awsprofile = sys.argv[1]
distribution_id = sys.argv[2]
path = sys.argv[3]
invalidation = '{{"Paths":{{"Quantity":1,"Items":["/{0}"]}},"CallerReference":"{0}{1}"}}'.format(
    path, datetime.datetime.now())
runcommand("aws configure set preview.cloudfront true")
returncode = runcommand(
    "aws cloudfront create-invalidation --distribution-id {0} --invalidation-batch '{1}' --profile {2}"
    .format(distribution_id, invalidation, awsprofile))
print("returncode=", returncode)
exit(returncode)
        print("packages with version {0} that are not available: {1}".format(
            version, not_available_packagelist))
        return (False, not_available_packagelist)
    else:
        print("all packages with version {0} are available".format(version))
        return (True, not_available_packagelist)


version = sys.argv[1]
email_from = sys.argv[2]
email_to = sys.argv[3]
starttime = datetime.datetime.now()
ready, not_available_packagelist = IsAllPackageAvailableOnMaven(version)
if not ready:
    # send email
    destination = '{{ "ToAddresses":  ["{0}"] }}'.format(email_to)
    title = "The latest AWS Android SDKs are missing on Maven"
    body = "Android SDKs {0} are still not available on maven. Below packages are not found on maven: {1}".format(
        version, not_available_packagelist)
    message = '{{"Subject": {{"Data": "{0}","Charset": "UTF-8" }},"Body": {{ "Text": {{ "Data": "{1}", "Charset": "UTF-8" }} }} }}'.format(
        title, body)
    profile = 'circleci-info'
    sendemail_command = "aws ses send-email --from '{0}' --destination '{1}' --message '{2}' --profile {3}".format(
        email_from, destination, message, profile)
    rn = utils.runcommand(sendemail_command)
    if rn != 0:
        print("Failed to send alarm email")
        exit(1)

print("Done!")
import os
import sys
from utils 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.html":"src/source.html",
"LICENSE.APACHE.txt":"LICENSE.APACHE.txt",
"Logging.html":"Logging.html",
"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(dest, target)
    runcommand("mkdir -p '{0}'".format(os.path.dirname(t)))
    copyfile(s,t)

    if not_available_packagelist:
        print("packages with version {0} that are not available: {1}".format(version,not_available_packagelist))
        return (False , not_available_packagelist)
    else:
        print("all packages with version {0} are available".format(version))
        return (True, not_available_packagelist)

version = sys.argv[1]
email_from = sys.argv[2]
email_to = sys.argv[3]
starttime = datetime.datetime.now()
ready, not_available_packagelist = IsAllPackageAvailableOnMaven(version)
if not ready:
    # send email 
    destination ='{{ "ToAddresses":  ["{0}"] }}'.format(email_to)
    title = "The latest AWS Android SDKs are missing on Maven"
    body = "Android SDKs {0} are still not available on maven. Below packages are not found on maven: {1}".format(version, not_available_packagelist)
    message = '{{"Subject": {{"Data": "{0}","Charset": "UTF-8" }},"Body": {{ "Text": {{ "Data": "{1}", "Charset": "UTF-8" }} }} }}'.format(title, body)
    profile = 'circleci-info'
    sendemail_command ="aws ses send-email --from '{0}' --destination '{1}' --message '{2}' --profile {3}".format(email_from, destination, message, profile)
    rn = utils.runcommand(sendemail_command)
    if rn != 0 :
        print("Failed to send alarm email")
        exit(1)

print("Done!")

    
 

 
from utils import runcommand
import time

ncount = 0
print("unlocking emulator screen ...")
while True:
    rn = runcommand("adb shell input keyevent 82 ")
    if rn == 0:
        print("Unlocked emulator screen")
        exit(0)
    if ncount > 10:
        print("Failed to unlock emulator screen")
        exit(1)
    time.sleep(10)
    ncount = ncount + 1
import os
import sys
from utils import runcommand

user =  sys.argv[1]
token =  sys.argv[2]
title =  sys.argv[3]
body = sys.argv[4]
base =  sys.argv[5]
head =  sys.argv[6]
touser =  sys.argv[7]
repo =  sys.argv[8]

data='{{"title":"{0}","base":"{1}","head":"{2}", "body":"{3}"}}'.format(title, base, head,body)
print("data:", data)
rn = runcommand(command = "curl --user  '{0}:{1}' --request POST  --data  '{2}' 'https://api.github.com/repos/{3}/{4}/pulls'".format(user,token,data, touser, repo), logcommandline = False)
exit(rn)
Example #11
0
from utils import runcommand
from utils import runtest
from utils import TestTypes
from utils import getmodules
import sys
import os

test_results = sys.argv[1]
root = sys.argv[2]
print(root)
testmodules =  getmodules(root)

runcommand('echo "export testresult=0" >> $BASH_ENV')
runcommand("rm -rf {0}".format(test_results))
runcommand("mkdir {0}".format(test_results))
for module in testmodules:
    testfolder = os.path.join(root, module, "src/test")
    if (os.path.isdir(testfolder)):
        if runtest(module, TestTypes.UnitTest, test_results) != 0 :
            exit(1)
Example #12
0
def copylib(root, modules, target):
    for module in modules:
        sourcepath = os.path.join(root, module, "build/libs")
        if os.path.isdir(sourcepath):
            runcommand('cp {0}/*.jar "{1}"'.format(sourcepath, target))
Example #13
0
        subpackageset = getAllPackagesWithPattern(root, modules, subpackage);
        subpackages.update(subpackageset)

excludes = set()
for exclude in resolveList(docConfigure["excludes"]):
    if exclude.find("*") == -1 :
        excludes.add(exclude);
    else:
        excludepackageset = getAllPackagesWithPattern(root, modules, exclude);
        excludes.update(excludepackageset)

sourcefiles = getsourceFilesWithPattern(root, modules, docConfigure["sourcefiles"])
print("sourcefiles: ", sourcefiles)
groups = docConfigure["groups"]
for group in groups:
    group['packages'] = resolveList(group['packages'])

otheroptions = resolveDict(docConfigure["otheroptions"])
otherargs = resolveList(docConfigure["otherargs"])

jarlist = getJARs(root, libs)
if "CLASSPATH" in os.environ:
    jarlist.append(os.environ["CLASSPATH"])
os.environ["CLASSPATH"]=':'.join(jarlist)
os.environ["sdkVersion"]=sdkVersion
commandline = getCommandline(dest, root, modules, packages,sourcefiles, subpackages,excludes, groups, otheroptions, otherargs)
returncode = runcommand(commandline)
print("return code:" , returncode)
exit(returncode)
#print(commandline)
Example #14
0
import os
import sys
from utils import getmodules
from utils import runcommand
from shutil import copyfile
from pathlib import Path
root = sys.argv[1]
version = sys.argv[2]
s3profile = sys.argv[3]
s3prefix=sys.argv[4]

modules = getmodules(root)
for module in modules:
    target = os.path.join(root, module, "target")
    s3maven = os.path.join(target, "s3maven")
    runcommand("mkdir -p '{0}'".format(s3maven))
    for file in os.listdir(target):
        sourcefile = os.path.join(target, file)
        if os.path.isfile(sourcefile) and  (version in file):
            targetfile = os.path.join(s3maven, file)
            copyfile(sourcefile, targetfile)
            print("copy file {0} to {1}".format(sourcefile, targetfile))
    print("upload module {0} ...".format(module))
    runcommand('aws s3 sync "{0}"  s3://{1}/{2}/{3} --profile {4}'.format(s3maven, s3prefix, module,version,s3profile))
Example #15
0
    if 'nextToken' in response:
        nextToken = response['nextToken']
        response = client.list_runs(arn = project_arn, nextToken = nextToken)
    else:
        break;

failedmodule = namedtuple('failedmodule','name, reason')
failedmodulelist = []
for module in testmodulelist:
    name = module[16:]
    if name.endswith('-test'):
        name = name[:-5]    
    print("#################### {0} ####################".format(name))
    # build module for test
    command = "bash gradlew :{0}:assembleAndroidTest".format(module)
    rn = runcommand(command)
    if rn != 0 :
        print("failed to build test module:", module)
        failedmodulelist.append (
                failedmodule (
                    name = name , 
                    reason = "failed to build test module"
                    )
            )
        continue;
    apkfile = os.path.join(base, module, "build/outputs/apk/androidTest/debug/{0}-debug-androidTest.apk".format(module))
    if not os.path.isfile(apkfile) :
        print("cannot find test module apk:", apkfile)
        failedmodulelist.append (
                failedmodule (
                    name = name ,