action-surefire-report icon indicating copy to clipboard operation
action-surefire-report copied to clipboard

Report shows failure of previous build

Open jameskleeh opened this issue 4 years ago • 6 comments

https://github.com/micronaut-projects/micronaut-core/runs/1118820767?check_suite_focus=true

This build failed once, then was re-executed and the test report shows the old failure. All builds passed and the test-report task was skipped in all cases.

jameskleeh avatar Sep 16 '20 16:09 jameskleeh

I noticed that you are not running the report if there is no failure: https://github.com/micronaut-projects/micronaut-core/blob/6e2f1d1b180ed56b31590e609503468c3e7c2490/.github/workflows/gradle.yml#L43. Maybe that's the case. Otherwise it would overwrite previous report with success.

jmisur avatar Sep 17 '20 11:09 jmisur

@jmisur Do you generally suggest to use always()? Thing is, I might add your awsome action to https://github.com/quarkusio/quarkus but the CI there is really heavy, with many jobs in one workflow. I'm thinking about adding a test report only if the mvn call failed (it fails on the first test failure).

famod avatar Mar 16 '21 11:03 famod

What I suggest is to decouple the test reporting from build process. So even if the build fails for any reason, you want to see the test reports (if any) anyway. So we prefer to set --fail-at-end or -Dmaven.test.failure.ignore=true to the build process itself so it doesn't stop at first failed test, but continues till the end and then report with this action. Sometimes projects are also misconfigured and no tests would run, then this action would fail because it would expect at least a single test.

jmisur avatar Mar 16 '21 14:03 jmisur

@jmisur Thanks for your answer. The key question I'm having whether the action must run always to have a consistent report for each run/build?

famod avatar Mar 16 '21 15:03 famod

It's preferable. Otherwise you don't know if the report matches the build. But of course rerun of the same commit shouldn't change anything (unless you have flaky tests).

jmisur avatar Mar 23 '21 20:03 jmisur

https://github.com/ScaCap/action-surefire-report/pull/81 should also help here

nineinchnick avatar Dec 26 '22 11:12 nineinchnick