-
Notifications
You must be signed in to change notification settings - Fork 4
Add CI workflow to validate builds on PRs #13
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,86 @@ | ||||||||
| name: CI | ||||||||
|
|
||||||||
| on: | ||||||||
| pull_request: | ||||||||
| branches: [master] | ||||||||
|
|
||||||||
| jobs: | ||||||||
| build: | ||||||||
| runs-on: windows-2025-vs2026 | ||||||||
| steps: | ||||||||
| - uses: actions/checkout@v4 | ||||||||
|
|
||||||||
| - name: Setup MSBuild | ||||||||
| uses: microsoft/setup-msbuild@v2 | ||||||||
|
|
||||||||
| - name: Build Release | ||||||||
| run: msbuild src\ClipPing.sln /p:Configuration=Release /p:Platform=x64 | ||||||||
|
|
||||||||
| - name: Install Inno Setup | ||||||||
| run: choco install innosetup -y | ||||||||
|
|
||||||||
| - name: Build installer | ||||||||
| run: iscc /DMyAppVersion=0.0.0 installer.iss | ||||||||
|
|
||||||||
| - name: Run installer | ||||||||
| run: build\ClipPing-Setup.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | ||||||||
|
|
||||||||
| - name: Verify installation | ||||||||
| shell: pwsh | ||||||||
| run: | | ||||||||
| $exePath = "$env:LOCALAPPDATA\Programs\ClipPing\ClipPing.exe" | ||||||||
| if (-not (Test-Path $exePath)) { | ||||||||
| Write-Error "ClipPing.exe not found at $exePath" | ||||||||
| exit 1 | ||||||||
| } | ||||||||
| Write-Host "ClipPing.exe found at $exePath" | ||||||||
|
|
||||||||
| - name: Launch ClipPing | ||||||||
| shell: pwsh | ||||||||
| run: | | ||||||||
| Start-Process "$env:LOCALAPPDATA\Programs\ClipPing\ClipPing.exe" | ||||||||
| Start-Sleep -Seconds 2 | ||||||||
|
|
||||||||
| - name: Verify process is running | ||||||||
| shell: pwsh | ||||||||
| run: | | ||||||||
| $proc = Get-Process -Name ClipPing -ErrorAction SilentlyContinue | ||||||||
| if (-not $proc) { | ||||||||
| Write-Error "ClipPing process is not running" | ||||||||
| exit 1 | ||||||||
| } | ||||||||
| Write-Host "ClipPing is running (PID: $($proc.Id))" | ||||||||
|
|
||||||||
| - name: Verify mutex exists | ||||||||
| shell: pwsh | ||||||||
| run: | | ||||||||
| $mutexName = "Local\ClipPing_SingleInstance" | ||||||||
| $mutex = $null | ||||||||
| $exists = [System.Threading.Mutex]::TryOpenExisting($mutexName, [ref]$mutex) | ||||||||
| if (-not $exists) { | ||||||||
| Write-Error "Mutex '$mutexName' not found" | ||||||||
| exit 1 | ||||||||
| } | ||||||||
| $mutex.Dispose() | ||||||||
| Write-Host "Mutex '$mutexName' exists" | ||||||||
|
|
||||||||
| - name: Verify single instance | ||||||||
| shell: pwsh | ||||||||
| run: | | ||||||||
| $proc = Start-Process "$env:LOCALAPPDATA\Programs\ClipPing\ClipPing.exe" -PassThru | ||||||||
| $exited = $proc.WaitForExit(5000) | ||||||||
| if (-not $exited) { | ||||||||
| Write-Error "Second instance did not exit within 5 seconds" | ||||||||
| $proc.Kill() | ||||||||
| exit 1 | ||||||||
| } | ||||||||
| $count = (Get-Process -Name ClipPing -ErrorAction SilentlyContinue).Count | ||||||||
| if ($count -ne 1) { | ||||||||
| Write-Error "Expected 1 ClipPing process, found $count" | ||||||||
| exit 1 | ||||||||
| } | ||||||||
| Write-Host "Single instance enforced: second instance exited (code $($proc.ExitCode)), 1 process running" | ||||||||
|
|
||||||||
| - name: Stop ClipPing | ||||||||
| if: always() | ||||||||
|
||||||||
| if: always() | |
| if: always() | |
| shell: cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mutex name being checked here (
Local\ClipPing_SingleInstance) doesn’t match the name used by the app (CreateMutex(..., L"ClipPing_SingleInstance")). To avoid false negatives and keep the workflow coupled to the actual implementation, consider using the exact same name string as the app (or document why theLocal\prefix is required).