Smoke Test #544
Workflow file for this run
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
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, reopened] | |
branches: | |
- "main" | |
pull_request_review: | |
types: [submitted] | |
push: | |
paths: | |
- ".github/workflows/run_smoke_test.yaml" | |
branches: | |
- "main" | |
- "*smoke*" | |
name: Smoke Test | |
jobs: | |
Run-Smoke-Test: | |
runs-on: windows-latest | |
env: | |
SCUBA_GITHUB_AUTOMATION_CREDS: ${{ secrets.SCUBA_GITHUB_AUTOMATION_CREDS }} | |
defaults: | |
run: | |
shell: powershell | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repo code | |
uses: actions/checkout@v3 | |
- name: Remove Graph 2.0 | |
shell: powershell | |
run: | | |
# Remove Microsoft.Graph module(s) from image until SCUBA steps up to 2.0+ | |
Write-Output "NOTICE: Removing Microsoft.Graph version 2.0. Remove this step when SCuBA steps up to this version." | |
Uninstall-Module Microsoft.Graph -ErrorAction SilentlyContinue | |
Get-InstalledModule Microsoft.Graph.* | %{ if($_.Name -ne "Microsoft.Graph.Authentication"){ Write-Output "Removing: $($_.Name)"; Uninstall-Module $_.Name -AllowPrerelease -AllVersions } } | |
Uninstall-Module Microsoft.Graph.Authentication -AllowPrerelease -AllVersions | |
- name: Execute ScubaGear and Check Outputs | |
run: | | |
. Testing/Functional/SmokeTest/SmokeTestUtils.ps1 | |
./AllowBasicAuthentication.ps1 -RunAsAdmin | |
##### Install all the dependencies | |
Install-SmokeTestExternalDependencies | |
# ScubaGear currently requires the provisioning of a certificate for using a ServicePrinicpal, rather than | |
# using Workload Identity Federation, which would ordinarily be preferred for calling Microsoft APIs from | |
# GitHub actions. | |
$AUTOMATION_CREDS = $env:SCUBA_GITHUB_AUTOMATION_CREDS | ConvertFrom-Json | |
$TestTenants = $AUTOMATION_CREDS.TestTenants | |
Write-Output "Identified $($TestTenants.Count) Test Tenants" | |
$TestContainers = @() | |
ForEach ($TestTenantObj in $TestTenants){ | |
$Properties = Get-Member -InputObject $TestTenantObj -MemberType NoteProperty | |
$TestTenant = $TestTenantObj | Select-Object -ExpandProperty $Properties.Name | |
$OrgName = $TestTenant.DisplayName | |
$DomainName = $TestTenant.DomainName | |
$AppId = $TestTenant.AppId | |
$PlainTextPassword = $TestTenant.CertificatePassword | |
$CertPwd = ConvertTo-SecureString -String $PlainTextPassword -Force -AsPlainText | |
$M365Env = $TestTenant.M365Env | |
try { | |
$Result = New-ServicePrincipalCertificate ` | |
-EncodedCertificate $TestTenant.CertificateB64 ` | |
-CertificatePassword $CertPwd | |
$Thumbprint = $Result[-1] | |
} | |
catch { | |
Write-Output "Failed to install certificate for $OrgName" | |
} | |
$TestContainers += New-PesterContainer ` | |
-Path "Testing/Functional/SmokeTest/SmokeTest001.Tests.ps1" ` | |
-Data @{ Thumbprint = $Thumbprint; Organization = $DomainName; AppId = $AppId; M365Environment = $M365Env } | |
$TestContainers += New-PesterContainer ` | |
-Path "Testing/Functional/SmokeTest/SmokeTest002.Tests.ps1" ` | |
-Data @{ OrganizationDomain = $DomainName; OrganizationName = $OrgName } | |
} | |
Invoke-Pester -Container $TestContainers -Output Detailed | |
Remove-MyCertificates |