Skip to content

Commit

Permalink
Optimizing the performance of CoveragePublisher for all scenarios (#1…
Browse files Browse the repository at this point in the history
…8281)

* Updated TestAgent version from 2.205.0 to 2.210.0

* Optimize the performance of the CoveragePublisher

* Added binaries for linux and macos agents
  • Loading branch information
vinayakmsft authored Jun 9, 2023
1 parent 3a0ab37 commit 7acfb8e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
30 changes: 25 additions & 5 deletions Tasks/Common/coveragepublisher/coveragepublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import * as UUID from 'uuid/v4';
import {execSync} from 'child_process';

export async function PublishCodeCoverage(inputFiles: string[], sourceDirectory?: string) {
var reportDirectory = path.join(getTempFolder(), UUID());
Expand All @@ -28,19 +29,38 @@ async function publishCoverage(inputFiles: string[], reportDirectory: string, pa
return false;
}

if (!dotnetPath && osvar === 'win32') {
if (osvar === 'win32') {
// use full .NET to execute
dotnet = taskLib.tool(path.join(__dirname, 'CoveragePublisher', 'CoveragePublisher.Console.exe'));
} else {
}
else if(osvar==='linux')
{
// use full .NET to execute
var filepath=path.join(__dirname, 'CoveragePublisher','linux-x64', 'CoveragePublisher.Console');
execSync('chmod +x '+filepath);
dotnet=taskLib.tool(filepath);
}
else if(osvar==='darwin')
{
// use full .NET to execute
var filepath=path.join(__dirname, 'CoveragePublisher', 'osx-x64', 'CoveragePublisher.Console');
execSync('chmod +x '+filepath);
dotnet=taskLib.tool(filepath);
}
else{
dotnet = taskLib.tool(dotnetPath);
dotnet.arg(path.join(__dirname, "CoveragePublisher", 'CoveragePublisher.Console.dll'));
}

dotnet.arg('"' + inputFiles.join('" "') + '"');
dotnet.arg('--reportDirectory ' + reportDirectory);
for (const inputFile of inputFiles) {
dotnet.arg(inputFile);
}
dotnet.arg('--reportDirectory');
dotnet.arg(reportDirectory);

if(!isNullOrWhitespace(pathToSources)) {
dotnet.arg('--sourceDirectory ' + pathToSources);
dotnet.arg('--sourceDirectory');
dotnet.arg(pathToSources);
}

try {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Common/coveragepublisher/make.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"externals": {
"archivePackages": [
{
"url": "https://coveragepublishers.blob.core.windows.net/coveragepublisher/19631413/CoveragePublisher.zip",
"url": "https://coveragepublishers.blob.core.windows.net/coveragepublisher/20071190/CoveragePublisher.zip",
"dest": "./"
}
]
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishCodeCoverageResultsV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 221,
"Minor": 223,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishCodeCoverageResultsV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 221,
"Minor": 223,
"Patch": 0
},
"demands": [],
Expand Down

0 comments on commit 7acfb8e

Please sign in to comment.