Skip to content

Explicit test coverage for Copilot noreply bot email format + README git hooks install instructions #15

Explicit test coverage for Copilot noreply bot email format + README git hooks install instructions

Explicit test coverage for Copilot noreply bot email format + README git hooks install instructions #15

name: Test git hooks
on:
push:
paths:
- 'git-hooks/**'
- 'bucket/**'
- 'Profile.ps1'
- 'install.ps1'
- '**.Tests.ps1'
- '.github/workflows/test-git-hooks.yml'
pull_request:
paths:
- 'git-hooks/**'
- 'bucket/**'
- 'Profile.ps1'
- 'install.ps1'
- '**.Tests.ps1'
- '.github/workflows/test-git-hooks.yml'
jobs:
test:
name: Pester tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Pester
shell: pwsh
run: |
if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge '5.0' })) {
Install-Module -Name Pester -MinimumVersion 5.0 -Force -SkipPublisherCheck -Scope CurrentUser
}
Import-Module Pester -MinimumVersion 5.0
- name: Make bash hook executable
if: runner.os != 'Windows'
run: chmod +x git-hooks/commit-msg
- name: Run Pester tests
shell: pwsh
run: |
$config = New-PesterConfiguration
$config.Run.Path = @('git-hooks/tests', 'bucket/tests', 'tests')
$config.Output.Verbosity = 'Detailed'
$config.TestResult.Enabled = $true
$config.TestResult.OutputPath = 'test-results.xml'
$config.Run.Exit = $true
Invoke-Pester -Configuration $config
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: test-results.xml
scoop-tests:
name: Scoop integration tests
runs-on: windows-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Install Scoop
shell: pwsh
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
# Ensure scoop is on PATH and $env:SCOOP is available for subsequent steps
echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "SCOOP=$env:USERPROFILE\scoop" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install Pester
shell: pwsh
run: |
if (-not (Get-Module -ListAvailable -Name Pester | Where-Object { $_.Version -ge '5.0' })) {
Install-Module -Name Pester -MinimumVersion 5.0 -Force -SkipPublisherCheck -Scope CurrentUser
}
Import-Module Pester -MinimumVersion 5.0
- name: Run Scoop integration tests
shell: pwsh
run: |
$config = New-PesterConfiguration
$config.Run.Path = @('bucket/McAfeeUninstall.Tests.ps1')
$config.Output.Verbosity = 'Detailed'
$config.TestResult.Enabled = $true
$config.TestResult.OutputPath = 'test-results-scoop.xml'
$config.Run.Exit = $true
Invoke-Pester -Configuration $config
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-scoop
path: test-results-scoop.xml