Skip to content

Commit

Permalink
Deploying AL-Go from main (ad7ba196b05948c0f3522a1dea60916df5169f00) …
Browse files Browse the repository at this point in the history
…to main (#31)

Deploying AL-Go from main (ad7ba196b05948c0f3522a1dea60916df5169f00) to
main

Co-authored-by: microsoft <[email protected]>
  • Loading branch information
bcbuild-github-agent and microsoft authored Jan 22, 2024
1 parent 01dd9f9 commit 202378c
Show file tree
Hide file tree
Showing 68 changed files with 2,236 additions and 1,020 deletions.
361 changes: 223 additions & 138 deletions AL-Go-Helper.ps1

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions AL-Go-TestRepoHelper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ function Test-Property {
$exists = $json.Keys -contains $key
if ($exists) {
if ($maynot) {
throw "Property '$key' may not exist in $settingsDescription"
OutputError "Property '$key' may not exist in $settingsDescription. See https://aka.ms/algosettings#$key"
}
elseif ($shouldnot) {
Write-Host "::Warning::Property '$key' should not exist in $settingsDescription"
OutputWarning -Message "Property '$key' should not exist in $settingsDescription. See https://aka.ms/algosettings#$key"
}
}
else {
if ($must) {
throw "Property '$key' must exist in $settingsDescription"
OutputError "Property '$key' must exist in $settingsDescription. See https://aka.ms/algosettings#$key"
}
elseif ($should) {
Write-Host "::Warning::Property '$key' should exist in $settingsDescription"
OutputWarning -Message "Property '$key' should exist in $settingsDescription. See https://aka.ms/algosettings#$key"
}
}
}
Expand All @@ -38,7 +38,7 @@ function Test-Shell {
if ($json.Keys -contains $property) {
$shell = $json.$property
if ($shell -ne 'powershell' -and $shell -ne 'pwsh') {
throw "$property is '$shell', must be 'powershell' or 'pwsh' in $settingsDescription"
OutputError "$property is '$shell', must be 'powershell' or 'pwsh' in $settingsDescription. See https://aka.ms/algosettings#$property"
}
}
}
Expand Down Expand Up @@ -89,15 +89,15 @@ function Test-JsonStr {
)

if ($jsonStr -notlike '{*') {
throw "Settings in $settingsDescription is not recognized as JSON (does not start with '{'))"
OutputError "Settings in $settingsDescription is not recognized as JSON (does not start with '{'))"
}

try {
$json = $jsonStr | ConvertFrom-Json | ConvertTo-HashTable
Test-SettingsJson -json $json -settingsDescription $settingsDescription -type:$type
}
catch {
throw "$($_.Exception.Message.Replace("`r",'').Replace("`n",' '))"
OutputError "$($_.Exception.Message.Replace("`r",'').Replace("`n",' ')) in $settingsDescription"
}

}
Expand All @@ -121,13 +121,13 @@ function TestRunnerPrerequisites {
invoke-gh version
}
catch {
Write-Host "::Warning::GitHub CLI is not installed"
OutputWarning -Message "GitHub CLI is not installed"
}
try {
invoke-git version
}
catch {
Write-Host "::Warning::Git is not installed"
OutputWarning -Message "Git is not installed"
}
}

Expand Down
11 changes: 3 additions & 8 deletions AddExistingApp/AddExistingApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Param(
[string] $url,
[Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)]
[string] $updateBranch,
[Parameter(HelpMessage = "Direct Commit (Y/N)", Mandatory = $false)]
[Parameter(HelpMessage = "Direct Commit?", Mandatory = $false)]
[bool] $directCommit
)

Expand Down Expand Up @@ -82,12 +82,7 @@ $telemetryScope = $null

try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
$branch = ''
if (!$directcommit) {
# If not direct commit, create a new branch with name, relevant to the current date and base branch, and switch to it
$branch = "add-existing-app/$updateBranch/$((Get-Date).ToUniversalTime().ToString(`"yyMMddHHmmss`"))" # e.g. add-existing-app/main/210101120000
}
$serverUrl = CloneIntoNewFolder -actor $actor -token $token -branch $branch
$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'add-existing-app'
$baseFolder = (Get-Location).path
DownloadAndImportBcContainerHelper -baseFolder $baseFolder

Expand Down Expand Up @@ -219,7 +214,7 @@ try {
}
}
Set-Location $baseFolder
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Add existing apps ($($appNames -join ', '))" -branch $branch
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Add existing apps ($($appNames -join ', '))" -branch $branch | Out-Null

TrackTrace -telemetryScope $telemetryScope
}
Expand Down
2 changes: 1 addition & 1 deletion AddExistingApp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ none
| project | | Project name if the repository is setup for multiple projects | . |
| url | Yes | Direct Download Url of .app or .zip file to add to the repository | |
| updateBranch | | Which branch should the app be added to | github.ref_name |
| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N |
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |

## OUTPUT
none
10 changes: 5 additions & 5 deletions AddExistingApp/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: PowerShell script
author: Freddy Kristiansen
name: Add Existing App
author: Microsoft Corporation
permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -32,9 +32,9 @@ inputs:
required: false
default: ${{ github.ref_name }}
directCommit:
description: Direct Commit (Y/N)
description: Direct Commit?
required: false
default: 'N'
default: 'false'
runs:
using: composite
steps:
Expand All @@ -51,7 +51,7 @@ runs:
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
try {
${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
}
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
Expand Down
6 changes: 3 additions & 3 deletions AnalyzeTests/TestResultAnalyzer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ function GetTestResultSummary {
Write-Host "- $appName, $appTests tests, $appPassed passed, $appFailed failed, $appSkipped skipped, $appTime seconds"
$summarySb.Append("|$appName|$appTests|") | Out-Null
if ($appPassed -gt 0) {
$summarySb.Append("$($appPassed):white_check_mark:") | Out-Null
$summarySb.Append("$($appPassed) :white_check_mark:") | Out-Null
}
$summarySb.Append("|") | Out-Null
if ($appFailed -gt 0) {
$summarySb.Append("$($appFailed):x:") | Out-Null
$summarySb.Append("$($appFailed) :x:") | Out-Null
}
$summarySb.Append("|") | Out-Null
if ($appSkipped -gt 0) {
$summarySb.Append("$($appSkipped):white_circle:") | Out-Null
$summarySb.Append("$($appSkipped) :white_circle:") | Out-Null
}
$summarySb.Append("|$($appTime)s|\n") | Out-Null
if ($appFailed -gt 0) {
Expand Down
4 changes: 2 additions & 2 deletions AnalyzeTests/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: PowerShell script
author: Freddy Kristiansen
name: Analyze Tests
author: Microsoft Corporation
inputs:
shell:
description: Shell in which you want to run the action (powershell or pwsh)
Expand Down
Loading

0 comments on commit 202378c

Please sign in to comment.