Skip to content

Commit

Permalink
add support for cov-file-path
Browse files Browse the repository at this point in the history
  • Loading branch information
mrblackus committed Feb 9, 2024
1 parent 286789e commit 8276ca0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions action.yml
Expand Up @@ -49,6 +49,10 @@ inputs:
description: 'Override the whole go test call with a custom command. Useful when using a custom script or make rule.'
required: false
default: ''
cov-file-path:
descripton: 'Path where the .cov file will be written when using coverage-cmd input'
required: false
default: ''

outputs:
report-pathname:
Expand Down
10 changes: 10 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions index.js
Expand Up @@ -136,8 +136,18 @@ async function runCoverage(gocovPathname) {

// If we have an explicit command to run, use that and return
if (coverCmd) {
const covFilePath = core.getInput('cov-file-path');
if (!covFilePath) {
core.setFailed('cov-file-path is required when using coverage-cmd');
}

const args = coverCmd.split(/\s+/);
await exec(args[0], args.slice(1));

// Move the coverage file to the expected location so the next part
// will pick it up
await exec('mv', [covFilePath, gocovPathname])

return;
}

Expand Down

0 comments on commit 8276ca0

Please sign in to comment.