cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblot...@apache.org
Subject [3/8] cordova-medic git commit: [CB-8870] Updating dependencies and making cordova.conf use new medic.js.
Date Thu, 30 Apr 2015 00:35:56 GMT
[CB-8870] Updating dependencies and making cordova.conf use new medic.js.


Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/fe8f70e1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/fe8f70e1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/fe8f70e1

Branch: refs/heads/master
Commit: fe8f70e1acc2f67eb3a868d4c772c88c3f65f572
Parents: 49da31f
Author: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Authored: Wed Apr 29 15:30:06 2015 -0700
Committer: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Committed: Wed Apr 29 15:30:06 2015 -0700

----------------------------------------------------------------------
 buildbot-conf/cordova.conf | 176 +++++++++++++++-------------------------
 package.json               |  12 ++-
 2 files changed, 69 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe8f70e1/buildbot-conf/cordova.conf
----------------------------------------------------------------------
diff --git a/buildbot-conf/cordova.conf b/buildbot-conf/cordova.conf
index 0d75351..d81d6c8 100644
--- a/buildbot-conf/cordova.conf
+++ b/buildbot-conf/cordova.conf
@@ -36,6 +36,9 @@ TEST_APP_NAME       = 'mobilespec'
 REPOS_PROPERTY_NAME = 'repositories_config'
 NPM_CACHE_DIR       = 'npm_cache'
 NPM_TEMP_DIR        = 'npm_tmp'
+COUCHDB_URI         = medic_config['couchdb']['uri']
+ENTRY_POINT         = medic_config['app']['entry']
+TEST_RUN_TIMEOUT    = medic_config['app']['timeout'] # in seconds
 
 OSX     = 'osx'
 LINUX   = 'linux'
@@ -70,35 +73,6 @@ def repo_branch_from_name(name):
 def slugify(string):
     return string.replace(' ', '-')
 
-def running_tasks_on_platform(platform_name, os_name):
-    """
-    Return the names of tasks possibly started by
-    builds on the given platform and OS.
-    """
-    if platform_name == 'windows':
-        return ['WWAHost.exe']
-    elif platform_name == 'wp8':
-        return ['Xde.exe']
-    elif platform_name == 'ios':
-        return ['iOS Simulator']
-    elif platform_name == 'android':
-        if os_name == WINDOWS:
-            return ['emulator-arm.exe', 'adb.exe']
-        elif os_name == OSX:
-            return ['emulator64-x86']
-    return []
-
-def can_find_running_tasks(step):
-    """
-    Return true if an OS and a platform is specified. Those are the
-    criteria for finding a task because running_tasks_on_platform uses
-    those properties to determine which tasks could be running.
-    """
-    return (
-        (step.build.getProperty('slaveos') is not None) and
-        (step.build.getProperty('platform') is not None)
-    )
-
 def dont_use_default_repos(step):
     return not use_default_repos(step)
 
@@ -119,33 +93,11 @@ def render_repo_name(props):
     repo_url = props.getProperty('repository')
     return repo_name_from_url(repo_url)
 
-@renderer
-def render_task_kill_command(props):
-
-    os_name       = props.getProperty('slaveos')
-    platform_name = props.getProperty('platform')
-    running_tasks = running_tasks_on_platform(platform_name, os_name)
-
-    if not running_tasks:
-        return ['echo', 'No tasks to kill known.']
-
-    if os_name == WINDOWS:
-        command = ['taskkill', '/F']
-        for task in running_tasks:
-            command.append('/IM')
-            command.append(task)
-
-    else:
-        command = ['killall']
-        command.extend(running_tasks)
-
-    return command
-
 # step wrappers
 def DescribedStep(step_class, description, haltOnFailure=True, **kwargs):
     return step_class(description=description, descriptionDone=description, name=slugify(description),
haltOnFailure=haltOnFailure, **kwargs)
 
-def SH(workdir=BASE_WORKDIR, timeout=medic_config['app']['timeout'], **kwargs):
+def SH(workdir=BASE_WORKDIR, timeout=TEST_RUN_TIMEOUT, **kwargs):
     return DescribedStep(ShellCommand, workdir=workdir, timeout=timeout, **kwargs)
 
 def NPM(npm_command, command=list(), what='code', **kwargs):
@@ -159,7 +111,7 @@ def NPMInstall(command=list(), **kwargs):
     #      adding the --tmp parameter so that even if the command doesn't
     #      exit cleanly, the folder will get removed during cleanup;
     #      refer to: https://docs.npmjs.com/files/folders#temp-files
