|
| 1 | +name: windows_test |
| 2 | +description: 'Test PowerShell on Windows' |
| 3 | + |
| 4 | +inputs: |
| 5 | + purpose: |
| 6 | + required: false |
| 7 | + default: '' |
| 8 | + type: string |
| 9 | + tagSet: |
| 10 | + required: false |
| 11 | + default: CI |
| 12 | + type: string |
| 13 | + ctrfFolder: |
| 14 | + required: false |
| 15 | + default: ctrf |
| 16 | + type: string |
| 17 | + |
| 18 | +runs: |
| 19 | + using: composite |
| 20 | + steps: |
| 21 | + - name: Capture Environment |
| 22 | + if: success() || failure() |
| 23 | + run: 'Get-ChildItem -Path env: | Out-String -width 9999 -Stream | write-Verbose -Verbose' |
| 24 | + shell: pwsh |
| 25 | + - name: Download Build Artifacts |
| 26 | + uses: actions/download-artifact@v4 |
| 27 | + with: |
| 28 | + path: "${{ github.workspace }}" |
| 29 | + - name: Capture Artifacts Directory |
| 30 | + continue-on-error: true |
| 31 | + run: Get-ChildItem "${{ github.workspace }}\build\*" -Recurse |
| 32 | + shell: pwsh |
| 33 | + |
| 34 | + - name: Bootstrap |
| 35 | + shell: powershell |
| 36 | + run: |- |
| 37 | + # Remove "Program Files\dotnet" from the env variable PATH, so old SDKs won't affect us. |
| 38 | + Write-Host "Old Path:" |
| 39 | + Write-Host $env:Path |
| 40 | + $dotnetPath = Join-Path $env:SystemDrive 'Program Files\dotnet' |
| 41 | + $paths = $env:Path -split ";" | Where-Object { -not $_.StartsWith($dotnetPath) } |
| 42 | + $env:Path = $paths -join ";" |
| 43 | + Write-Host "New Path:" |
| 44 | + Write-Host $env:Path |
| 45 | + # Bootstrap |
| 46 | + Import-Module .\tools\ci.psm1 |
| 47 | + Invoke-CIInstall |
| 48 | +
|
| 49 | + - name: Test |
| 50 | + if: success() |
| 51 | + run: |- |
| 52 | + Import-Module .\build.psm1 -force |
| 53 | + Start-PSBootstrap |
| 54 | + Import-Module .\tools\ci.psm1 |
| 55 | + Restore-PSOptions -PSOptionsPath '${{ github.workspace }}\build\psoptions.json' |
| 56 | + $options = (Get-PSOptions) |
| 57 | + $path = split-path -path $options.Output |
| 58 | + $rootPath = split-Path -path $path |
| 59 | + Expand-Archive -Path '${{ github.workspace }}\build\build.zip' -DestinationPath $rootPath -Force |
| 60 | + Invoke-CITest -Purpose '${{ inputs.purpose }}' -TagSet '${{ inputs.tagSet }}' -OutputFormat JUnitXml |
| 61 | + shell: pwsh |
| 62 | + |
| 63 | + - name: Convert JUnit to CTRF |
| 64 | + run: |- |
| 65 | + Get-ChildItem -Path "${{ runner.workspace }}/testResults/*.xml" -Recurse | ForEach-Object { |
| 66 | + npx --yes junit-to-ctrf $_.FullName --output .\${{ inputs.ctrfFolder }}\$($_.BaseName).json --tool Pester --env 'Windows ${{ inputs.purpose }} ${{ inputs.tagSet }}' |
| 67 | + } |
| 68 | + shell: powershell |
| 69 | + |
| 70 | + # this task only takes / as directory separators |
| 71 | + - name: Publish Test Report |
| 72 | + uses: ctrf-io/github-test-reporter@v1 |
| 73 | + with: |
| 74 | + report-path: './${{ inputs.ctrfFolder }}/*.json' |
| 75 | + exit-on-fail: true |
| 76 | + summary-report: true |
| 77 | + test-report: false |
| 78 | + test-list-report: false |
| 79 | + failed-report: false |
| 80 | + fail-rate-report: false |
| 81 | + flaky-report: false |
| 82 | + flaky-rate-report: false |
| 83 | + failed-folded-report: true |
| 84 | + previous-results-report: false |
| 85 | + ai-report: true |
| 86 | + skipped-report: false |
| 87 | + suite-folded-report: false |
| 88 | + suite-list-report: false |
| 89 | + pull-request-report: false |
| 90 | + commit-report: false |
| 91 | + custom-report: false |
| 92 | + |
| 93 | + if: always() |
| 94 | + |
| 95 | + - name: Upload testResults artifact |
| 96 | + if: always() |
| 97 | + uses: actions/upload-artifact@v4 |
| 98 | + with: |
| 99 | + name: junit-pester-${{ inputs.purpose }}-${{ inputs.tagSet }} |
| 100 | + path: ${{ runner.workspace }}\testResults |
| 101 | + |
| 102 | + - name: Upload ctrf artifact |
| 103 | + if: always() |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: ctrf-pester-${{ inputs.purpose }}-${{ inputs.tagSet }} |
| 107 | + path: ${{ inputs.ctrfFolder }} |
0 commit comments