Skip to content

🌟 [Major]: Cleanup outputs + Bump and align with Invoke-Pester@v3 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
aaf62a2
🩹 [Patch]: Remove unused outputs and update Invoke-Pester to v3
MariusStorhaug Feb 23, 2025
446940d
🌟 [Major]: Consolidate Action-Test workflows into a single file
MariusStorhaug Feb 23, 2025
27fc670
🩹 [Patch]: Simplify job name in ActionTestWorkflow to use OS only
MariusStorhaug Feb 23, 2025
b11037f
🩹 [Patch]: Simplify PSScriptAnalyzer test description and remove unne…
MariusStorhaug Feb 23, 2025
ae2041c
🩹 [Patch]: Enhance logging for Invoke-ScriptAnalyzer to improve issue…
MariusStorhaug Feb 23, 2025
dd08ad8
🩹 [Patch]: Update logging in PSScriptAnalyzer tests to include full s…
MariusStorhaug Feb 23, 2025
4adc55c
🩹 [Patch]: Update logging in PSScriptAnalyzer tests to use relative s…
MariusStorhaug Feb 23, 2025
519199f
🩹 [Patch]: Update relative settings file path in PSScriptAnalyzer tes…
MariusStorhaug Feb 23, 2025
1ec9058
🩹 [Patch]: Add logging for test results in PSScriptAnalyzer tests to …
MariusStorhaug Feb 23, 2025
d71a8e9
🩹 [Patch]: Refactor relative settings file path handling in PSScriptA…
MariusStorhaug Feb 23, 2025
68e9176
🩹 [Patch]: Format test results output in PSScriptAnalyzer tests for i…
MariusStorhaug Feb 23, 2025
29eac9c
🩹 [Patch]: Update test results output formatting in PSScriptAnalyzer …
MariusStorhaug Feb 23, 2025
c725839
🩹 [Patch]: Enhance test case definition in PSScriptAnalyzer tests for…
MariusStorhaug Feb 23, 2025
116252c
🩹 [Patch]: Refactor PSScriptAnalyzer test structure for improved read…
MariusStorhaug Feb 23, 2025
c60f314
🩹 [Patch]: Refactor PSScriptAnalyzer test setup for improved variable…
MariusStorhaug Feb 23, 2025
92b4b68
🩹 [Patch]: Refactor PSScriptAnalyzer test cases for improved rule han…
MariusStorhaug Feb 23, 2025
c76fdf7
🩹 [Patch]: Refactor PSScriptAnalyzer test results handling for improv…
MariusStorhaug Feb 23, 2025
fdbc52e
🩹 [Patch]: Update PSScriptAnalyzer test logging for improved path res…
MariusStorhaug Feb 23, 2025
aaa2e3b
🩹 [Patch]: Set PSStyle.OutputRendering to 'Host' for improved output …
MariusStorhaug Feb 23, 2025
f8fef53
🩹 [Patch]: Enhance GitHub Actions workflows with aggregated job statu…
MariusStorhaug Feb 23, 2025
522fd95
🩹 [Patch]: Normalize output variable names in GitHub Actions workflow…
MariusStorhaug Feb 23, 2025
d9c023b
🩹 [Patch]: Update GitHub Actions workflow to use string interpolation…
MariusStorhaug Feb 23, 2025
7bb7688
Normalize output variable names in GitHub Actions workflows for consi…
MariusStorhaug Feb 23, 2025
3b8c715
🩹 [Patch]: Refactor GitHub Actions workflow to use environment variab…
MariusStorhaug Feb 23, 2025
c07c4c3
🩹 [Patch]: Refactor GitHub Actions workflow to simplify job status ag…
MariusStorhaug Feb 23, 2025
502c9d2
Remove redundant job status checks and streamline output handling in …
MariusStorhaug Feb 23, 2025
dddc143
🩹 [Patch]: Remove deprecated ActionTest workflow to streamline GitHub…
MariusStorhaug Feb 23, 2025
f72c977
🩹 [Patch]: Update linter configuration to exclude Action-Test workflo…
MariusStorhaug Feb 23, 2025
a8f4a6d
🩹 [Patch]: Update linter configuration to correct file path and adjus…
MariusStorhaug Feb 23, 2025
05c0483
Update README.md to clarify action outputs and improve workflow docum…
MariusStorhaug Feb 23, 2025
458a0b1
Update Invoke-ScriptAnalyzer action to version 2 in README.md
MariusStorhaug Feb 23, 2025
68bf0f1
🩹 [Patch]: Update README.md and action.yml to mark 'Path' input as op…
MariusStorhaug Feb 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"consoleFull"
],
"ignore": [
"**/tests/**"
"**/tests/**",
"**/.github/workflows/Action-Test.yml"
],
"absolute": true
}
24 changes: 0 additions & 24 deletions .github/workflows/Action-Test-Src-Default-Custom.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/Action-Test-Src-Default.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/Action-Test-Src-WithManifest.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/Action-Test-outputs.yml

This file was deleted.

228 changes: 228 additions & 0 deletions .github/workflows/Action-Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
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: tests/srcTestRepo/src
Settings: SourceCode

- 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: tests/srcTestRepo/src
Settings: Custom
SettingsFilePath: tests/srcTestRepo/tests/Custom.Settings.psd1

- 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: tests/srcWithManifestTestRepo/src
Settings: SourceCode

- 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: tests/outputTestRepo/outputs/modules/PSModuleTest
Settings: Module

- 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
}

50 changes: 0 additions & 50 deletions .github/workflows/ActionTestWorkflow.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/Linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ jobs:
VALIDATE_JSON_PRETTIER: false
VALIDATE_MARKDOWN_PRETTIER: false
VALIDATE_YAML_PRETTIER: false
FILTER_REGEX_EXCLUDE: '.*Set-PSModuleTest\.ps1$'
Loading