Skip to content

Commit

Permalink
Create CI.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
steve02081504 committed Nov 25, 2023
1 parent 60ce892 commit 4c1fa03
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/CI.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
. $PSScriptRoot/../../esh/main.ps1

try{
$EshellUI.Init($MyInvocation)
$EshellUI.Start()
}
catch{
$error | ForEach-Object {
Write-Output "::error file=$($_.InvocationInfo.ScriptName),line=$($_.InvocationInfo.ScriptLineNumber),col=$($_.InvocationInfo.OffsetInLine),endColumn=$($_.InvocationInfo.OffsetInLine),tittle=error::script error"
Write-Output "::group::script stack trace"
Write-Output $_.ScriptStackTrace
Write-Output "::endgroup::"
Write-Output "::group::error details"
Write-Output $_
Write-Output "::endgroup::"
}
exit 1
}

Write-Output "Nice CI!"
15 changes: 15 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on:
push:
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Run a one-line script
run: pwsh ./.github/workflows/CI.ps1
4 changes: 2 additions & 2 deletions esh/src/commands/esh_base.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ function global:sudo {
$ShadowHandled=($Shadow.ToCharArray() | ForEach-Object {
if($Width -eq 0) {
$Width = [Math]::Max([Math]::Floor(
[System.Windows.Forms.TextRenderer]::MeasureText($_, $Font).Width
/128)-1,0)
[System.Windows.Forms.TextRenderer]::MeasureText($_, $Font).Width/
128)-1,0)
}
elseif($_ -eq $LastChar) { $Width--;return }
else{ $UseOriginal = $true }
Expand Down
3 changes: 2 additions & 1 deletion esh/src/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ $EshellUI = ValueEx @{
}
Im = @{
Sudo = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]Administrator)
VSCodeExtension = [bool]($psEditor)
VSCodeExtension = [bool]($psEditor) -and ($Host.Name -eq 'Visual Studio Code Host')
Editor = [bool]($psEditor)
WindowsPowerShell = (Split-Path $(Split-Path $PROFILE) -Leaf) -eq 'WindowsPowerShell'
ISE = [bool]($psISE)
FirstLoading = $EshellUI -eq $LastExitCode
Expand Down

0 comments on commit 4c1fa03

Please sign in to comment.