Closed Synertry closed 1 year ago
@Synertry Would you mind reviewing the documentation once again? The coverageLocations
should be of the form <location>:<type>
.
So it should look like this –
coverageLocations: |
${{github.workspace}}/*.lcov:lcov
or –
coverageLocations: ${{github.workspace}}/target/site/jacoco/jacoco.xml:jacoco
I tried it with:
coverageLocations: ${{ github.workspace }}/coverage.out:gocov
coverageLocations: ${{ github.workspace }}/coverage.out:Cover
for the coverage from go, but it fails while trying to open one of the main files:
/home/runner/work/RushDevsDailyGo/RushDevsDailyGo/cc-reporter format-coverage /home/runner/work/RushDevsDailyGo/RushDevsDailyGo/coverage.out -t gocov -o codeclimate.0.json
Error: time="2022-10-25T08:36:44Z" level=error msg="failed to read file github.com/Synertry/RushDevsDailyGo/Daily/0001.intersection/intersection.go\nopen github.com/Synertry/RushDevsDailyGo/Daily/0001.intersection/intersection.go: no such file or directory"
/home/runner/work/_actions/paambaati/codeclimate-action/v3.2.0/node_modules/@actions/exec/lib/toolrunner.js:592
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
^
Error: The process '/home/runner/work/RushDevsDailyGo/RushDevsDailyGo/cc-reporter' failed with exit code 255
at ExecState._setResult (/home/runner/work/_actions/paambaati/codeclimate-action/v3.2.0/node_modules/@actions/exec/lib/toolrunner.js:592:25)
at ExecState.CheckComplete (/home/runner/work/_actions/paambaati/codeclimate-action/v3.2.0/node_modules/@actions/exec/lib/toolrunner.js:575:18)
at ChildProcess.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v3.2.0/node_modules/@actions/exec/lib/toolrunner.js:469:27)
at ChildProcess.emit (node:events:[390](https://github.com/Synertry/RushDevsDailyGo/actions/runs/3319369312/jobs/5484454487#step:9:391):28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
Error: Error: open github.com/Synertry/RushDevsDailyGo/Daily/0001.intersection/intersection.go: no such file or directory
Usage:
cc-test-reporter format-coverage [coverage file] [flags]
Flags:
--add-prefix string add this prefix to file paths
-t, --input-type string type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov]
-o, --output string output path (default "coverage/codeclimate.json")
-p, --prefix string the root directory where the coverage analysis was performed (default "/home/runner/work/RushDevsDailyGo/RushDevsDailyGo")
Global Flags:
-d, --debug run in debug mode
Error: The process '/home/runner/work/RushDevsDailyGo/RushDevsDailyGo/cc-reporter' failed with exit code 255
Error: 🚨 CC Reporter coverage formatting failed!
It is unfortunately not really clear which type I have to use for Go. The main docs states Cover which the cli does not support, but in contrary has a suggestive gocov
.
I would recommend you follow the documentation and try to run the reporter locally, and see if it can parse and process the coverage output correctly.
This action is just a simple wrapper to the reporter, and this error is coming from the reporter itself and not the action; unfortunately, I’m not a Go expert either, so I’m afraid I can’t help here.
Here’s where I’d start —
Took the third step to heart and quickly set up a Docker instance for testing.
The format is gocov
, but more importantly I was missing the prefix.
Final working config for Golang:
- name: Generate Code Coverage & report to Codeclimate
uses: paambaati/codeclimate-action@v3.2.0
env:
# Set CC_TEST_REPORTER_ID as secret of your repo
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
# The report file must be there, otherwise Code Climate won't find it
coverageCommand: go test -v -race -vet off -covermode atomic -coverprofile coverage.out ./Daily/...
coverageLocations: ${{ github.workspace }}/coverage.out:gocov
prefix: github.com/Synertry/RushDevsDailyGo
Thank you for your time and help + awesome Github action!👍💯
Describe the bug The action errors after generating the coverage with:
Version of
codeclimate-action
you're usingv3.2.0
Example links
Configure your job to include the
debug: true
flag and theACTIONS_STEP_DEBUG
secret totrue
so I can get additional debugging information. Both enabled, but enabling ACTIONS_STEP_DEBUG secret does not show more useful info at all.Include links to the specific Github action run and your config. https://github.com/Synertry/RushDevsDailyGo/actions/runs/3307664720/jobs/5459463366
Expected behavior Finishing the step by uploading the coverage without errors
Additional context Step configuration: