def GET(self, commit_id): """ Show hosts for a given test """ tests = model.get_host_tests(commit_id) if tests is None: return 'commit %s not found' % commit_id else: return render.hosts(tests, commit_id, os.path.join(REPO_URL,'commit',commit_id), os.path.join(APP_URL,'viewdocs',commit_id))
def test_commit(payload): """Run the test suite on the commit specified in payload.""" startdir = os.getcwd() repo = payload['repository']['url'] commit_id = payload['after'] branch = payload['ref'].split('/')[-1] if repo != REPO_URL: log('ignoring commit: repo URL %s does not match expected repo URL (%s)' % (repo, REPO_URL)) return -1 if branch not in REPO_BRANCHES: log('branch is %s' % branch) log('ignoring commit %s: branch is not one of %s' % (commit_id, REPO_BRANCHES)) return -1 # make sure this commit hasn't been tested yet cmnts = model.get_host_tests(commit_id) if cmnts != None and len(list(cmnts)) > 0: log("commit %s has already been tested" % commit_id) return -1 commit_dir = get_commit_dir(commit_id) tmp_results_dir = os.path.join(commit_dir, 'host_results') tmp_repo_dir = os.path.join(commit_dir, 'repo') os.makedirs(tmp_results_dir) os.makedirs(tmp_repo_dir) # grab a copy of the commit log("downloading source tarball from github for commit %s" % commit_id) prts = repo.split('/') repo_name = prts[-1] org_name = prts[-2] tarpath = download_github_tar(org_name, repo_name, commit_id, dest=tmp_repo_dir) cmd = ['openmdao', 'test_branch', '-o', tmp_results_dir, '-f', tarpath, ] for host in HOSTS: cmd.append('--host=%s' % host) if TEST_ARGS: cmd.append('--testargs="%s"' % ' '.join(TEST_ARGS)) try: log('cmd = %s' % ' '.join(cmd)) out, ret = _run_sub(cmd, env=os.environ.copy(), cwd=os.getcwd()) log('test_branch return code = %s' % ret) process_results(commit_id, ret, tmp_results_dir, out) except (Exception, SystemExit) as err: log('ERROR during local build: %s' % str(err)) ret = -1 process_results(commit_id, ret, tmp_results_dir, str(err)) finally: d = get_commit_dir(commit_id) del directory_map[commit_id] log('removing temp commit directory %s' % d) shutil.rmtree(d) return ret
def GET(self, commit_id): """ Show hosts for a given test """ tests = model.get_host_tests(commit_id) return render.hosts(tests, commit_id, os.path.join(REPO_URL,'commit',commit_id), os.path.join(APP_URL,'viewdocs',commit_id))