|
| 1 | +name: "Build Allycs v2.0.0" |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + packages: write |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [ main, master ] |
| 10 | + pull_request: |
| 11 | + branches: [ main, master ] |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: windows-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout Code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Setup MSBuild |
| 23 | + uses: microsoft/setup-msbuild@v1.3 |
| 24 | + |
| 25 | + - name: Setup vcpkg |
| 26 | + uses: lukka/run-vcpkg@v11 |
| 27 | + with: |
| 28 | + vcpkgDirectory: '${{ github.workspace }}/vcpkg' |
| 29 | + vcpkgGitCommitId: '7e19f3c64cb636ee21f41bfe8558a6dfaae6236f' |
| 30 | + vcpkgJsonGlob: 'vcpkg.json' |
| 31 | + runVcpkgInstall: '--triplet=x64-windows-static --x-wait-for-lock' |
| 32 | + |
| 33 | + - name: Set Vcpkg Environment |
| 34 | + run: | |
| 35 | + echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $env:GITHUB_ENV |
| 36 | + echo "VcpkgRoot=${{ github.workspace }}/vcpkg" >> $env:GITHUB_ENV |
| 37 | + echo "VCPKG_DEFAULT_TRIPLET=x64-windows-static" >> $env:GITHUB_ENV |
| 38 | + echo "CMAKE_WARN_UNUSED_CLI_VARS=OFF" >> $env:GITHUB_ENV |
| 39 | + echo "VCPKG_CMAKE_CONFIGURE_OPTIONS=-DCMAKE_WARN_UNUSED_CLI_VARS=OFF" >> $env:GITHUB_ENV |
| 40 | +
|
| 41 | + - name: Setup Vcpkg Binary Caching |
| 42 | + uses: actions/cache@v4 |
| 43 | + with: |
| 44 | + path: | |
| 45 | + ${{ github.workspace }}/vcpkg/installed |
| 46 | + ${{ github.workspace }}/vcpkg/packages |
| 47 | + key: vcpkg-${{ hashFiles('**/vcpkg.json') }}-${{ runner.os }}-x64-windows-static |
| 48 | + restore-keys: | |
| 49 | + vcpkg-${{ hashFiles('**/vcpkg.json') }}-${{ runner.os }}- |
| 50 | + vcpkg-${{ runner.os }}- |
| 51 | +
|
| 52 | + - name: Integrate Vcpkg with MSBuild |
| 53 | + run: | |
| 54 | + & "${{ github.workspace }}/vcpkg/vcpkg.exe" integrate install |
| 55 | +
|
| 56 | + - name: Verify SysCaller Dependencies |
| 57 | + run: | |
| 58 | + Write-Host "Checking SysCaller dependencies..." |
| 59 | + |
| 60 | + # Check if SysCaller.lib exists |
| 61 | + if (Test-Path "sdk\SysCaller\lib\SysCaller.lib") { |
| 62 | + Write-Host "SysCaller.lib found!" |
| 63 | + Get-Item "sdk\SysCaller\lib\SysCaller.lib" | Select-Object Name, Length, LastWriteTime |
| 64 | + } else { |
| 65 | + Write-Host "SysCaller.lib not found!" |
| 66 | + exit 1 |
| 67 | + } |
| 68 | + |
| 69 | + # Check if SysCaller headers exist |
| 70 | + if (Test-Path "sdk\SysCaller\include\syscaller.h") { |
| 71 | + Write-Host "SysCaller headers found!" |
| 72 | + } else { |
| 73 | + Write-Host "SysCaller headers not found!" |
| 74 | + exit 1 |
| 75 | + } |
| 76 | + |
| 77 | + # Check if SysCaller.dll exists (for runtime) |
| 78 | + if (Test-Path "sdk\SysCaller\lib\SysCaller.dll") { |
| 79 | + Write-Host "SysCaller.dll found!" |
| 80 | + } else { |
| 81 | + Write-Host "SysCaller.dll not found, this is needed at runtime!" |
| 82 | + } |
| 83 | +
|
| 84 | + - name: Build Solution (Release x64) |
| 85 | + run: | |
| 86 | + Write-Host "Building Release x64..." |
| 87 | + Write-Host "VcpkgRoot: $env:VcpkgRoot" |
| 88 | + Write-Host "VCPKG_ROOT: $env:VCPKG_ROOT" |
| 89 | +
|
| 90 | + msbuild "Allycs.sln" /p:Configuration=Release /p:Platform=x64 /p:VcpkgEnabled=true /p:VcpkgEnableManifest=true /p:VcpkgUseStatic=true /p:VcpkgTriplet=x64-windows-static /p:VcpkgRoot="$env:VcpkgRoot" |
| 91 | +
|
| 92 | + - name: Copy SysCaller DLL (Release) |
| 93 | + run: | |
| 94 | + Write-Host "Copying SysCaller.dll for Release build..." |
| 95 | + $outputDir = "build\x64\Release" |
| 96 | + |
| 97 | + if (Test-Path "sdk\SysCaller\lib\SysCaller.dll") { |
| 98 | + Copy-Item "sdk\SysCaller\lib\SysCaller.dll" $outputDir |
| 99 | + Write-Host "Copied SysCaller.dll to Release build" |
| 100 | + } else { |
| 101 | + Write-Host "SysCaller.dll not found. Allycs will not run properly!" |
| 102 | + } |
| 103 | +
|
| 104 | + - name: Verify Executables Exist |
| 105 | + run: | |
| 106 | + $releaseExists = Test-Path "build\x64\Release\Allycs.exe" |
| 107 | +
|
| 108 | + if ($releaseExists) { |
| 109 | + Write-Host "Allycs.exe (Release) Built Successfully!" |
| 110 | + Get-Item "build\x64\Release\Allycs.exe" | Select-Object Name, Length, LastWriteTime |
| 111 | + } else { |
| 112 | + Write-Host "Allycs.exe (Release) not found!" |
| 113 | + Get-ChildItem -Recurse -Name "*.exe" | ForEach-Object { Write-Host "Found: $_" } |
| 114 | + exit 1 |
| 115 | + } |
| 116 | +
|
| 117 | + - name: List Build Directory Contents |
| 118 | + run: | |
| 119 | + Write-Host "Build Directory Contents:" |
| 120 | + if (Test-Path "build\x64\Release") { |
| 121 | + Write-Host "Release Directory:" |
| 122 | + Get-ChildItem "build\x64\Release" | Select-Object Name, Length, LastWriteTime |
| 123 | + } |
| 124 | +
|
| 125 | + - name: Upload Build Artifacts (Release) |
| 126 | + uses: actions/upload-artifact@v4 |
| 127 | + with: |
| 128 | + name: "Allycs-v2.0.0" |
| 129 | + path: build/x64/Release/ |
| 130 | + retention-days: 30 |
| 131 | + |
| 132 | + - name: Create Release Package |
| 133 | + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') |
| 134 | + run: | |
| 135 | + $version = "v2.0.0" |
| 136 | + $zipName = "Allycs-$version.zip" |
| 137 | +
|
| 138 | + New-Item -ItemType Directory -Path "release-package" -Force |
| 139 | +
|
| 140 | + # Copy Release files |
| 141 | + Copy-Item "build\x64\Release\Allycs.exe" "release-package\" |
| 142 | + Copy-Item "build\x64\Release\SysCaller.dll" "release-package\" |
| 143 | +
|
| 144 | + # Create the zip file |
| 145 | + Compress-Archive -Path "release-package\*" -DestinationPath $zipName -Force |
| 146 | +
|
| 147 | + Write-Host "Created Release Package: $zipName" |
| 148 | + Get-Item $zipName | Select-Object Name, Length |
| 149 | +
|
| 150 | + - name: Upload Release Package |
| 151 | + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') |
| 152 | + uses: actions/upload-artifact@v4 |
| 153 | + with: |
| 154 | + name: "Release v2.0.0" |
| 155 | + path: Allycs-v2.0.0.zip |
| 156 | + retention-days: 90 |
| 157 | + |
| 158 | + - name: Create GitHub Release |
| 159 | + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') |
| 160 | + uses: softprops/action-gh-release@v1 |
| 161 | + with: |
| 162 | + tag_name: v2.0.0 |
| 163 | + name: "Allycs v2.0.0" |
| 164 | + body: | |
| 165 | + ## Allycs v2.0.0 |
| 166 | +
|
| 167 | + **Build Date:** ${{ github.event.head_commit.timestamp }} |
| 168 | + **Commit:** ${{ github.sha }} |
| 169 | + **Platform:** Windows x64 (64-bit) |
| 170 | + files: Allycs-v2.0.0.zip |
| 171 | + env: |
| 172 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments