def init(self): """(override) Generate test reports.""" # Test result database if self.get('download_test_results', True): start = time.time() LOG.info("Collecting CIVET results...") sites = list() hashes = mooseutils.git_merge_commits() for category in self.get('remotes').values(): sites.append((category['url'], category['repo'])) self.__database = mooseutils.get_civet_results( hashes=hashes, sites=sites, cache=self.get('test_results_cache'), possible=['OK', 'FAIL', 'DIFF', 'TIMEOUT'], logger=LOG) LOG.info("Collecting CIVET results complete [%s sec.]", time.time() - start) if self.get('generate_test_reports', True): if not self.__database: LOG.error("'generate_test_reports' requires results to exist.") return self.__has_test_reports = True start = time.time() LOG.info("Creating CIVET result pages...") report_root = self.get('test_reports_location') if not self.translator.findPage( report_root, exact=True, throw_on_zero=False): self.translator.addContent( pages.Directory(report_root, source=report_root)) self.translator.addContent( pages.Source('{}/index.md'.format(report_root), source='{}/index.md'.format(report_root), read=False, tokenize=False)) count = 0 for key, item in self.__database.items(): name = 'result_{}'.format(count) self.__test_result_numbers[key] = name count += 1 fullname = '{}/{}.md'.format(report_root, name) self.translator.addContent( pages.Source(fullname, source=fullname, read=False, tokenize=False, key=key)) LOG.info("Creating CIVET result pages complete [%s sec.]", time.time() - start)
def init(self): """(override) Generate test reports.""" # Test result database self.__database = dict() # Only populate the database if the specified branch and author match current repository if mooseutils.git_is_branch(self.get('branch')) and \ mooseutils.git_is_config('user.name', self.get('author')): start = time.time() LOG.info("Collecting CIVET results...") for name, category in self.get('remotes').items(): working_dir = mooseutils.eval_path( category.get('location', MooseDocs.ROOT_DIR)) LOG.info("Gathering CIVET results for '%s' category in %s", name, working_dir) hashes = None if category.get('download_test_results', self.get('download_test_results', True)): hashes = mooseutils.git_civet_hashes( start=self.get('branch'), author=self.get('author'), working_dir=working_dir) LOG.info( "Downloading CIVET results for '%s' category in %s", name, working_dir) local = mooseutils.eval_path( category.get('test_results_cache', self.get('test_results_cache'))) site = (category['url'], category['repo']) local_db = mooseutils.get_civet_results( local=local, hashes=hashes, site=site, cache=local, possible=['OK', 'FAIL', 'DIFF', 'TIMEOUT'], logger=LOG) self.__database.update(local_db) LOG.info("Collecting CIVET results complete [%s sec.]", time.time() - start) if not self.__database and self.get('generate_test_reports', True): LOG.info( "CIVET test result reports are being disabled, it requires results to exist and the specified branch ('%s') and author ('%s') to match the current repository.", self.get('branch'), self.get('author')) self.update(generate_test_reports=False) if self.get('generate_test_reports', True): self.__has_test_reports = True start = time.time() LOG.info("Creating CIVET result pages...") report_root = self.get('test_reports_location') if not self.translator.findPage( report_root, exact=True, throw_on_zero=False): self.translator.addPage( pages.Directory(report_root, source=report_root)) src = pages.Source('{}/index.md'.format(report_root), source='{}/index.md'.format(report_root), read=False, tokenize=False) self.translator.addPage(src) count = 0 for key, item in self.__database.items(): name = 'result_{}'.format(count) self.__test_result_numbers[key] = name count += 1 fullname = '{}/{}.md'.format(report_root, name) src = pages.Source(fullname, source=fullname, read=False, tokenize=False, key=key) self.translator.addPage(src) LOG.info("Creating CIVET result pages complete [%s sec.]", time.time() - start)
def init(self): """(override) Generate test reports.""" # Test result database self.__database = dict() self.__hashes = None # Only populate the database if the specified branch and author match current repository start = time.time() LOG.info("Collecting CIVET results...") branch = self.get('branch') remotes = mooseutils.git_remotes() for name, category in self.get('remotes').items(): LOG.info("Gathering CIVET results for '%s'.", name) if category.get('download_test_results', self.get('download_test_results', True)): repo_url = category.get('repo_url', 'https://github.com').rstrip('/') repo_url += '/{}'.format(category.get('repo')) remote = remotes.get(repo_url, None) if remote is None: remote = '__MooseDocs.extensions.civet__' mooseutils.git_add_and_fetch_remote(repo_url, remote, branch) else: mooseutils.get_fetch_remote(remote, branch) self.__hashes = mooseutils.get_civet_hashes(f'{remote}/{branch}') LOG.info("Downloading CIVET results for '%s' category.", name) local = mooseutils.eval_path(category.get('test_results_cache', self.get('test_results_cache'))) site = (category['url'], category['repo']) local_db = mooseutils.get_civet_results(local=local, hashes=self.__hashes, site=site, cache=local, possible=['OK', 'FAIL', 'DIFF', 'TIMEOUT'], logger=LOG) self.__database.update(local_db) LOG.info("Collecting CIVET results complete [%s sec.]", time.time() - start) if not self.__database and self.get('generate_test_reports', True): LOG.info("CIVET test result reports are being disabled, it requires results to exist and the specified branch ('%s') to match the current repository.", self.get('branch')) self.update(generate_test_reports=False) if self.get('generate_test_reports', True): self.__has_test_reports = True start = time.time() LOG.info("Creating CIVET result pages...") result_pages = list() report_root = self.get('test_reports_location') if not self.translator.findPage(report_root, exact=True, throw_on_zero=False): result_pages.append(pages.Directory(report_root, source=report_root)) result_pages.append(pages.Source('{}/index.md'.format(report_root), source='{}/index.md'.format(report_root), read=False, tokenize=False)) count = 0 for key, item in self.__database.items(): name = 'result_{}'.format(count) self.__test_result_numbers[key] = name count += 1 fullname = '{}/{}.md'.format(report_root, name) result_pages.append(pages.Source(fullname, source=fullname, read=False, tokenize=False, key=key)) self.translator.addPages(result_pages) self.translator.executioner.initPages(result_pages) LOG.info("Creating CIVET result pages complete [%s sec.]", time.time() - start)