Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve output to match build system #3430

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions AppHandling/Compile-AppInNavContainer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ function Compile-AppInBcContainer {
[switch] $CopyAppToSymbolsFolder,
[ValidateSet('Yes','No','NotSpecified')]
[string] $GenerateReportLayout = 'NotSpecified',
[switch] $AzureDevOps,
[switch] $gitHubActions,
[switch] $AzureDevOps = $bcContainerHelperConfig.IsAzureDevOps,
[switch] $gitHubActions = $bcContainerHelperConfig.IsGitHubActions,
[switch] $EnableCodeCop,
[switch] $EnableAppSourceCop,
[switch] $EnablePerTenantExtensionCop,
Expand Down
2 changes: 1 addition & 1 deletion AppHandling/Convert-ALCOutputToAzureDevOps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Function Convert-AlcOutputToDevOps {
[Parameter(Position=1)]
[ValidateSet('none','error','warning')]
[string] $FailOn,
[switch] $gitHubActions,
[switch] $gitHubActions = $bcContainerHelperConfig.IsGitHubActions,
[switch] $doNotWriteToHost,
[string] $basePath = ''
)
Expand Down
98 changes: 49 additions & 49 deletions AppHandling/Run-AlPipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ Param(
[switch] $installPerformanceToolkit,
[switch] $CopySymbolsFromContainer,
[switch] $UpdateDependencies,
[switch] $azureDevOps,
[switch] $gitLab,
[switch] $gitHubActions,
[switch] $azureDevOps = $bcContainerHelperConfig.IsAzureDevOps,
[switch] $gitLab = $bcContainerHelperConfig.IsGitLab,
[switch] $gitHubActions = $bcContainerHelperConfig.IsGitHubActions,
[ValidateSet('none','error','warning')]
[string] $failOn = "none",
[switch] $treatTestFailuresAsWarnings,
Expand Down Expand Up @@ -464,12 +464,12 @@ function GetInstalledAppIds {
else {
$installedApps = @()
}
Write-Host "::group::Installed Apps"
Write-GroupStart -Message "Installed Apps"
$installedApps | ForEach-Object {
Write-Host "- $($_.AppId):$($_.Name)"
"$($_.AppId)"
}
Write-Host "::endgroup::"
Write-GroupEnd
}

$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
Expand Down Expand Up @@ -646,7 +646,7 @@ else {

$escapeFromCops = $escapeFromCops -and ($enableCodeCop -or $enableAppSourceCop -or $enableUICop -or $enablePerTenantExtensionCop)

if ($gitHubActions) { Write-Host "::group::Parameters" }
Write-GroupStart -Message "Parameters"
Write-Host -ForegroundColor Yellow @'
_____ _
| __ \ | |
Expand Down Expand Up @@ -902,14 +902,14 @@ else {
if ($InstallMissingDependencies) {
Write-Host -ForegroundColor Yellow "InstallMissingDependencies override"; Write-Host $InstallMissingDependencies.ToString()
}
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd

$signApps = ($codeSignCertPfxFile -ne "")

Measure-Command {

if ( $artifactUrl -and !$reUseContainer -and !$doNotPublishApps -and !$filesOnly) {
if ($gitHubActions) { Write-Host "::group::Pulling generic image" }
Write-GroupStart -Message "Pulling generic image"
Measure-Command {
Write-Host -ForegroundColor Yellow @'

Expand All @@ -935,7 +935,7 @@ Write-Host "Pulling $useGenericImage"

Invoke-Command -ScriptBlock $DockerPull -ArgumentList $useGenericImage
} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nPulling generic image took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}

$err = $null
Expand All @@ -948,7 +948,7 @@ try {
$testCountry = $_.Trim()
$testToolkitInstalled = $false

if ($gitHubActions) { Write-Host "::group::Creating container" }
Write-GroupStart -Message "Creating container"
Write-Host -ForegroundColor Yellow @'

_____ _ _ _ _
Expand Down Expand Up @@ -1082,9 +1082,9 @@ Measure-Command {
}

} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nCreating container took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd

if ($gitHubActions) { Write-Host "::group::Resolving dependencies" }
Write-GroupStart -Message "Resolving dependencies"
Write-Host -ForegroundColor Yellow @'

_____ _ _ _ _ _
Expand Down Expand Up @@ -1161,10 +1161,10 @@ if ($previousApps) {
}
}

if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd

if ($installApps) {
if ($gitHubActions) { Write-Host "::group::Installing apps" }
Write-GroupStart -Message "Installing apps"
Write-Host -ForegroundColor Yellow @'

_____ _ _ _ _
Expand Down Expand Up @@ -1252,7 +1252,7 @@ Measure-Command {
}

} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nInstalling apps took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}

if ($InstallMissingDependencies) {
Expand All @@ -1263,7 +1263,7 @@ $Parameters = @{
$installedAppIds = @(GetInstalledAppIds -useCompilerFolder $useCompilerFolder -filesOnly $filesOnly -compilerFolder $compilerFolder -packagesFolder $packagesFolder -Parameters $Parameters)
$missingAppDependencies = @($missingAppDependencies | Where-Object { $installedAppIds -notcontains $_ })
if ($missingAppDependencies) {
if ($gitHubActions) { Write-Host "::group::Installing app dependencies" }
Write-GroupStart -Message "Installing app dependencies"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _ _
|_ _| | | | | (_) | | | | (_)
Expand Down Expand Up @@ -1298,12 +1298,12 @@ Measure-Command {
}
Invoke-Command -ScriptBlock $InstallMissingDependencies -ArgumentList $Parameters
} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nInstalling app dependencies took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}
}

if ((($testCountry) -or !($appFolders -or $testFolders -or $bcptTestFolders)) -and !$doNotPublishApps -and ($installTestRunner -or $installTestFramework -or $installTestLibraries -or $installPerformanceToolkit)) {
if ($gitHubActions) { Write-Host "::group::Importing test toolkit" }
Write-GroupStart -Message "Importing test toolkit"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _ _ _ _
|_ _| | | (_) | | | | | | | | | (_) |
Expand Down Expand Up @@ -1337,10 +1337,10 @@ Measure-Command {
}
Invoke-Command -ScriptBlock $ImportTestToolkitToBcContainer -ArgumentList $Parameters
} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nImporting Test Toolkit took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd

if ($installTestApps) {
if ($gitHubActions) { Write-Host "::group::Installing test apps" }
Write-GroupStart -Message "Installing test apps"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _
|_ _| | | | | (_) | | | |
Expand Down Expand Up @@ -1402,7 +1402,7 @@ Measure-Command {
}

} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nInstalling test apps took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}
}

Expand All @@ -1415,7 +1415,7 @@ $Parameters = @{
$installedAppIds = @(GetInstalledAppIds -useCompilerFolder $useCompilerFolder -filesOnly $filesOnly -compilerFolder $compilerFolder -packagesFolder $packagesFolder -Parameters $Parameters)
$missingTestAppDependencies = @($missingTestAppDependencies | Where-Object { $installedAppIds -notcontains $_ })
if ($missingTestAppDependencies) {
if ($gitHubActions) { Write-Host "::group::Installing test app dependencies" }
Write-GroupStart -Message "Installing test app dependencies"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _ _ _ _
|_ _| | | | | (_) | | | | | | | | (_)
Expand Down Expand Up @@ -1445,13 +1445,13 @@ Measure-Command {
}
Invoke-Command -ScriptBlock $InstallMissingDependencies -ArgumentList $Parameters
} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nInstalling testapp dependencies took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}
}

