Give the v4 workflow its own file name #1
Workflow file for this run
This file contains hidden or 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
| # CI for the Pester v4 maintenance branch. Replaces the dead AppVeyor setup. | |
| # | |
| # v4 is in security-fix-only maintenance. We test only Windows PowerShell 5.1 | |
| # and PowerShell 7 — nothing else is guaranteed. The goal is to keep the branch | |
| # releasable: green CI here means a security fix can be validated and shipped | |
| # through the manual release process (release.ps1). | |
| # | |
| # The file name and the workflow name differ from main and rel/5.x.x on purpose. | |
| # test-report.yml on main runs after every workflow named "CI" and renders its | |
| # results, and Pester 4 can only write NUnit 2.5 XML, which dorny/test-reporter | |
| # cannot read. A workflow is identified by its file path, and its name comes | |
| # from the copy on the default branch, so while this file was also called | |
| # ci.yml the rename alone did nothing and the report kept running and failing. | |
| # The gate job below is still called "Done", same as everywhere else, that is | |
| # the name branch protection requires. | |
| name: CI (v4) | |
| on: | |
| push: | |
| branches: ['rel/4.x.x'] | |
| pull_request: | |
| branches: ['rel/4.x.x'] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { name: 'PS5.1 - Windows', id: ps51-windows, os: windows-latest, psexe: powershell } | |
| - { name: 'PS7 - Windows', id: ps7-windows, os: windows-latest, psexe: pwsh } | |
| - { name: 'PS7 - Ubuntu', id: ps7-ubuntu, os: ubuntu-latest, psexe: pwsh } | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| # Same test invocation AppVeyor used: import the module from the repo | |
| # root and run the suite, excluding the tags that need extra tooling. | |
| # `shell:` cannot take a matrix expression, so run from a fixed pwsh and | |
| # launch the leg's interpreter: pwsh for PS7, powershell (Windows | |
| # PowerShell 5.1) for the 5.1 leg. exit $LASTEXITCODE so a failure in | |
| # the launched process still fails the job. | |
| - name: Test Pester | |
| shell: pwsh | |
| run: | | |
| & ${{ matrix.psexe }} -NoProfile -Command '$PSVersionTable; Set-StrictMode -Version Latest; $global:PesterDebugPreference_ShowFullErrors = $true; Import-Module ./Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help -EnableExit -OutputFile TestResults.xml -OutputFormat NUnitXml' | |
| exit $LASTEXITCODE | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: results-${{ matrix.id }} | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| path: TestResults.xml | |
| # Single gate after the matrix so branch protection and auto-merge only need to | |
| # require "Done" instead of listing every leg. Same name as the gate on main | |
| # and on rel/5.x.x, so one branch policy covers all of them. | |
| done: | |
| name: Done | |
| needs: test | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: All test legs passed | |
| run: | | |
| echo "Test matrix result: ${{ needs.test.result }}" | |
| [ "${{ needs.test.result }}" = "success" ] || exit 1 | |
| echo "done" |