mirror of
https://github.com/cmderdev/cmder.git
synced 2025-12-16 10:41:38 +08:00
155 lines
4.1 KiB
YAML
155 lines
4.1 KiB
YAML
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
|
|
|
|
- name: Summary - Test execution started
|
|
shell: pwsh
|
|
run: |
|
|
# Get Cmder version
|
|
. scripts/utils.ps1
|
|
$cmderVersion = Get-VersionStr
|
|
|
|
@"
|
|
## ✅ 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 }}`` |
|
|
|
|
"@ | 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
|
|
$vendorInfo = @()
|
|
$vendorDirs = @("conemu-maximus5", "clink", "git-for-windows")
|
|
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:**
|
|
$($vendorInfo -join "`n")
|
|
|
|
"@
|
|
|
|
$summary | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8
|
|
|
|
- name: Summary - Test results table header
|
|
if: success()
|
|
shell: pwsh
|
|
run: |
|
|
@"
|
|
### 📋 Test Results
|
|
|
|
| Test | Status | Duration |
|
|
| --- | --- | --- |
|
|
"@ | 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: |
|
|
@"
|
|
|
|
### ✅ 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)
|
|
"@ | Add-Content -Path $env:GITHUB_STEP_SUMMARY -Encoding utf8
|