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

Coverage report doesn't appear on the Overview tab #42

Closed
Finesse opened this issue Oct 26, 2019 · 34 comments · Fixed by #43
Closed

Coverage report doesn't appear on the Overview tab #42

Finesse opened this issue Oct 26, 2019 · 34 comments · Fixed by #43
Assignees
Labels
bug Something isn't working

Comments

@Finesse
Copy link

Finesse commented Oct 26, 2019

I've set up a GitHub Actions workflow to report my test code coverage to Code Climate. The workflow uses this action. As a result, the coverage report appears in the project settings:

image image

But doesn't appear on the Overview tab in Code Climate:

image

I've directed this issue to the Code Climate support, they said that the branch name (provided by this action) must me master instead of refs/heads/master.

The full conversation

Code Climate:

Hi Surgie,

Thanks for reaching out! Happy to help and point you in the right direction.

I haven't seen this GitHub Action before -- pretty cool! I'm not sure how to make changes to the GitHub Action to make this work for you, but here's what we see on our side:

On the backend, I do see that we're successfully receiving payloads for this repo (last commit f40b844b); however, they each identify your master branch as:

refs/heads/master

To help resolve this error, we generally recommend making the path above ^^ relative to the project root.

  • You can do this by adding the --prefix flag to your to your CI's coverage configuration.
  • More information is in our docs here.
  • It should look something like --prefix /[path to directory]

This removes absolute paths in coverage payloads to make them relative to the project root. This is usually the directory in which the tests were run.

(You could also instruct your test setup to start at the root of your project.)

Again, I'm not sure how to make the above work with the GitHub Action. You might need to open an issue with the maintainer on the project itself: https://github.com/paambaati/codeclimate-action/issues

-> Once you've made changes to your setup, could you try pushing a brand new commit to master?

Let me know if you have any questions, or if there's anything else I can help with. I'll be standing by to help further.

Thanks,
Emily

I:

Hi!

I used the same PhpUnit setup and CLI command with a plain cc-test-reporter command in another repository and it worked fine. Also the reported coverage is shown in the Code section but not in the Overview section.

Will the problem be solved if my action sends the same report but with branch master instead of refs/heads/master?

I’ll make an issue in the action repository and attach our conversation.

Code Climate:

Hi Surgie,

Thanks for the additional info.

Will the problem be solved if my action sends the same report but with branch master instead of refs/heads/master?

Yes! That should do the trick 👌

Let me know once you're able to get that working! I'd love to make some notes for troubleshooting for anyone else who runs into the same.

Thanks,
Emily

PS: I couldn't find the output for the coverage info it in your Workflow logs, but I did some branch name troubleshooting earlier with another GitHub Workflow user.
his setup reported branch names to be HEAD
and I recommended this stackflow conversation

