Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract test results when there are failures #76

Open
LouisCAD opened this issue Mar 2, 2023 · 5 comments
Open

Extract test results when there are failures #76

LouisCAD opened this issue Mar 2, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@LouisCAD
Copy link

LouisCAD commented Mar 2, 2023

Hello,

When tests fail in CI, here's what I get:

* What went wrong:
Execution failed for task ':module:allTests'.
> There were failing tests. See the report at: file:///home/runner/work/user/project/module/build/reports/tests/allTests/index.html

This is so unhelpful as the runner deletes everything on exit, and you won't find the test failure report in the Gradle scan…

Can you extract the containing directory as a downloadable GitHub Action run artifact if it has files, so that we can actually find out why the tests failed in CI?

I find it hard to believe that I'd be the first one encountering this issue, but I'll accept the truth.

Thank you and have a great day!

Louis CAD

@LouisCAD LouisCAD changed the title Extract test results Extract test results when there are failures Mar 2, 2023
@tbroyer
Copy link

tbroyer commented Mar 3, 2023

I use something similar to the following in my workflows:

      - name: Store reports
        if: failure()
        uses: actions/upload-artifact@v3
        with:
          name: reports
          path: |
            **/build/reports/
            **/build/test-results/

See https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions

Note that the name is important if you have more than one Gradle invocation in the whole workflow (e.g. in a matrix build).
Also, what if you setup Gradle using the action, then run Gradle twice, e.g., with different project properties, in the same job; how should the gradle-build-action archive those? Under which names?
Should it archive only on failure? It's sometimes useful to check successful reports to see which tests were ignored and which were run.

To me, that's not the role of the gradle-build-action to do that, or that'll require it to be much more complex, if only in configurability.

@bigdaz bigdaz added the enhancement New feature or request label Mar 30, 2023
@bigdaz
Copy link
Member

bigdaz commented Mar 30, 2023

Related to gradle/gradle-build-action#98

@hfhbd
Copy link
Contributor

hfhbd commented May 15, 2023

Is this Kotlin MPP specific? Build scans contain JUnit test results.

@hartmut-co-uk
Copy link

PS: There are other OSS actions available already, maybe it's sufficient to provide references?

(there may be others...)

@oleg-nenashev
Copy link
Member

I think it would be nice to at least document the solution

@bigdaz bigdaz reopened this Mar 11, 2024
@bigdaz bigdaz transferred this issue from gradle/gradle-build-action Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants