Update Test-MtCaMfaForAdminManagement.ps1 #684
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
# Run pester tests | |
name: build-validation | |
on: | |
workflow_dispatch: | |
workflow_call: | |
pull_request: | |
branches: ["main"] | |
permissions: | |
contents: read | |
actions: read | |
checks: write | |
pull-requests: write | |
statuses: write | |
jobs: | |
build-validation: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
# This requires all patterns to match so exclusion works | |
predicate-quantifier: 'every' | |
filters: | | |
pwshmodule: | |
- 'powershell/**' | |
- "!powershell/Maester.psd1" | |
- name: Install PowerShell dependencies | |
if: steps.filter.outputs.pwshmodule == 'true' | |
shell: pwsh | |
run: | | |
Install-Module PSFramework -Force -SkipPublisherCheck -Scope CurrentUser -AllowClobber | |
Install-Module PSModuleDevelopment -Force -SkipPublisherCheck -Scope CurrentUser -AllowClobber | |
Install-Module Microsoft.Graph.Authentication -Force -SkipPublisherCheck -Scope CurrentUser -AllowClobber | |
- name: Run Pester tests | |
if: steps.filter.outputs.pwshmodule == 'true' | |
shell: pwsh | |
run: | | |
./powershell/tests/pester.ps1 | |
- name: Run Tests using Windows PowerShell | |
if: runner.os == 'Windows' && steps.filter.outputs.pwshmodule == 'true' | |
shell: powershell | |
run: | | |
# Reuse downloaded modules from pwsh | |
$env:PSModulePath += ";$HOME\Documents\PowerShell\Modules" | |
# Remove old test results | |
Remove-Item -Path TestResults -Recurse -Force -ErrorAction SilentlyContinue | |
# Run Pester tests on Windows PowerShell | |
./powershell/tests/pester.ps1 | |
- uses: actions/upload-artifact@v4 # upload test results | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: test-results-${{ runner.os }} | |
path: TestResults/*.xml |