in test-reporter/src/main.ts [143:197]
async createReport(parser: TestParser, name: string, files: FileContent[]): Promise<TestRunResult[]> {
if (files.length === 0) {
core.warning(`No file matches path ${this.path}`)
return []
}
const results: TestRunResult[] = []
for (const {file, content} of files) {
core.info(`Processing test results from ${file}`)
const tr = await parser.parse(file, content)
results.push(tr)
}
core.info(`Creating check run ${name}`)
const createResp = await this.octokit.checks.create({
head_sha: this.context.sha,
name,
status: 'in_progress',
output: {
title: name,
summary: ''
},
...github.context.repo
})
core.info('Creating report summary')
const {listSuites, listTests, onlySummary} = this
const baseUrl = createResp.data.html_url
const summary = getReport(results, {listSuites, listTests, baseUrl, onlySummary})
core.info('Creating annotations')
const annotations = getAnnotations(results, this.maxAnnotations)
const isFailed = results.some(tr => tr.result === 'failed')
const conclusion = isFailed ? 'failure' : 'success'
const icon = isFailed ? Icon.fail : Icon.success
core.info(`Updating check run conclusion (${conclusion}) and output`)
const resp = await this.octokit.checks.update({
check_run_id: createResp.data.id,
conclusion,
status: 'completed',
output: {
title: `${name} ${icon}`,
summary,
annotations
},
...github.context.repo
})
core.info(`Check run create response: ${resp.status}`)
core.info(`Check run URL: ${resp.data.url}`)
core.info(`Check run HTML: ${resp.data.html_url}`)
return results
}