if (-not $testCountry) {
if ($appFolders -or $testFolders -or $bcptTestFolders) {
if ($gitHubActions) { Write-Host "::group::Compiling apps" }
Write-GroupStart -Message "Compiling apps"
Write-Host -ForegroundColor Yellow @'

_____ _ _ _
Expand Down Expand Up @@ -1481,8 +1481,8 @@ $sortedAppFolders+$sortedTestAppFolders | Select-Object -Unique | ForEach-Object
$app = $appFolders.Contains($folder)
if (($testApp -or $bcptTestApp) -and !$testToolkitInstalled -and !$doNotPublishApps -and ($installTestRunner -or $installTestFramework -or $installTestLibraries -or $installPerformanceToolkit)) {

if ($gitHubActions) { Write-Host "::endgroup::" }
if ($gitHubActions) { Write-Host "::group::Importing test toolkit" }
Write-GroupEnd
Write-GroupStart -Message "Importing test toolkit"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _ _ _ _
|_ _| | | (_) | | | | | | | | | (_) |
Expand Down Expand Up @@ -1519,8 +1519,8 @@ Measure-Command {
} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nImporting Test Toolkit took $([int]$_.TotalSeconds) seconds" }

if ($installTestApps) {
if ($gitHubActions) { Write-Host "::endgroup::" }
if ($gitHubActions) { Write-Host "::group::Installing test apps" }
Write-GroupEnd
Write-GroupStart -Message "Installing test apps"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _
|_ _| | | | | (_) | | | |
Expand Down Expand Up @@ -1583,7 +1583,7 @@ Measure-Command {

} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nInstalling test apps took $([int]$_.TotalSeconds) seconds" }
}
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd

if ($InstallMissingDependencies) {
$Parameters = @{
Expand All @@ -1593,7 +1593,7 @@ $Parameters = @{
$installedAppIds = @(GetInstalledAppIds -useCompilerFolder $useCompilerFolder -filesOnly $filesOnly -compilerFolder $compilerFolder -packagesFolder $packagesFolder -Parameters $Parameters)
$missingTestAppDependencies = @($missingTestAppDependencies | Where-Object { $installedAppIds -notcontains $_ })
if ($missingTestAppDependencies) {
if ($gitHubActions) { Write-Host "::group::Installing test app dependencies" }
Write-GroupStart -Message "Installing test app dependencies"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _ _ _ _
|_ _| | | | | (_) | | | | | | | | (_)
Expand Down Expand Up @@ -1623,11 +1623,11 @@ Measure-Command {
}
Invoke-Command -ScriptBlock $InstallMissingDependencies -ArgumentList $Parameters
} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nInstalling testapp dependencies took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}
}

if ($gitHubActions) { Write-Host "::group::Compiling test apps" }
Write-GroupStart -Message "Compiling test apps"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _
/ ____| (_) (_) | | | |
Expand Down Expand Up @@ -2086,10 +2086,10 @@ Write-Host -ForegroundColor Yellow @'
}
}
} | ForEach-Object { if ($appFolders -or $testFolders -or $bcptTestFolders) { Write-Host -ForegroundColor Yellow "`nCompiling apps$measureText took $([int]$_.TotalSeconds) seconds" } }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd

if ($signApps -and !$useDevEndpoint -and !$useCompilerFolder) {
if ($gitHubActions) { Write-Host "::group::Signing apps" }
Write-GroupStart -Message "Signing apps"
Write-Host -ForegroundColor Yellow @'
_____ _ _
/ ____(_) (_)
Expand All @@ -2115,15 +2115,15 @@ $apps | ForEach-Object {

}
} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nSigning apps took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}
}

