Fix GitHub Actions step summary generation issues #484
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: Run Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - development | |
| paths-ignore: | |
| - '**/*.md' | |
| - '**/*.txt' | |
| - '.github/**' | |
| - '**/.gitignore' | |
| pull_request: | |
| branches: | |
| - master | |
| - development | |
| paths-ignore: | |
| - '**/*.md' | |
| - '**/*.txt' | |
| - '.github/**' | |
| - '**/.gitignore' | |
| defaults: | |
| run: | |
| shell: cmd | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| runs-on: windows-latest | |
| continue-on-error: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Summary - Test execution started | |
| shell: pwsh | |
| run: | | |
| # Get Cmder version | |
| . scripts/utils.ps1 | |
| $cmderVersion = Get-VersionStr | |
| $summary = @" | |
| ## ✅ Run Tests - Workflow Summary | |
| ### Test Environment | |
| | Property | Value | | |
| | --- | --- | | |
| | Repository | ``${{ github.repository }}`` | | |
| | Branch | ``${{ github.ref_name }}`` | | |
| | Commit | ``${{ github.sha }}`` | | |
| | Runner OS | ``${{ runner.os }}`` | | |
| | Cmder Version | **$cmderVersion** | | |
| | PowerShell Version | **$($PSVersionTable.PSVersion)** | | |
| | Event | ``${{ github.event_name }}`` | | |
| "@ | |
| $summary | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 | |
| - name: Initialize vendors | |
| shell: pwsh | |
| working-directory: scripts | |
| run: .\build.ps1 -verbose | |
| - name: Summary - Vendor initialization | |
| if: success() | |
| shell: pwsh | |
| run: | | |
| # Get vendor versions from sources.json | |
| $vendorInfo = @() | |
| $sources = Get-Content "vendor\sources.json" -Raw | ConvertFrom-Json | |
| $vendorDirs = $sources.PSObject.Properties | ForEach-Object { $_.Name } | |
| foreach ($dir in $vendorDirs) { | |
| $versionFile = "vendor/$dir/.cmderver" | |
| if (Test-Path $versionFile) { | |
| $version = Get-Content $versionFile -Raw | |
| $vendorInfo += "- **$dir**: $($version.Trim())" | |
| } | |
| } | |
| $summary = @" | |
| ### ⚙️ Vendor Initialization | |
| ✅ Vendor dependencies initialized successfully. | |
| **Vendor Versions:** | |
| "@ | |
| $( | |
| if ($vendorInfo.Count -eq 0) { | |
| $summary += "_No vendor version information available._" | |
| } else { | |
| $summary += $vendorInfo -join '`n' | |
| } | |
| ) | |
| $summary | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 | |
| - name: Summary - Test results table header | |
| if: success() | |
| shell: pwsh | |
| run: | | |
| $summary = @" | |
| ### 📋 Test Results | |
| | Test | Status | Duration | | |
| | --- | --- | --- | | |
| "@ | |
| $summary | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 | |
| - name: Testing Clink Shell | |
| id: test-clink | |
| run: | | |
| cmd /c vendor\init.bat /v /d /t | |
| - name: Summary - Clink Shell test | |
| if: success() | |
| shell: pwsh | |
| run: | | |
| "| Clink Shell | ✅ Passed | Cmd shell initialization |" | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 | |
| - name: Testing PowerShell | |
| id: test-powershell | |
| run: | | |
| PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -Command "$env:CMDER_DEBUG='1'; . 'vendor\profile.ps1'" | |
| - name: Summary - PowerShell test | |
| if: success() | |
| shell: pwsh | |
| run: | | |
| "| PowerShell | ✅ Passed | Profile script execution |" | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 | |
| - name: Testing Bash | |
| id: test-bash | |
| run: | | |
| bash vendor/cmder.sh | |
| - name: Summary - Bash test | |
| if: success() | |
| shell: pwsh | |
| run: | | |
| "| Bash | ✅ Passed | Bash environment initialization |" | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 | |
| - name: Summary - All tests completed | |
| if: success() | |
| shell: pwsh | |
| run: | | |
| $summary = @" | |
| ### ✅ All Tests Completed | |
| All shell environments tested successfully! | |
| **Test Coverage:** | |
| - ✅ Clink shell environment (Windows cmd.exe with Clink) | |
| - ✅ PowerShell environment (with Cmder profile) | |
| - ✅ Bash environment (Git Bash integration) | |
| "@ | |
| $summary | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8 |