Skip to content

Commit 20c1c88

Browse files
greathongtuHongtu Zhang (FA Talent)
andauthored
analyze cmdlets differences (#20460)
* Set up first CI try with Azure Pipelines description here! [skip ci] * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * commit me * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * remove test yml * fresh new branch * fresh new branch * Add new static analysis phase * fix md name * change PipelineReult json * change PipelineReult json * Set moduleInfo.Status to Succeeded --------- Co-authored-by: Hongtu Zhang (FA Talent) <[email protected]>
1 parent e954245 commit 20c1c88

File tree

8 files changed

+1001
-52
lines changed

8 files changed

+1001
-52
lines changed

.ci-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@
114114
"signature:module",
115115
"test:dependence-module",
116116
"file-change:module",
117-
"ux:module"
117+
"ux:module",
118+
"cmdlet-diff:module"
118119
]
119120
},
120121
{

tools/BuildPackagesTask/Microsoft.Azure.Build.Tasks/CIFilterTask.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class CIFilterTask : Task
7070

7171
private const string BUILD_PHASE = "build";
7272
private const string TEST_PHASE = "test";
73-
private readonly List<string> ANALYSIS_PHASE_LIST = new List<string>() { "breaking-change", "help-example", "help", "dependency", "signature", "file-change", "ux" };
73+
private readonly List<string> ANALYSIS_PHASE_LIST = new List<string>() { "breaking-change", "help-example", "help", "dependency", "signature", "file-change", "ux", "cmdlet-diff" };
7474
private const string ACCOUNT_MODULE_NAME = "Accounts";
7575

7676
private const string MODULE_NAME_PLACEHOLDER = "ModuleName";
@@ -173,7 +173,7 @@ private List<string> GetSelectedModuleList()
173173
private List<string> GetTestCsprojList(string moduleName, Dictionary<string, string[]> csprojMap)
174174
{
175175
return GetRelatedCsprojList(moduleName, csprojMap)
176-
.Where(x => x.Contains("Test")).ToList();;
176+
.Where(x => x.Contains("Test")).ToList();
177177
}
178178

179179
private bool ProcessTargetModule(Dictionary<string, string[]> csprojMap)
@@ -196,7 +196,7 @@ private bool ProcessTargetModule(Dictionary<string, string[]> csprojMap)
196196
Console.WriteLine("--------------------------------------------------------");
197197

198198
FilterTaskResult.PhaseInfo = influencedModuleInfo;
199-
199+
200200
return true;
201201
}
202202

@@ -388,7 +388,7 @@ private bool ProcessFileChanged(Dictionary<string, string[]> csprojMap)
388388
influencedModuleInfo = CalculateCsprojForBuildAndTest(influencedModuleInfo, csprojMap);
389389
DateTime endTime = DateTime.Now;
390390
Console.WriteLine(string.Format("Takes {0} seconds for RE match, {1} seconds for phase config.", (endOfRegularExpressionTime - startTime).TotalSeconds, (endTime - endOfRegularExpressionTime).TotalSeconds));
391-
391+
392392
FilterTaskResult.PhaseInfo = influencedModuleInfo;
393393

394394
if (!Directory.Exists(config.ArtifactPipelineInfoFolder))

tools/ExecuteCIStep.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Param(
5050
[Switch]
5151
$StaticAnalysisUX,
5252

53+
[Switch]
54+
$StaticAnalysisCmdletDiff,
55+
5356
[String]
5457
$RepoArtifacts='artifacts',
5558

@@ -239,6 +242,7 @@ If ($StaticAnalysis)
239242
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisSignature @Parameters
240243
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisHelp @Parameters
241244
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisUX @Parameters
245+
.("$PSScriptRoot/ExecuteCIStep.ps1") -StaticAnalysisCmdletDiff @Parameters
242246
Return
243247
}
244248

@@ -331,3 +335,21 @@ If ($StaticAnalysisUX)
331335
}
332336
Return
333337
}
338+
339+
If ($StaticAnalysisCmdletDiff)
340+
{
341+
If ($PSBoundParameters.ContainsKey("TargetModule"))
342+
{
343+
$CmdletDiffModuleList = $TargetModule
344+
}
345+
Else
346+
{
347+
$CmdletDiffModuleList = Join-String -Separator ';' -InputObject $CIPlan.'cmdlet-diff'
348+
}
349+
If ("" -Ne $CmdletDiffModuleList)
350+
{
351+
Write-Host "Running static analysis for cmdlet diff..."
352+
dotnet $RepoArtifacts/StaticAnalysis/StaticAnalysis.Netcore.dll -p $RepoArtifacts/$Configuration -r $StaticAnalysisOutputDirectory --analyzers cmdlet-diff -u -m $CmdletDiffModuleList
353+
}
354+
Return
355+
}

tools/PipelineResultTemplate.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
"Details": [
3636
]
3737
},
38+
"cmdlet-diff": {
39+
"PhaseName": "Cmdlet Diff Check",
40+
"Order": 7,
41+
"Details": [
42+
]
43+
},
3844
"test": {
3945
"PhaseName": "Test",
4046
"Order": 100,

0 commit comments

Comments
 (0)