$previousAppsInstalled = @()
if (!$useDevEndpoint) {

if ((!$doNotPerformUpgrade) -and ($previousApps)) {
if ($gitHubActions) { Write-Host "::group::Installing previous apps" }
Write-GroupStart -Message "Installing previous apps"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _
|_ _| | | | | (_) (_)
Expand Down Expand Up @@ -2168,11 +2168,11 @@ Measure-Command {
}

} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nInstalling apps took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}

if ((!$doNotPublishApps) -and ($apps+$testApps+$bcptTestApps)) {
if ($gitHubActions) { Write-Host "::group::Publishing apps" }
Write-GroupStart -Message "Publishing apps"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _
| __ \ | | | (_) | | (_)
Expand Down Expand Up @@ -2279,13 +2279,13 @@ $testApps+$bcptTestApps | ForEach-Object {
}

} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nPublishing apps took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}
}

if (!($doNotRunTests -and $doNotRunBcptTests)) {
if ($ImportTestDataInBcContainer) {
if ($gitHubActions) { Write-Host "::group::Importing test data" }
Write-GroupStart -Message "Importing test data"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _
|_ _| | | (_) | | | | | | | |
Expand Down Expand Up @@ -2324,13 +2324,13 @@ if (!$enableTaskScheduler) {
}
}
}
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}
$allPassed = $true
$resultsFile = Join-Path ([System.IO.Path]::GetDirectoryName($testResultsFile)) "$([System.IO.Path]::GetFileNameWithoutExtension($testResultsFile))$testCountry.xml"
$bcptResultsFile = Join-Path ([System.IO.Path]::GetDirectoryName($bcptTestResultsFile)) "$([System.IO.Path]::GetFileNameWithoutExtension($bcptTestResultsFile))$testCountry.json"
if (!$doNotRunTests -and (($testFolders) -or ($installTestApps))) {
if ($gitHubActions) { Write-Host "::group::Running tests" }
Write-GroupStart -Message "Running tests"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _
| __ \ (_) | | | |
Expand Down Expand Up @@ -2463,11 +2463,11 @@ if ($buildArtifactFolder -and (Test-Path $resultsFile)) {
Write-Host "Copying test results to output"
Copy-Item -Path $resultsFile -Destination $buildArtifactFolder -Force
}
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}

