Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/actions/E2EAnalyze/E2EAnalyze.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Param(
[Parameter(HelpMessage = "Maximum parallel jobs", Mandatory = $true)]
[int] $maxParallel,
[Parameter(HelpMessage = "Test upgrades from version", Mandatory = $false)]
[string] $testUpgradesFromVersion = 'v5.0',
[Parameter(HelpMessage = "Filter to run specific scenarios (separated by comma, supports wildcards)", Mandatory = $false)]
[string] $scenariosFilter = '*'
)

$ErrorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$modulePath = Join-Path "." "e2eTests/e2eTestHelper.psm1" -resolve
Import-Module $modulePath -DisableNameChecking

$publicTestruns = @{
"max-parallel" = $maxParallel
"fail-fast" = $false
"matrix" = @{
"include" = @()
}
}
$privateTestruns = @{
"max-parallel" = $maxParallel
"fail-fast" = $false
"matrix" = @{
"include" = @()
}
}
@('appSourceApp','PTE') | ForEach-Object {
$type = $_
@('linux','windows') | ForEach-Object {
$os = $_
@('multiProject','singleProject') | ForEach-Object {
$style = $_
$publicTestruns.matrix.include += @{ "type" = $type; "os" = $os; "style" = $style; "Compiler" = "Container" }
$privateTestruns.matrix.include += @{ "type" = $type; "os" = $os; "style" = $style; "Compiler" = "Container" }
if ($type -eq "PTE") {
# Run end 2 end tests using CompilerFolder with Windows+Linux and single/multiproject
$publicTestruns.matrix.include += @{ "type" = $type; "os" = $os; "style" = $style; "Compiler" = "CompilerFolder" }
}
}
}
}
$publicTestrunsJson = $publicTestruns | ConvertTo-Json -depth 99 -compress
$privateTestrunsJson = $privateTestruns | ConvertTo-Json -depth 99 -compress
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "publictestruns=$publicTestrunsJson"
Write-Host "publictestruns=$publicTestrunsJson"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "privatetestruns=$privateTestrunsJson"
Write-Host "privatetestruns=$privateTestrunsJson"

$releases = @(gh release list --repo microsoft/AL-Go | ForEach-Object { $_.split("`t")[0] }) | Where-Object { [Version]($_.trimStart('v')) -ge [Version]($testUpgradesFromVersion.TrimStart('v')) }
$releasesJson = @{
"matrix" = @{
"include" = @($releases | ForEach-Object { @{ "Release" = $_; "type" = 'appSourceApp' }; @{ "Release" = $_; "type" = 'PTE' } } )
};
"max-parallel" = $maxParallel
"fail-fast" = $false
} | ConvertTo-Json -depth 99 -compress
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "releases=$releasesJson"
Write-Host "releases=$releasesJson"

$scenariosFilterArr = $scenariosFilter -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne '' }
$allScenarios = @(Get-ChildItem -Path (Join-Path $ENV:GITHUB_WORKSPACE "e2eTests/scenarios/*/runtest.ps1") | ForEach-Object { $_.Directory.Name })
$filteredScenarios = $allScenarios | Where-Object { $scenario = $_; $scenariosFilterArr | ForEach-Object { $scenario -like $_ } }

$scenariosJson = @{
"matrix" = @{
"include" = @($filteredScenarios | ForEach-Object { @{ "Scenario" = $_ } })
};
"max-parallel" = $maxParallel
"fail-fast" = $false
} | ConvertTo-Json -depth 99 -compress
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "scenarios=$scenariosJson"
Write-Host "scenarios=$scenariosJson"
16 changes: 16 additions & 0 deletions .github/actions/E2EAnalyze/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# E2E Analyze

Analyzes and generates test matrices for E2E testing including public/private test runs, releases, and scenarios.

## Inputs

- `maxParallel`: Maximum parallel jobs
- `testUpgradesFromVersion`: Test upgrades from version (default: 'v5.0')
- `token`: GitHub token with permissions to read releases

## Outputs