-    return NPM('install', command=command + [I('--cache=%(prop:workdir)s/' + NPM_CACHE_DIR),
I('--tmp=%(prop:workdir)s/' + NPM_TEMP_DIR)], **kwargs)
+    return NPM('install', command=command + [I('--cache=%(prop:builddir)s/' + NPM_CACHE_DIR),
I('--tmp=%(prop:builddir)s/' + NPM_TEMP_DIR)], **kwargs)
 
 def NPMTest(**kwargs):
     return NPM('test', **kwargs)
@@ -174,20 +126,6 @@ def CordovaClone(project_name, **kwargs):
     repo_url = repo_url_from_name(project_name)
     return BuildbotClone(repourl=repo_url, branch=branch, what=project_name, **kwargs)
 
-def MedicClone(config_path, excludes=list(), **kwargs):
-    """
-    Clone repositories using medic's checkout.js script.
-    """
-    command     = ['node', 'cordova-medic/bin/checkout.js', '--config=' + config_path]
-    description = 'cloning configured repos'
-
-    if len(excludes) > 0:
-        excludes_string = ','.join(excludes)
-        command        += ['--exclude', excludes_string]
-        description    += ', except ' + excludes_string
-
-    return SH(command=command, description=description)
-
 def Set(name, value, **kwargs):
     return DescribedStep(SetProperty, 'setting ' + name, property=name, value=value, **kwargs)
 
@@ -225,28 +163,15 @@ medic_steps = [
     NPMInstall(command=['--production'], what='cordova-medic', workdir='cordova-medic'),
 ]
 
