Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Dorner committed Feb 16, 2021
1 parent e31d426 commit 09d1ac9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
19 changes: 13 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ class TestReporter {
const results: TestRunResult[] = []
const input = await inputProvider.load()
for (const [reportName, files] of Object.entries(input)) {
const tr = await this.createReport(parser, reportName, files)
results.push(...tr)
try {
core.startGroup(`Creating test report ${reportName}`)
const tr = await this.createReport(parser, reportName, files)
results.push(...tr)
} finally {
core.endGroup()
}
}

const isFailed = results.some(tr => tr.result === 'failed')
Expand All @@ -120,13 +125,13 @@ class TestReporter {

async createReport(parser: TestParser, name: string, files: FileContent[]): Promise<TestRunResult[]> {
if (files.length === 0) {
core.error(`${name}: No file matches path ${this.path}`)
core.warning(`No file matches path ${this.path}`)
return []
}

const results: TestRunResult[] = []
for (const {file, content} of files) {
core.info(`Processing test report '${file}'`)
core.info(`Processing test results from ${file}`)
const tr = await parser.parse(file, content)
results.push(tr)
}
Expand All @@ -142,8 +147,8 @@ class TestReporter {
const conclusion = isFailed ? 'failure' : 'success'
const icon = isFailed ? Icon.fail : Icon.success

core.info(`Creating check run '${name}' with conclusion '${conclusion}'`)
await this.octokit.checks.create({
core.info(`Creating check run with conclusion ${conclusion}`)
const resp = await this.octokit.checks.create({
head_sha: this.context.sha,
name,
conclusion,
Expand All @@ -155,6 +160,7 @@ class TestReporter {
},
...github.context.repo
})
core.info(`Check run create response: ${resp.status} - ${resp.url}`)

return results
}
Expand Down

0 comments on commit 09d1ac9

Please sign in to comment.