- `publictestruns`: Public test runs matrix
- `privatetestruns`: Private test runs matrix
- `releases`: Releases matrix
- `scenarios`: Scenarios matrix
50 changes: 50 additions & 0 deletions .github/actions/E2EAnalyze/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: E2E Analyze
author: Microsoft Corporation
inputs:
shell:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: pwsh
maxParallel:
description: Maximum parallel jobs
required: true
testUpgradesFromVersion:
description: Test upgrades from version
required: false
default: 'v5.0'
scenariosFilter:
description: Filter to run specific scenarios (separated by comma, supports wildcards)
required: false
default: '*'
token:
description: GitHub token with permissions to read releases
required: true
outputs:
publictestruns:
description: Public test runs matrix
value: ${{ steps.run.outputs.publictestruns }}
privatetestruns:
description: Private test runs matrix
value: ${{ steps.run.outputs.privatetestruns }}
releases:
description: Releases matrix
value: ${{ steps.run.outputs.releases }}
scenarios:
description: Scenarios matrix
value: ${{ steps.run.outputs.scenarios }}
runs:
using: composite
steps:
- name: run
id: run
shell: ${{ inputs.shell }}
env:
_maxParallel: ${{ inputs.maxParallel }}
_testUpgradesFromVersion: ${{ inputs.testUpgradesFromVersion }}
_scenariosFilter: ${{ inputs.scenariosFilter }}
GH_TOKEN: ${{ inputs.token }}
run: |
${{ github.action_path }}/E2EAnalyze.ps1 -maxParallel ([int]$ENV:_maxParallel) -testUpgradesFromVersion $ENV:_testUpgradesFromVersion -scenariosFilter $ENV:_scenariosFilter
branding:
icon: activity
color: blue
12 changes: 12 additions & 0 deletions .github/actions/E2ECalculateRepoName/E2ECalculateRepoName.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Param(
[Parameter(HelpMessage = "GitHub owner for test repositories", Mandatory = $false)]
[string] $githubOwner = ''
)

$ErrorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$reponame = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName())
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "repoName=$repoName"
Write-Host "repoName=$repoName"
if ($githubOwner) {
Write-Host "Repo URL: https://github.com/$githubOwner/$repoName"
}
11 changes: 11 additions & 0 deletions .github/actions/E2ECalculateRepoName/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# E2E Calculate Repo Name

Generates a random repository name for E2E testing.

## Inputs

- `githubOwner`: GitHub owner for test repositories (optional, for logging purposes)

## Outputs

- `repoName`: Generated repository name
28 changes: 28 additions & 0 deletions .github/actions/E2ECalculateRepoName/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: E2E Calculate Repo Name
author: Microsoft Corporation
inputs:
shell:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: pwsh
githubOwner:
description: GitHub owner for test repositories (optional, for logging purposes)
required: false
default: ''
outputs:
repoName:
description: Generated repository name
value: ${{ steps.run.outputs.repoName }}
runs:
using: composite
steps:
- name: run
id: run
shell: ${{ inputs.shell }}
env:
_githubOwner: ${{ inputs.githubOwner }}
run: |
${{ github.action_path }}/E2ECalculateRepoName.ps1 -githubOwner $ENV:_githubOwner
branding:
icon: hash
color: blue
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Param(
[Parameter(HelpMessage = "GitHub owner for test repositories", Mandatory = $true)]
[string] $githubOwner,
[Parameter(HelpMessage = "Matrix type (PTE or appSourceApp)", Mandatory = $false)]
[string] $matrixType = '',
[Parameter(HelpMessage = "Matrix style (singleProject or multiProject)", Mandatory = $false)]
[string] $matrixStyle = '',
[Parameter(HelpMessage = "Matrix OS (windows or linux)", Mandatory = $false)]
[string] $matrixOs = '',
[Parameter(HelpMessage = "Admin center API credentials secret", Mandatory = $false)]

Check warning

Code scanning / PSScriptAnalyzer

Parameter '$adminCenterApiCredentialsSecret' should not use String type but either SecureString or PSCredential, otherwise it increases the chance to expose this sensitive information.

Parameter '$adminCenterApiCredentialsSecret' should not use String type but either SecureString or PSCredential, otherwise it increases the chance to expose this sensitive information.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please, fix

[string] $adminCenterApiCredentialsSecret = '',
[Parameter(HelpMessage = "AppSource app repository template", Mandatory = $true)]
[string] $appSourceAppRepo,
[Parameter(HelpMessage = "Per-tenant extension repository template", Mandatory = $true)]
[string] $perTenantExtensionRepo,
[Parameter(HelpMessage = "Content path (for upgrade tests)", Mandatory = $false)]
[string] $contentPath = ''
)

$ErrorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0

# Calculate adminCenterApiCredentials
$adminCenterApiCredentials = ''
if ($matrixType -eq 'PTE' -and $matrixStyle -eq 'singleProject' -and $matrixOs -eq 'windows') {
$adminCenterApiCredentials = $adminCenterApiCredentialsSecret
}

