-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
153 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/bin/** | ||
**/obj/** | ||
**/*.cobertura* | ||
node_modules |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const core = require("@actions/core"); | ||
const exec = require("@actions/exec"); | ||
|
||
async function run() { | ||
try { | ||
// Get inputs | ||
const project = core.getInput("project"); | ||
const excludeFiles = core.getInput("exclude-files"); | ||
const excludeModules = core.getInput("exclude-modules"); | ||
const threshold = core.getInput("threshold"); | ||
const dotnetVersion = core.getInput("dotnet-version"); | ||
const workspace = process.env.GITHUB_WORKSPACE; | ||
|
||
// Define Docker image name | ||
const imageName = `mcr.microsoft.com/dotnet/sdk:${dotnetVersion}`; | ||
|
||
// Run the Docker container with the environment variables passed in | ||
// prettier-ignore | ||
await exec.exec('docker', [ | ||
'run', | ||
'--rm', | ||
'-v ', `${workspace}:/workspace`, | ||
'-e', `UNIT_TEST_PROJECT=${project}`, | ||
'-e', `UNIT_TEST_EXCLUDE_FILES=${excludeFiles}`, | ||
'-e', `UNIT_TEST_EXCLUDE_MODULES=${excludeModules}`, | ||
'-e', `UNIT_TEST_COVERAGE_THRESHOLD=${threshold}`, | ||
'-w', '/workspace', | ||
imageName, | ||
'bash -c', './src/test.sh', project | ||
]); | ||
|
||
// Optionally, set an output for the action (e.g., path to coverage report) | ||
core.setOutput("coverage-report-path", `/workspace/${project}/report`); | ||
} catch (error) { | ||
core.setFailed(`Action failed with error: ${error.message}`); | ||
} | ||
} | ||
|
||
run(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "dotnet-test-coverlet", | ||
"version": "1.0.0", | ||
"description": "This reusable action runs unit tests on a .NET project and generates a code coverage report. It supports configuration for custom test project paths, exclusion of files and modules from coverage, and setting a coverage threshold.", | ||
"main": "index.js", | ||
"directories": { | ||
"doc": "docs", | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@actions/core": "^1.10.1", | ||
"@actions/exec": "^1.1.1" | ||
} | ||
} |