Run PowerShell Tests #576
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
name: Run PowerShell Tests | |
on: | |
# Run tests on each commit, newly opened/reopened PR, and | |
# PR review submission (e.g. approval) | |
workflow_dispatch: | |
push: | |
paths: | |
- "**.ps1" | |
- "**.psm1" | |
- ".github/workflows/run_powershell_tests.yaml" | |
pull_request: | |
types: [opened, reopened] | |
branches: | |
- "main" | |
paths: | |
- "**.ps1" | |
- "**.psm1" | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
Run-PowerShell-Tests: | |
runs-on: windows-latest | |
steps: | |
- name: Check out repository 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: Run Pester Tests | |
if: '!cancelled()' | |
shell: powershell | |
run: | | |
./SetUp.ps1 | |
Invoke-Pester -Output 'Detailed' -Path './Testing/Unit/PowerShell' |