forked from microsoft/navcontainerhelper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/microsoft/navcontainerhelper
- Loading branch information
Showing
76 changed files
with
1,684 additions
and
607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
name: Run Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: ref on which to run the end-2-end tests (default is head_sha on the current branch) | ||
required: false | ||
default: '' | ||
testPatterns: | ||
description: Commaseparated list of patterns to match against test names (default is * for all tests) | ||
required: false | ||
default: '' | ||
|
||
permissions: | ||
contents: read | ||
actions: read | ||
pull-requests: write | ||
checks: write | ||
|
||
concurrency: | ||
group: 'runTests-${{ github.ref }}' | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: powershell | ||
|
||
jobs: | ||
AnalyzeTests: | ||
runs-on: [ windows-latest ] | ||
outputs: | ||
tests: ${{ steps.Analyze.outputs.tests }} | ||
linuxtests: ${{ steps.Analyze.outputs.linuxtests }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.ref }} | ||
lfs: true | ||
|
||
- name: Analyze | ||
id: Analyze | ||
env: | ||
testPatterns: ${{ github.event.inputs.testPatterns }} | ||
run: | | ||
$errorActionPreference = "stop" | ||
$testPatterns = $ENV:TESTPATTERNS | ||
if (!$testPatterns) { $testPatterns = '*' } | ||
$testPatternArr = $testPatterns.Split(',') | ||
Write-Host "Running test matching patterns:" | ||
$testPatternArr | ForEach-Object { Write-Host "- $_" } | ||
$tests = ConvertTo-Json -compress -InputObject @(Get-ChildItem -Path (Join-Path $ENV:GITHUB_WORKSPACE 'Tests\*.Tests.ps1') | Where-Object { $name = $_.Basename; $testPatternArr | Where-Object { $name -like "$($_).Tests" } } | ForEach-Object { $_.BaseName }) | ||
Add-Content -Path $env:GITHUB_OUTPUT -Value "tests=$tests" | ||
Write-Host "tests=$tests" | ||
$linuxtests = ConvertTo-Json -compress -InputObject @(Get-ChildItem -Path (Join-Path $ENV:GITHUB_WORKSPACE 'LinuxTests\*.Tests.ps1') | Where-Object { $name = $_.Basename; $testPatternArr | Where-Object { $name -like "$($_).Tests" } } | ForEach-Object { $_.BaseName }) | ||
Add-Content -Path $env:GITHUB_OUTPUT -Value "linuxtests=$linuxtests" | ||
Write-Host "linuxtests=$linuxtests" | ||
PS5: | ||
runs-on: [ windows-latest ] | ||
needs: [ AnalyzeTests ] | ||
if: needs.AnalyzeTests.outputs.tests != '[]' | ||
strategy: | ||
matrix: | ||
test: ${{fromJson(needs.AnalyzeTests.outputs.tests)}} | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.ref }} | ||
lfs: true | ||
|
||
- name: Run Tests | ||
run: | | ||
try { | ||
$errorActionPreference = "stop" | ||
Set-StrictMode -version 2.0 | ||
$pesterContainer = New-PesterContainer -Path (Join-Path $ENV:GITHUB_WORKSPACE 'Tests\${{ matrix.test }}.ps1') -Data @{ "licenseFile" = '${{ secrets.licensefile }}'; "buildLicenseFile" = '${{ secrets.buildLicenseFile }}' } | ||
$result = Invoke-Pester -Container $pesterContainer -passthru | ||
if ($result.FailedCount -gt 0) { | ||
Write-Host "::Error::$($result.FailedCount) tests are failing" | ||
$host.SetShouldExit(1) | ||
} | ||
} | ||
catch { | ||
Write-Host "::Error::Exception when running tests. The Error was $($_.Exception.Message)" | ||
$host.SetShouldExit(1) | ||
} | ||
PS7: | ||
runs-on: [ windows-latest ] | ||
needs: [ AnalyzeTests ] | ||
if: needs.AnalyzeTests.outputs.tests != '[]' | ||
strategy: | ||
matrix: | ||
test: ${{fromJson(needs.AnalyzeTests.outputs.tests)}} | ||
fail-fast: false | ||
defaults: | ||
run: | ||
shell: pwsh | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.ref }} | ||
lfs: true | ||
|
||
- name: Run Tests | ||
run: | | ||
try { | ||
$errorActionPreference = "stop" | ||
Set-StrictMode -version 2.0 | ||
$pesterContainer = New-PesterContainer -Path (Join-Path $ENV:GITHUB_WORKSPACE 'Tests\${{ matrix.test }}.ps1') -Data @{ "licenseFile" = '${{ secrets.licensefile }}'; "buildLicenseFile" = '${{ secrets.buildLicenseFile }}' } | ||
$result = Invoke-Pester -Container $pesterContainer -passthru | ||
if ($result.FailedCount -gt 0) { | ||
Write-Host "::Error::$($result.FailedCount) tests are failing" | ||
$host.SetShouldExit(1) | ||
} | ||
} | ||
catch { | ||
Write-Host "::Error::Exception when running tests. The Error was $($_.Exception.Message)" | ||
$host.SetShouldExit(1) | ||
} | ||
Linux: | ||
runs-on: [ ubuntu-latest ] | ||
needs: [ AnalyzeTests ] | ||
if: needs.AnalyzeTests.outputs.linuxtests != '[]' | ||
strategy: | ||
matrix: | ||
test: ${{fromJson(needs.AnalyzeTests.outputs.linuxtests)}} | ||
fail-fast: false | ||
defaults: | ||
run: | ||
shell: pwsh | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.ref }} | ||
lfs: true | ||
|
||
- name: Run Tests | ||
run: | | ||
try { | ||
$errorActionPreference = "stop" | ||
Set-StrictMode -version 2.0 | ||
$pesterContainer = New-PesterContainer -Path (Join-Path $ENV:GITHUB_WORKSPACE 'LinuxTests\${{ matrix.test }}.ps1') -Data @{ "licenseFile" = '${{ secrets.licensefile }}'; "buildLicenseFile" = '${{ secrets.buildLicenseFile }}' } | ||
$result = Invoke-Pester -Container $pesterContainer -passthru | ||
if ($result.FailedCount -gt 0) { | ||
Write-Host "::Error::$($result.FailedCount) tests are failing" | ||
$host.SetShouldExit(1) | ||
} | ||
} | ||
catch { | ||
Write-Host "::Error::Exception when running tests. The Error was $($_.Exception.Message)" | ||
$host.SetShouldExit(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<# | ||
.Synopsis | ||
Copy App Files to Folder (supporting urls, .zip files and .app files) | ||
.Description | ||
.Parameter appFiles | ||
Can be an array of appfiles, urls or zip files | ||
.Parameter folder | ||
Folder to copy the app files to | ||
.Example | ||
Copy-AppFilesToFolder -appFiles @("c:\temp\apps.zip", "c:\temp\app2.app", "https://github.com/org/repo/releases/download/2.0.200/project-branch-Apps-1.0.0.0.zip") -folder "c:\temp\appfiles" | ||
#> | ||
function Copy-AppFilesToFolder { | ||
Param( | ||
$appFiles, | ||
[string] $folder | ||
) | ||
|
||
CopyAppFilesToFolder -appFiles $appFiles -folder $folder | ||
} | ||
Export-ModuleMember -Function Copy-AppFilesToFolder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<# | ||
.Synopsis | ||
Create a Symbols only .app file from an .app file | ||
.Description | ||
.Parameter AppFile | ||
Path of the application file which should be converted to symbols | ||
.Parameter symbolsFile | ||
Path of the symbols file which should be created | ||
.Example | ||
Create-SymbolsFileFromAppFile -appFile c:\temp\baseapp.app -symbolsFile c:\temp\baseapp.symbols.app | ||
#> | ||
function Create-SymbolsFileFromAppFile { | ||
Param( | ||
[Parameter(Mandatory=$true)] | ||
[string] $appFile, | ||
[Parameter(Mandatory=$true)] | ||
[string] $symbolsFile | ||
) | ||
RunAlTool -arguments @('CreateSymbolPackage', """$appFile""", """$symbolsFile""") | ||
} | ||
Export-ModuleMember -Function Create-SymbolsFileFromAppFile |
Oops, something went wrong.