if (!$doNotRunBcptTests -and $bcptTestSuites) {
if ($gitHubActions) { Write-Host "::group::Running BCPT tests" }
Write-GroupStart -Message "Running BCPT tests"
Write-Host -ForegroundColor Yellow @'
_____ _ ____ _____ _____ _______ _ _
| __ \ (_) | _ \ / ____| __ \__ __| | | | |
Expand Down Expand Up @@ -2507,7 +2507,7 @@ if ($buildArtifactFolder -and (Test-Path $bcptResultsFile)) {
Write-Host "Copying bcpt test results to output"
Copy-Item -Path $bcptResultsFile -Destination $buildArtifactFolder -Force
}
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}

if (($gitLab -or $gitHubActions) -and !$allPassed) {
Expand All @@ -2519,7 +2519,7 @@ if (($gitLab -or $gitHubActions) -and !$allPassed) {
}

if ($buildArtifactFolder) {
if ($gitHubActions) { Write-Host "::group::Copy to build artifacts" }
Write-GroupStart -Message "Copy to build artifacts"
Write-Host -ForegroundColor Yellow @'
_____ _ _ _ _ _ _ _ __ _
/ ____| | | | | (_) | | | | | (_)/ _| | |
Expand Down Expand Up @@ -2594,7 +2594,7 @@ Write-Host "Files in build artifacts folder:"
Get-ChildItem $buildArtifactFolder -Recurse | Where-Object {!$_.PSIsContainer} | ForEach-Object { Write-Host "$($_.FullName.Substring($buildArtifactFolder.Length+1)) ($($_.Length) bytes)" }

} | ForEach-Object { Write-Host -ForegroundColor Yellow "`nCopying to Build Artifacts took $([int]$_.TotalSeconds) seconds" }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}

} catch {
Expand All @@ -2605,7 +2605,7 @@ finally {
}

if (!$keepContainer) {
if ($gitHubActions) { Write-Host "::group::Removing container" }
Write-GroupStart -Message "Removing container"
if (!($err)) {
Write-Host -ForegroundColor Yellow @'
_____ _ _ _
Expand Down Expand Up @@ -2643,7 +2643,7 @@ Measure-Command {
Invoke-Command -ScriptBlock $RemoveBcContainer -ArgumentList $Parameters
}
} | ForEach-Object { if (!($err)) { Write-Host -ForegroundColor Yellow "`nRemoving container took $([int]$_.TotalSeconds) seconds" } }
if ($gitHubActions) { Write-Host "::endgroup::" }
Write-GroupEnd
}

if ($warningsToShow) {
Expand Down
3 changes: 3 additions & 0 deletions BC.HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function Get-ContainerHelperConfig {
"MSAppsNuGetFeedUrl" = 'https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSApps/nuget/v3/index.json'
"TrustedNuGetFeeds" = @(
)
"IsGitHubActions" = [Boolean]$env:GITHUB_ACTIONS
"IsAzureDevOps" = [Boolean]$env:TF_BUILD
"IsGitLab" = [Boolean]$env:GITLAB_CI
}

if ($isInsider) {
Expand Down