(here's the coverage-related Workflow logs from the other user)

Please also consider that a branch can have a slash in its name, e.g. a gitflow-style branch feature/name.

@paambaati
Copy link
Owner

@Finesse Thanks for the detailed report. Let me debug this; I’ll try to ship a fix this weekend.

paambaati added a commit that referenced this issue Oct 27, 2019
This should get the coverage to show up in the 'Overview' tab and fix #42.
@paambaati
Copy link
Owner

@Finesse Do you mind testing my fix? You can use the branch branch-name-fix-42.

In your Actions YML, simply replace uses: paambaati/codeclimate-action@v2.2.1 with uses: paambaati/codeclimate-action@branch-name-fix-42

@Finesse
Copy link
Author

Finesse commented Oct 27, 2019

@paambaati
Copy link
Owner

Looks like using the branch doesn’t work. Let me merge this and you can perhaps try master.

@Finesse
Copy link
Author

Finesse commented Oct 27, 2019

@paambaati I think this is not the reason. Your action.yml points to lib/main.js while this file doesn't exist in the repository.

@paambaati paambaati reopened this Oct 27, 2019
@paambaati
Copy link
Owner

@Finesse lib/main.js is generated during build, so that isn't an issue.

I just pushed a new release (v2.2.2) with the fix. Can you try that and let me know if it works?

@Finesse
Copy link
Author

Finesse commented Oct 27, 2019

@paambaati
Copy link
Owner

@Finesse Sorry for the back and forth! Can you try release v2.2.3?

@Finesse
Copy link
Author

Finesse commented Oct 27, 2019

paambaati added a commit to paambaati/websight that referenced this issue Oct 27, 2019
@paambaati
Copy link
Owner

@Finesse Can you try v2.2.4?

@Finesse
Copy link
Author

Finesse commented Oct 27, 2019

paambaati added a commit that referenced this issue Oct 29, 2019
>
> Becase this is causing a lot of weird issues (see #42).
@paambaati
Copy link
Owner

@Finesse I've entirely removed the dependency causing this issue. Can you try v2.2.5?

@Finesse
Copy link
Author

Finesse commented Oct 29, 2019

@paambaati
Copy link
Owner

@Finesse Sorry this is taking a lot of time, but can you now try v2.2.6?

@paambaati paambaati self-assigned this Oct 29, 2019
@paambaati paambaati added the bug Something isn't working label Oct 29, 2019
@Finesse
Copy link
Author

Finesse commented Oct 29, 2019

@paambaati Fails with another error: https://github.com/Finesse/SwiftMailerDefaultsPlugin/runs/278808824#step:5:6

@vinicius33
Copy link

Hey guys,
I'm having the same issue. @paambaati let me know if I can help you somehow.

Thanks!

@paambaati
Copy link
Owner

For now, I'd recommend sticking to v2.2.1. I'm still not sure what's causing this problem, so @vinicius33, if you can try to include more debug steps to the latest master and help with a root-cause, I'd appreciate it a lot!

@vinicius33
Copy link

vinicius33 commented Oct 30, 2019

TBH @paambaati, it seems that everything's alright now. However, for some reason, lib/main.js isn't being built when you publish the action to the store.
I'd assume that something went wrong with your release workflow. Perhaps this action was the problem ?

@paambaati
Copy link
Owner

@vinicius33 That action actually does build lib/main.js - see https://github.com/paambaati/codeclimate-action/blob/gh-actions/lib/main.js

It pushes the actual release output to the gh-actions branch.

@vinicius33
Copy link

@paambaati I see... that's weird. Maybe a new release might help?

@vinicius33
Copy link

@vinicius33 That action actually does build lib/main.js - see https://github.com/paambaati/codeclimate-action/blob/gh-actions/lib/main.js

It pushes the actual release output to the gh-actions branch.

@paambaati it seems like the latest commit for this file was 2 days ago. 🤔

@paambaati
Copy link
Owner

@vinicius33 Only because the last release (see #42 (comment)) was 2 days ago.

@paambaati
Copy link
Owner

@Finesse @vinicius33 Can you retest v2.6.6? I just pushed out the same release again, and it seems to work.

@Finesse
Copy link
Author

Finesse commented Oct 31, 2019

@paambaati It doesn't fail: https://github.com/Finesse/SwiftMailerDefaultsPlugin/runs/282740248#step:5:0

But the branch name still has refs/heads/

image

@paambaati
Copy link
Owner

@Finesse Phew, at least we're able to proceed now.

Can you re-run it? I just pushed v2.2.6 again with another fix.

@Finesse
Copy link
Author

Finesse commented Oct 31, 2019

@paambaati The same:

image

BTW, could you please add an action parameter to turn on/off the Code Climate debug? It will add additional information for Code Climate support:

To get additional output in the logs (essentially, see what's sent in the coverage payload), you can:

  • add the --debug flag to your CI config

For the ​debug option:

  1. If you're running your tests in single builds, use after-build --debug.
  2. For multiple or parallel tests, please use both format-coverage --debug and upload-coverage --debug.

@Finesse
Copy link
Author

Finesse commented Oct 31, 2019

The regexp must be /^refs\/heads\// instead of /^refs\/head\//

@paambaati
Copy link
Owner

The regexp must be /^refs/heads// instead of /^refs/head//

@Finesse I just realized that! Let me do that first.

BTW, could please add an action parameter to turn on/off the Code Climate debug?

Doable, let me include that too in the next release.

paambaati added a commit that referenced this issue Oct 31, 2019
@paambaati
Copy link
Owner

@Finesse Can you try v2.3.0 now? It should fix this issue and also include --debug support.

The README is also updated with examples.

@Finesse
Copy link
Author

Finesse commented Oct 31, 2019

@paambaati The coverage has been successfully reported 🎉

But the debug option doesn't work: https://github.com/Finesse/SwiftMailerDefaultsPlugin/runs/282820415#step:5:4. Maybe you need to add it to action.yml.

@paambaati
Copy link
Owner

@Finesse Pushed v2.3.0 again. Can you try?

Finesse added a commit to Finesse/SwiftMailerDefaultsPlugin that referenced this issue Oct 31, 2019
@paambaati
Copy link
Owner

@Finesse Looks like it worked. Can I close this issue?

@Finesse
Copy link
Author

Finesse commented Oct 31, 2019

@paambaati I'm performing the final test on the master branch. I'll let you know when it finishes.

@Finesse
Copy link
Author

Finesse commented Oct 31, 2019

@paambaati Everything looks good: PR auto comment, debug information and the Overview tab. The issue can be closed.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants