rails-templates
rails-templates copied to clipboard
[#350] Fix: Danger cannot find the coverage data on Github review code workflow
- Close #350
What happened 👀
The Danger cannot find the coverage data on the Github Review Code
workflow as it runs on a separate workflow from the Test
workflow where the coverage data is generated.
So this PR fixes the issue by
- Move the code review job into the
Test
workflow - Upload the coverage data to the artifact after the
Unit Test
job is completed - Download the coverage data and run the Danger command
Then after the Danger command can run there's another issue about getting the output from Danger, it seems like it was trying to call the message
method from the wrong place (the full log can be found on a public repo where I test it)
So I added the workaround on Dangerfile
by copying the report method but using the markup
method to output the message instead
Insight 📝
⚠️ The Danger Undercover is also using the message
method so the same issue happens, it only log the output but does NOT add it to comment
What we've tried so far on the EWA project is to use wait-on-check action to wait for the Test
workflow to finish before running the Review Code
workflow but it'll double the cost of the GitHub workflow as the Test
and Review Code
workflow will run parallelly until the unit test job inside Test
workflow is done
Proof Of Work 📹
I opened a public repository with a test PR with the updated workflow and files, Danger works
In case the Test
job fails, the Review Code
job also fail
with this message
@carryall I just pushed a small fix so that the tests are passing again (see 9763ba7).
Please git pull
on your machine before addressing any change ;-)
@carryall should we update it as in EWA-Payroll as in the end, we had some issues with the code coverage when not run in the same workflow as the tests...? 🤔