1+ name : Build Windows Executable
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+ workflow_dispatch :
9+ release :
10+ types : [created]
11+
12+ jobs :
13+ build-windows :
14+ runs-on : windows-latest
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Add MSBuild to PATH
21+ uses : microsoft/setup-msbuild@v2
22+
23+ - name : Setup CMake
24+ uses : jwlawson/actions-setup-cmake@v2
25+ with :
26+ cmake-version : ' latest'
27+
28+ - name : Download GLFW
29+ run : |
30+ Write-Host "Downloading GLFW 3.3.8 for Windows x64..."
31+ Invoke-WebRequest -Uri "https://github.com/glfw/glfw/releases/download/3.3.8/glfw-3.3.8.bin.WIN64.zip" -OutFile "glfw.zip"
32+ Expand-Archive -Path "glfw.zip" -DestinationPath "glfw-temp"
33+ $glfwDir = Get-ChildItem -Path "glfw-temp" -Directory | Select-Object -First 1
34+ Write-Host "GLFW extracted to: $($glfwDir.FullName)"
35+ Copy-Item "$($glfwDir.FullName)/lib-vc2022/glfw3.lib" "CursorTrail/lib/glfw3.lib" -Force
36+ Write-Host "GLFW x64 library copied successfully"
37+
38+ - name : Show environment info
39+ run : |
40+ cmake --version
41+ Write-Host "Visual Studio installations:"
42+ Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -ErrorAction SilentlyContinue
43+ Write-Host "MSBuild version:"
44+ msbuild -version
45+ Write-Host "GLFW library info:"
46+ Get-Item "CursorTrail/lib/glfw3.lib"
47+
48+ - name : Configure CMake
49+ run : |
50+ mkdir build
51+ cd build
52+ cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
53+
54+ - name : Build project
55+ run : |
56+ cd build
57+ cmake --build . --config Release --verbose
58+
59+ - name : Verify executable exists
60+ run : |
61+ if (Test-Path "build/Release/CursorTrail.exe") {
62+ Write-Host "Executable built successfully"
63+ Get-ChildItem "build/Release/CursorTrail.exe"
64+ } else {
65+ Write-Host "Checking build directory contents:"
66+ Get-ChildItem -Recurse build/
67+ Write-Error "Executable not found!"
68+ exit 1
69+ }
70+
71+ - name : Create artifact directory
72+ run : |
73+ mkdir artifacts
74+ copy "build/Release/CursorTrail.exe" "artifacts/"
75+ copy "CursorTrail/cursortrail.png" "artifacts/"
76+ copy "CursorTrail/sprite.frag" "artifacts/"
77+ copy "CursorTrail/sprite.vs" "artifacts/"
78+ echo "Built on $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" > "artifacts/BUILD_INFO.txt"
79+ echo "Commit: ${{ github.sha }}" >> "artifacts/BUILD_INFO.txt"
80+
81+ - name : Upload Windows executable
82+ uses : actions/upload-artifact@v4
83+ with :
84+ name : cursor-trail-windows-x64
85+ path : artifacts/
86+ retention-days : 30
87+
88+ - name : Upload release asset (if release)
89+ if : github.event_name == 'release'
90+ uses : actions/upload-release-asset@v1
91+ env :
92+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
93+ with :
94+ upload_url : ${{ github.event.release.upload_url }}
95+ asset_path : artifacts/CursorTrail.exe
96+ asset_name : CursorTrail-Windows-x64.exe
97+ asset_content_type : application/octet-stream
0 commit comments