# Calculate template
$template = ''
if ($matrixType -eq 'appSourceApp') {
$template = "$githubOwner/$appSourceAppRepo"
}
elseif ($matrixType -eq 'PTE') {
$template = "$githubOwner/$perTenantExtensionRepo"
}

# Calculate contentPath if not provided
if (-not $contentPath -and $matrixType) {
if ($matrixType -eq 'appSourceApp') {
$contentPath = 'appsourceapp'
}
else {
$contentPath = 'pte'
}
}

# Add outputs
if ($adminCenterApiCredentials) {
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "adminCenterApiCredentials='$adminCenterApiCredentials'"
}
else {
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "adminCenterApiCredentials=''"
}

if ($template) {
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "template='$template'"
}

if ($contentPath) {
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "contentPath='$contentPath'"
}

# Generate repo name
$reponame = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName())
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "repoName='$repoName'"
Write-Host "repoName='$repoName'"
Write-Host "Repo URL: https://github.com/$githubOwner/$repoName"
21 changes: 21 additions & 0 deletions .github/actions/E2ECalculateTestParams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# E2E Calculate Test Parameters

Calculates test parameters including template repository, admin center credentials, and repository name based on matrix configuration.

## Inputs

- `githubOwner`: GitHub owner for test repositories
- `matrixType`: Matrix type (PTE or appSourceApp)
- `matrixStyle`: Matrix style (singleProject or multiProject)
- `matrixOs`: Matrix OS (windows or linux)
- `adminCenterApiCredentialsSecret`: Admin center API credentials secret
- `appSourceAppRepo`: AppSource app repository template
- `perTenantExtensionRepo`: Per-tenant extension repository template
- `contentPath`: Content path (for upgrade tests)

## Outputs

- `adminCenterApiCredentials`: Calculated admin center API credentials
- `template`: Calculated template repository
- `repoName`: Generated repository name
- `contentPath`: Content path (for upgrade tests)
69 changes: 69 additions & 0 deletions .github/actions/E2ECalculateTestParams/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: E2E Calculate Test Parameters
author: Microsoft Corporation
inputs:
shell:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: pwsh
githubOwner:
description: GitHub owner for test repositories
required: true
matrixType:
description: Matrix type (PTE or appSourceApp)
required: false
default: ''
matrixStyle:
description: Matrix style (singleProject or multiProject)
required: false
default: ''
matrixOs:
description: Matrix OS (windows or linux)
required: false
default: ''
adminCenterApiCredentialsSecret:
description: Admin center API credentials secret
required: false
default: ''
appSourceAppRepo:
description: AppSource app repository template
required: true
perTenantExtensionRepo:
description: Per-tenant extension repository template
required: true
contentPath:
description: Content path (for upgrade tests)
required: false
default: ''
outputs:
adminCenterApiCredentials:
description: Calculated admin center API credentials
value: ${{ steps.run.outputs.adminCenterApiCredentials }}
template:
description: Calculated template repository
value: ${{ steps.run.outputs.template }}
repoName:
description: Generated repository name
value: ${{ steps.run.outputs.repoName }}
contentPath:
description: Content path (for upgrade tests)
value: ${{ steps.run.outputs.contentPath }}
runs:
using: composite
steps:
- name: run
id: run
shell: ${{ inputs.shell }}
env:
_githubOwner: ${{ inputs.githubOwner }}
_matrixType: ${{ inputs.matrixType }}
_matrixStyle: ${{ inputs.matrixStyle }}
_matrixOs: ${{ inputs.matrixOs }}
_adminCenterApiCredentialsSecret: ${{ inputs.adminCenterApiCredentialsSecret }}
_appSourceAppRepo: ${{ inputs.appSourceAppRepo }}
_perTenantExtensionRepo: ${{ inputs.perTenantExtensionRepo }}
_contentPath: ${{ inputs.contentPath }}
run: |
${{ github.action_path }}/E2ECalculateTestParams.ps1 -githubOwner $ENV:_githubOwner -matrixType $ENV:_matrixType -matrixStyle $ENV:_matrixStyle -matrixOs $ENV:_matrixOs -adminCenterApiCredentialsSecret $ENV:_adminCenterApiCredentialsSecret -appSourceAppRepo $ENV:_appSourceAppRepo -perTenantExtensionRepo $ENV:_perTenantExtensionRepo -contentPath $ENV:_contentPath
branding:
icon: settings
color: blue
Loading