|
| 1 | +# DO NOT TEST YOURSELF |
| 2 | +# MIGHT ONLY WORK IN A VERY CONTROLLED ENVIRONMENT AS OF NOW |
| 3 | + |
| 4 | + |
| 5 | +name: "Build, test, bundle FastGH3" |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + workflow_call: |
| 14 | + workflow_dispatch: |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: self-hosted |
| 18 | + env: |
| 19 | + #NETPACKER: ${{vars.NETPACKER}} # mpress or DotNetCompressor |
| 20 | + #cygenv: |
| 21 | + # ${{vars.CYGENV == 'CYGWIN' && 'cygwin' || 'msys2'}} |
| 22 | + # # value can be either CYGWIN or MSYS |
| 23 | + node: |
| 24 | + ${{vars.BUN == 'true' && 'bun' || 'nodejs'}} |
| 25 | + # use Bun if true, Node.js if false |
| 26 | + BUILD: ${{vars.BUILD}} # bitflags to indicate which types of builds to create |
| 27 | + #NSIS: 'C:\Program Files (x86)\NSIS\makensis.exe' |
| 28 | + #CYGWIN: winsymlinks:nativestrict |
| 29 | + environment: Test env |
| 30 | + if: github.actor == 'donnaken15' |
| 31 | + steps: |
| 32 | + - |
| 33 | + name: Update system environment |
| 34 | + run: | |
| 35 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 36 | + - |
| 37 | + name: Install Git |
| 38 | + run: | |
| 39 | + where.exe git /q; if (-not $?) { |
| 40 | + choco install git -y |
| 41 | + } |
| 42 | + "C:\Program Files\Git\bin\" | Out-File -FilePath $env:GITHUB_PATH -Append |
| 43 | + "C:\Program Files\Git\usr\" | Out-File -FilePath $env:GITHUB_PATH -Append |
| 44 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 45 | + sleep 2 |
| 46 | + #- |
| 47 | + # name: Install Cygwin or MSYS2 |
| 48 | + # run: | |
| 49 | + # $path = $null |
| 50 | + # where.exe git /q; if ($?) { |
| 51 | + # $path = "C:\Program Files\Git" |
| 52 | + # "Using Git Bash as it is already installed" |
| 53 | + # } else { |
| 54 | + # where.exe $env:cygenv /q; if (-not $?) { |
| 55 | + # choco install $env:cygenv -y |
| 56 | + # } else { "Unix environment is already installed" } |
| 57 | + # $path = $(if ($env:cygenv -eq 'cygwin') {"Cygwin"} else {"msys2\usr"}) |
| 58 | + # } |
| 59 | + # v FIX LOL |
| 60 | + # "SH=C:\tools\${path}\bin\sh.exe" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 61 | + - |
| 62 | + name: Install Node.js or Bun |
| 63 | + run: | |
| 64 | + where.exe $env:node /q; if (-not $?) { |
| 65 | + choco install $env:node -y --no-progress |
| 66 | + } else { "Node environment is already installed" } |
| 67 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 68 | + sleep 2 |
| 69 | + - |
| 70 | + name: Install UPX |
| 71 | + run: | |
| 72 | + choco install upx |
| 73 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 74 | + sleep 2 |
| 75 | + # i need functions |
| 76 | + - |
| 77 | + name: Install NSIS |
| 78 | + run: | |
| 79 | + choco install nsis -y --no-progress |
| 80 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 81 | + sleep 2 |
| 82 | + - |
| 83 | + name: Install 7-Zip |
| 84 | + run: | |
| 85 | + choco install 7zip -y --no-progress |
| 86 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 87 | + sleep 2 |
| 88 | + - |
| 89 | + name: Install Resource Hacker |
| 90 | + run: | |
| 91 | + choco install resourcehacker.portable -y --no-progress |
| 92 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 93 | + sleep 2 |
| 94 | + - |
| 95 | + name: Install DotNetCompressor |
| 96 | + env: |
| 97 | + condition: ${{vars.NETPACKERS}} |
| 98 | + if: ${{env.condition == 'DotNetCompressor'}} |
| 99 | + run: | |
| 100 | + iwr -Uri "https://github.com/donnaken15/DotNetCompressor/releases/latest/download/NetCompressor.exe" -OutFile "C:\Windows\DotNetCompressor.exe" |
| 101 | + - |
| 102 | + name: Install mpress |
| 103 | + env: |
| 104 | + condition: ${{vars.NETPACKERS}} |
| 105 | + if: ${{env.condition != 'DotNetCompressor'}} |
| 106 | + #if: ${{vars.NETPACKER == 'mpress'}} |
| 107 | + run: | |
| 108 | + choco install mpress -y --no-progress |
| 109 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 110 | + sleep 2 |
| 111 | + - |
| 112 | + name: Install stripreloc |
| 113 | + env: |
| 114 | + condition: ${{vars.NORELOC}} |
| 115 | + if: ${{env.condition == 'true'}} |
| 116 | + run: | |
| 117 | + iwr -Uri "https://jrsoftware.org/download.php/striprlc.zip" -OutFile "striprlc.zip" |
| 118 | + Expand-Archive -Path "striprlc.zip" -DestinationPath "C:\Windows" -Force |
| 119 | + del "striprlc.zip" |
| 120 | + - |
| 121 | + name: Checkout repository |
| 122 | + uses: actions/checkout@v2 |
| 123 | + with: |
| 124 | + submodules: recursive |
| 125 | + - |
| 126 | + name: Set up MSBuild, Visual C# and C++ |
| 127 | + env: |
| 128 | + GH3PLUS: ${{vars.GH3PLUS}} # build GH3+ plugins |
| 129 | + condition: ${{vars.SHARPDEV}} |
| 130 | + if: ${{env.condition != null}} |
| 131 | + #uses: microsoft/setup-msbuild@v1 # NOT WORKING!! |
| 132 | + #with: |
| 133 | + # vs-version: 'latest' |
| 134 | + run: | # this whole thing should probably be a for loop, AND CHECK IF ALREADY INSTALLED ANY OF THESE!!!!!!!!!!!! |
| 135 | + Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 |
| 136 | + "" |
| 137 | + "Visual C# 2015 Build Tools:" |
| 138 | + "Downloading..." |
| 139 | + iwr -Uri "https://download.microsoft.com/download/E/E/D/EEDF18A8-4AED-4CE0-BEBE-70A83094FC5A/BuildTools_Full.exe" -OutFile "BuildTools_Full.exe" |
| 140 | + "Installing..." |
| 141 | + start -NoNewWindow -Wait -FilePath "BuildTools_Full.exe" -Args "/q /passive /norestart /full" |
| 142 | + del "BuildTools_Full.exe" |
| 143 | + ".NET Framework 4.6.2 Targeting Pack for .NET Framework 4.0:" |
| 144 | + "Downloading..." |
| 145 | + iwr -Uri "https://download.microsoft.com/download/e/e/c/eec79116-8305-4bd0-aa83-27610987eec6/NDP462-DevPack-KB3151934-ENU.exe" -OutFile "NDP462.exe" |
| 146 | + "Installing..." |
| 147 | + start -NoNewWindow -Wait -FilePath "NDP462.exe" -Args "/install /passive /norestart" |
| 148 | + del "NDP462.exe" |
| 149 | + if ($env:GH3PLUS) { |
| 150 | + "Visual C++ 2015 Build Tools:" |
| 151 | + "Downloading..." |
| 152 | + iwr -Uri "https://aka.ms/vs/17/release/vs_BuildTools.exe" -OutFile "vc15bt_full.exe" |
| 153 | + "Installing..." |
| 154 | + start -NoNewWindow -Wait -FilePath "vc15bt_full.exe" -Args "install --add Microsoft.VisualStudio.Component.VC.140,Microsoft.VisualStudio.Component.Windows10SDK.18362 --passive --norestart --nickname stupid --theme Light" |
| 155 | + "DirectX SDK:" |
| 156 | + "Downloading..." |
| 157 | + iwr -Uri "https://archive.org/download/dxsdk_jun10/DXSDK_Jun10.exe" -OutFile "DXSDK_Jun10.exe" |
| 158 | + "Installing..." |
| 159 | + start -NoNewWindow -Wait -FilePath "DXSDK_Jun10.exe" -Args "/U" |
| 160 | + del "DXSDK_Jun10.exe" |
| 161 | + "Downloading ntdll.lib..." |
| 162 | + iwr -Uri "https://drive.google.com/uc?id=16TzuL2DLDfs_cGts4QjUBjZ60KIUMlgf" -OutFile "SOURCE\GH3Plus\src\ntdll.lib" |
| 163 | + } |
| 164 | + #choco install microsoft-build-tools netfx-4.6.2-devpack visualcpp-build-tools -y |
| 165 | + # NOPE: visualcpp-build-tools |
| 166 | + # NOPE: VisualCppBuildTools |
| 167 | + # vcbuildtools |
| 168 | + # microsoft-visual-cpp-build-tools |
| 169 | + #what a freaking useless "utility" |
| 170 | + # https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe |
| 171 | + # https://download.microsoft.com/download/5/A/8/5A8B8314-CA70-4225-9AF0-9E957C9771F7/vs_BuildTools.exe |
| 172 | + # https://aka.ms/vs/17/release/vs_BuildTools.exe |
| 173 | + # vs_BuildTools.exe --add Microsoft.VisualStudio.Component.VC.140 |
| 174 | + - |
| 175 | + name: Build project |
| 176 | + env: |
| 177 | + conf: ${{vars.GH3PLUS == true && 'Release' || 'NoVC++'}} |
| 178 | + GH3PLUS: ${{vars.GH3PLUS}} |
| 179 | + NORELOC: ${{vars.NORELOC}} # run stripreloc if true, need to override from here to the event script, glhf |
| 180 | + RCASSETS: ${{vars.RCASSETS}} # recompile assets, NOT WORKING RIGHT NOW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 181 | + VCTargetsPath: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140 |
| 182 | + run: | |
| 183 | + & "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" SOURCE\FastGH3.sln /p:Configuration=$env:conf |
| 184 | + if ($env:RCASSETS) { |
| 185 | + cmd.exe /c "SOURCE\build-assets.bat" |
| 186 | + } |
| 187 | + # ERRORS AT 'DO' IN FOR BLOCK WTF |
| 188 | + test: |
| 189 | + runs-on: self-hosted |
| 190 | + #env: |
| 191 | + # EXTRACFG: ${{vars.EXTRACFG}} # custom INI properties |
| 192 | + environment: Playtest env |
| 193 | + steps: |
| 194 | + - |
| 195 | + name: Playtest |
| 196 | + run: | |
| 197 | + echo Test 123 |
| 198 | + cmd /c dir |
| 199 | + cmd /c register.bat |
| 200 | + "Testing songs:" |
| 201 | + $songs = @( |
| 202 | + ,@("fastgh3://drive.google.com/uc?id=1EQ8rvcxhv-Xq7T0FT62ZLOZ3rR2gcx9O","[ZIP] Squarepusher - Dark Steering") |
| 203 | + ,@("fastgh3://drive.google.com/uc?id=13gt3k5WsiRkIthf9V5i6dAAmFK5poyFX","[ZIP] Kommisar - Springtime") |
| 204 | + ,@("fastgh3://drive.google.com/uc?id=16Ipd-4SV1IqBzAVDA26P-42tWN4twvL7"," [7Z] The Used - Take It Away") |
| 205 | + ,@("fastgh3://drive.google.com/uc?id=1_F-7Hv7YbF-sw9l_tS3FyjRmpKICa8lp"," [7Z] QOTSA - 3's & 7's (Metal Track Pack)") |
| 206 | + ,@("fastgh3://drive.google.com/uc?id=16thK1ivFdKqsxd5TscRVh6DYZcQn23dA","[SNG] Fearofdark - TABNY (Fearofdark)") |
| 207 | + ) |
| 208 | + for ($i = 0; $i -lt $songs.length; $i++) { |
| 209 | + "* "+($songs[$i][1].ToString()) |
| 210 | + $arg = "dl "+($songs[$i][0].ToString()) # STUPID CRINGE THING WHY |
| 211 | + start -Wait "FastGH3.exe" -WorkingDirectory "." -Args $arg |
| 212 | + sleep 5 |
| 213 | + Wait-Process -Name "game.exe" -WorkingDirectory "." -Timeout 600 -ErrorAction SilentlyContinue -ErrorVariable to |
| 214 | + if ($to) { |
| 215 | + kill -Name "game.exe" -Force |
| 216 | + } |
| 217 | + sleep 15 |
| 218 | + } |
| 219 | + # TODO: write configs to test |
| 220 | + # TODO: CHECK IF BUILD TOOLS ARE INSTALLED |
| 221 | + # TODO: should be made more cleanly by putting songs to test in this YAML |
| 222 | + # TODO: fix game |
| 223 | + # TODO: get a life |
| 224 | +# i hate powershell now |
0 commit comments