Action-Test - [ #] by @MariusStorhaug #50
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
| name: Action-Test | |
| run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| ActionTestSrcSourceCode: | |
| name: Action-Test - [Src-SourceCode] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| Outcome: ${{ steps.action-test.outcome }} | |
| Conclusion: ${{ steps.action-test.conclusion }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Action-Test | |
| uses: ./ | |
| id: action-test | |
| with: | |
| Path: src | |
| Settings: SourceCode | |
| WorkingDirectory: tests/srcTestRepo | |
| - name: Status | |
| shell: pwsh | |
| run: | | |
| Write-Host "Outcome: ${{ steps.action-test.outcome }}" | |
| Write-Host "Conclusion: ${{ steps.action-test.conclusion }}" | |
| ActionTestSrcCustom: | |
| name: Action-Test - [Src-Custom] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| Outcome: ${{ steps.action-test.outcome }} | |
| Conclusion: ${{ steps.action-test.conclusion }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Action-Test | |
| uses: ./ | |
| id: action-test | |
| with: | |
| Path: src | |
| Settings: Custom | |
| SettingsFilePath: tests/Custom.Settings.psd1 | |
| WorkingDirectory: tests/srcTestRepo | |
| - name: Status | |
| shell: pwsh | |
| run: | | |
| Write-Host "Outcome: ${{ steps.action-test.outcome }}" | |
| Write-Host "Conclusion: ${{ steps.action-test.conclusion }}" | |
| ActionTestSrcWithManifest: | |
| name: Action-Test - [Src-WithManifest] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| Outcome: ${{ steps.action-test.outcome }} | |
| Conclusion: ${{ steps.action-test.conclusion }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Action-Test | |
| uses: ./ | |
| continue-on-error: true | |
| id: action-test | |
| with: | |
| Path: src | |
| Settings: SourceCode | |
| WorkingDirectory: tests/srcWithManifestTestRepo | |
| - name: Status | |
| shell: pwsh | |
| run: | | |
| Write-Host "Outcome: ${{ steps.action-test.outcome }}" | |
| Write-Host "Conclusion: ${{ steps.action-test.conclusion }}" | |
| ActionTestOutputs: | |
| name: Action-Test - [outputs] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| Outcome: ${{ steps.action-test.outcome }} | |
| Conclusion: ${{ steps.action-test.conclusion }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Action-Test | |
| uses: ./ | |
| id: action-test | |
| with: | |
| Path: outputs/modules/PSModuleTest | |
| Settings: Module | |
| WorkingDirectory: tests/outputTestRepo | |
| - name: Status | |
| shell: pwsh | |
| run: | | |
| Write-Host "Outcome: ${{ steps.action-test.outcome }}" | |
| Write-Host "Conclusion: ${{ steps.action-test.conclusion }}" | |
| CatchJob: | |
| name: Aggregate Status | |
| needs: | |
| - ActionTestSrcSourceCode | |
| - ActionTestSrcCustom | |
| - ActionTestSrcWithManifest | |
| - ActionTestOutputs | |
| if: always() | |
| runs-on: ubuntu-latest | |
| env: | |
| ActionTestSrcSourceCodeOutcome: ${{ needs.ActionTestSrcSourceCode.outputs.Outcome }} | |
| ActionTestSrcSourceCodeConclusion: ${{ needs.ActionTestSrcSourceCode.outputs.Conclusion }} | |
| ActionTestSrcCustomOutcome: ${{ needs.ActionTestSrcCustom.outputs.Outcome }} | |
| ActionTestSrcCustomConclusion: ${{ needs.ActionTestSrcCustom.outputs.Conclusion }} | |
| ActionTestSrcWithManifestOutcome: ${{ needs.ActionTestSrcWithManifest.outputs.Outcome }} | |
| ActionTestSrcWithManifestConclusion: ${{ needs.ActionTestSrcWithManifest.outputs.Conclusion }} | |
| ActionTestOutputsOutcome: ${{ needs.ActionTestOutputs.outputs.Outcome }} | |
| ActionTestOutputsConclusion: ${{ needs.ActionTestOutputs.outputs.Conclusion }} | |
| steps: | |
| - name: Aggregated Status | |
| uses: PSModule/Github-Script@v1 | |
| with: | |
| Script: | | |
| Install-PSResource -Name Markdown -Repository PSGallery -TrustRepository | |
| # Build an array of objects for each job | |
| $ActionTestSrcSourceCodeExpectedOutcome = 'success' | |
| $ActionTestSrcSourceCodeOutcomeResult = $env:ActionTestSrcSourceCodeOutcome -eq $ActionTestSrcSourceCodeExpectedOutcome | |
| $ActionTestSrcSourceCodeExpectedConclusion = 'success' | |
| $ActionTestSrcSourceCodeConclusionResult = $env:ActionTestSrcSourceCodeConclusion -eq $ActionTestSrcSourceCodeExpectedConclusion | |
| $ActionTestSrcCustomExpectedOutcome = 'success' | |
| $ActionTestSrcCustomOutcomeResult = $env:ActionTestSrcCustomOutcome -eq $ActionTestSrcCustomExpectedOutcome | |
| $ActionTestSrcCustomExpectedConclusion = 'success' | |
| $ActionTestSrcCustomConclusionResult = $env:ActionTestSrcCustomConclusion -eq $ActionTestSrcCustomExpectedConclusion | |
| $ActionTestSrcWithManifestExpectedOutcome = 'failure' | |
| $ActionTestSrcWithManifestOutcomeResult = $env:ActionTestSrcWithManifestOutcome -eq $ActionTestSrcWithManifestExpectedOutcome | |
| $ActionTestSrcWithManifestExpectedConclusion = 'success' | |
| $ActionTestSrcWithManifestConclusionResult = $env:ActionTestSrcWithManifestConclusion -eq $ActionTestSrcWithManifestExpectedConclusion | |
| $ActionTestOutputsExpectedOutcome = 'success' | |
| $ActionTestOutputsOutcomeResult = $env:ActionTestOutputsOutcome -eq $ActionTestOutputsExpectedOutcome | |
| $ActionTestOutputsExpectedConclusion = 'success' | |
| $ActionTestOutputsConclusionResult = $env:ActionTestOutputsConclusion -eq $ActionTestOutputsExpectedConclusion | |
| $jobs = @( | |
| [PSCustomObject]@{ | |
| Name = 'Action-Test - [Src-SourceCode]' | |
| Outcome = $env:ActionTestSrcSourceCodeOutcome | |
| ExpectedOutcome = $ActionTestSrcSourceCodeExpectedOutcome | |
| PassedOutcome = $ActionTestSrcSourceCodeOutcomeResult | |
| Conclusion = $env:ActionTestSrcSourceCodeConclusion | |
| ExpectedConclusion = $ActionTestSrcSourceCodeExpectedConclusion | |
| PassedConclusion = $ActionTestSrcSourceCodeConclusionResult | |
| }, | |
| [PSCustomObject]@{ | |
| Name = 'Action-Test - [Src-Custom]' | |
| Outcome = $env:ActionTestSrcCustomOutcome | |
| ExpectedOutcome = $ActionTestSrcCustomExpectedOutcome | |
| PassedOutcome = $ActionTestSrcCustomOutcomeResult | |
| Conclusion = $env:ActionTestSrcCustomConclusion | |
| ExpectedConclusion = $ActionTestSrcCustomExpectedConclusion | |
| PassedConclusion = $ActionTestSrcCustomConclusionResult | |
| }, | |
| [PSCustomObject]@{ | |
| Name = 'Action-Test - [Src-WithManifest]' | |
| Outcome = $env:ActionTestSrcWithManifestOutcome | |
| ExpectedOutcome = $ActionTestSrcWithManifestExpectedOutcome | |
| PassedOutcome = $ActionTestSrcWithManifestOutcomeResult | |
| Conclusion = $env:ActionTestSrcWithManifestConclusion | |
| ExpectedConclusion = $ActionTestSrcWithManifestExpectedConclusion | |
| PassedConclusion = $ActionTestSrcWithManifestConclusionResult | |
| }, | |
| [PSCustomObject]@{ | |
| Name = 'Action-Test - [outputs]' | |
| Outcome = $env:ActionTestOutputsOutcome | |
| ExpectedOutcome = $ActionTestOutputsExpectedOutcome | |
| PassedOutcome = $ActionTestOutputsOutcomeResult | |
| Conclusion = $env:ActionTestOutputsConclusion | |
| ExpectedConclusion = $ActionTestOutputsExpectedConclusion | |
| PassedConclusion = $ActionTestOutputsConclusionResult | |
| } | |
| ) | |
| # Display the table in the workflow logs | |
| $jobs | Format-List | |
| $passed = $true | |
| $jobs | ForEach-Object { | |
| if (-not $_.PassedOutcome) { | |
| Write-Error "Job $($_.Name) failed with Outcome $($_.Outcome) and Expected Outcome $($_.ExpectedOutcome)" | |
| $passed = $false | |
| } | |
| if (-not $_.PassedConclusion) { | |
| Write-Error "Job $($_.Name) failed with Conclusion $($_.Conclusion) and Expected Conclusion $($_.ExpectedConclusion)" | |
| $passed = $false | |
| } | |
| } | |
| $icon = if ($passed) { '✅' } else { '❌' } | |
| $status = Heading 1 "$icon - GitHub Actions Status" { | |
| Table { | |
| $jobs | |
| } | |
| } | |
| Set-GitHubStepSummary -Summary $status | |
| if (-not $passed) { | |
| Write-GitHubError 'One or more jobs failed' | |
| exit 1 | |
| } |