-plugins_cleanup_steps = [
+cordova_plugins_prepare_steps = medic_steps + [
 
     # set build properties
     Set('repository_name', render_repo_name),
+    Set('build_id', I('%(prop:buildername)s-%(prop:buildnumber)s')),
 
-    # kill running emulators
-    SH(
-        command         = render_task_kill_command,
-        doStepIf        = can_find_running_tasks,
-        description     = 'killing running tasks',
-        haltOnFailure   = False,
-        flunkOnWarnings = False,
-        warnOnWarnings  = False,
-        decodeRC        = ALWAYS_SUCCESS,
-    ),
-
-    # clean up
-    SH(command=['rm', '-rf', '~/.cordova/*'], description='removing cache'),
-    SH(command=['node', 'cordova-medic/bin/medic.js', 'clean', '--exclude', 'cordova-medic'],
description='cleaning workspace'),
-]
-
-common_plugins_steps = medic_steps + plugins_cleanup_steps + [
+    # kill emulators and clean workspace
+    SH(command=['node', 'cordova-medic/medic/medic.js', 'kill', '--platform', P('platform')],
description='killing running tasks'),
+    SH(command=['node', 'cordova-medic/medic/medic.js', 'clean', '--exclude', 'cordova-medic,'
+ NPM_CACHE_DIR], description='cleaning workspace'),
 
     # download medic's config to slave
     Download(mastersrc=MEDIC_CONFIG_FILE, slavedest='cordova-medic/config.json', description='downloading
master\'s config'),
@@ -260,7 +185,9 @@ common_plugins_steps = medic_steps + plugins_cleanup_steps + [
     Download(mastersrc=PROJECTS_CONFIG_FILE, slavedest='cordova-medic/cordova-repos.json',
description='downloading default repo config', doStepIf=use_default_repos),
 
     # clone all repos
-    MedicClone(config_path='cordova-medic/cordova-repos.json', excludes=['cordova-medic']),
+    # NOTE:
+    #      medic is excluded because it's already cloned
+    SH(command=['node', 'cordova-medic/medic/medic.js', 'checkout', '--config', 'cordova-medic/cordova-repos.json',
'--exclude', 'cordova-medic'], description='cloning repositories'),
 
     # install tools
     NPMInstall(what='cordova-coho',        workdir='cordova-coho'),
@@ -286,33 +213,58 @@ common_plugins_steps = medic_steps + plugins_cleanup_steps + [
         ],
         description='creating mobilespec app'
     ),
-    SH(
-        command=[
-            'node',
-            'cordova-medic/updateconfig.js',
-            I('--%(prop:platform)s'),
-        ],
-        description='preparing mobilespec app'
-    ),
+]
+
+cordova_plugins_run_command = [
+    'node',
+    'cordova-medic/medic/medic.js',
+    'run',
+    '--id',       P('build_id'),
+    '--platform', P('platform'),
+    '--couchdb',  COUCHDB_URI,
+    '--entry',    ENTRY_POINT,
+    '--app',      TEST_APP_NAME,
+
+    # NOTE:
+    #      this timeout is smaller because TEST_RUN_TIMEOUT is used as the
+    #      buildbot timeout, and the "run" command needs to time out before
+    #      the buildbot wrapper times out so it can exit cleanly on timeout
+    '--timeout',  TEST_RUN_TIMEOUT - 60
+]
+
+cordova_plugins_check_command = [
+    'node',
+    'cordova-medic/medic/medic.js',
+    'check',
+    '--id',      P('build_id'),
+    '--couchdb', COUCHDB_URI
+]
+
+cordova_plugins_run_steps = [
+    SH(command=cordova_plugins_run_command, description='running tests'),
+    SH(command=cordova_plugins_check_command, description='analyzing results')
+]
+
+cordova_plugins_windows_run_steps = [
+    SH(command=cordova_plugins_run_command + ['--winvers',  'store80'], description='running
tests (Windows 8.0)',           haltOnFailure=False),
+    SH(command=cordova_plugins_check_command,                           description='analysing
results (Windows 8.0)',       haltOnFailure=False),
+    SH(command=cordova_plugins_run_command + ['--winvers',  'store'],   description='running
tests (Windows 8.1)',           haltOnFailure=False),
+    SH(command=cordova_plugins_check_command,                           description='analysing
results (Windows 8.1)',       haltOnFailure=False),
+    SH(command=cordova_plugins_run_command + ['--winvers',  'phone'],   description='running
tests (Windows Phone 8.1)',     haltOnFailure=False),
+    SH(command=cordova_plugins_check_command,                           description='analysing
results (Windows Phone 8.1)', haltOnFailure=False),
 ]
 
 cordova_plugins_all = BuildFactory()
-cordova_plugins_all.addSteps(common_plugins_steps)
-cordova_plugins_all.addSteps([
-    SH(command=['node', I('cordova-medic/build_%(prop:platform)s.js')], description='running
tests'),
-])
+cordova_plugins_all.addSteps(cordova_plugins_prepare_steps)
+cordova_plugins_all.addSteps(cordova_plugins_run_steps)
 
 # WORKAROUND:
 #            this is here to match what medic already does; these
 #            should be their own builders in the future, using a
 #            proper test matrix
 cordova_plugins_windows = BuildFactory()
-cordova_plugins_windows.addSteps(common_plugins_steps)
-cordova_plugins_windows.addSteps([
-    SH(command=['node', I('cordova-medic/build_%(prop:platform)s.js'), "--store80"], haltOnFailure=False,
description='running tests (Windows 8.0)'),
-    SH(command=['node', I('cordova-medic/build_%(prop:platform)s.js'), "--store"], haltOnFailure=False,
description='running tests (Windows 8.1)'),
-    SH(command=['node', I('cordova-medic/build_%(prop:platform)s.js'), "--phone"], haltOnFailure=False,
description='running tests (Windows Phone 8.1)'),
-])
+cordova_plugins_windows.addSteps(cordova_plugins_prepare_steps)
+cordova_plugins_windows.addSteps(cordova_plugins_windows_run_steps)
 
 ####### BUILDERS
 
@@ -334,16 +286,16 @@ c['status'].extend([
 
     # IRC bot
     words.IRC(
-        host          = "irc.freenode.net",
-        nick          = "cordova-bot",
+        host          = 'irc.freenode.net',
+        nick          = 'cordova-bot',
         allowForce    = True,
-        channels      = ["#cordova"],
-        categories    = ["all"],
+        channels      = ['#cordova'],
+        categories    = ['all'],
         notify_events = {
-            "successToFailure": 1,
-            "failureToSuccess": 1,
-            "started":          0,
-            "finished":         1,
+            'successToFailure': 1,
+            'failureToSuccess': 1,
+            'started':          0,
+            'finished':         1,
         },
     )
 ])

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe8f70e1/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 1ba836a..9b2c8d7 100644
--- a/package.json
+++ b/package.json
@@ -4,13 +4,11 @@
   "description": "continuous integration setup for Apache Cordova",
   "author": "Fil Maj <maj.fil@gmail.com> (http://filmaj.ca)",
   "dependencies": {
-    "follow": "0.8.0",
-    "glob": "3.2.6",
-    "mime": "1.2.9",
-    "ncallbacks": "1.0.0",
-    "optimist": "0.3.5",
-    "q": "0.8.6",
-    "request": "2.12.0",
+    "commander": "^2.8.1",
+    "follow": "^0.11.4",
+    "optimist": "^0.6.1",
+    "q": "^1.3.0",
+    "request": "^2.55.0",
     "shelljs": "^0.4.0"
   },
   "subdomain": "cordova.medic",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message