wtl #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: [pull_request, push, workflow_dispatch] | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: ${{ github.head_ref != '' }} | |
| jobs: | |
| ci: | |
| name: Build | |
| runs-on: windows-latest | |
| env: | |
| FBSDK_VERSION: 2025-03-07 | |
| SOL_FILE: foo_opensubsonic.sln | |
| MSBUILD_CMD_X86: /maxcpucount /property:RestorePackagesConfig=true,Configuration=Release,Platform=Win32 /target:restore,build | |
| MSBUILD_CMD_X64: /maxcpucount /property:RestorePackagesConfig=true,Configuration=Release,Platform=x64 /target:restore,build | |
| MSBUILD_CMD_ARM64EC: /maxcpucount /property:RestorePackagesConfig=true,Configuration=Release,Platform=ARM64EC /target:restore,build | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6.0.2 | |
| - name: Download and extract foobar2000 SDK | |
| run: | | |
| (New-Object System.Net.WebClient).DownloadFile("https://www.foobar2000.org/files/SDK-${{ env.FBSDK_VERSION }}.7z", "${{ runner.temp }}\fbsdk.7z") | |
| 7z x "${{ runner.temp }}\fbsdk.7z" -o"lib\foobar2000_sdk" > nul | |
| - name: Download WTL and nlohmann/json | |
| run: | | |
| git clone https://git.code.sf.net/p/wtl/git lib\wtl | |
| New-Item -ItemType Directory -Force -Path "lib\nlohmann" | |
| (New-Object System.Net.WebClient).DownloadFile("https://github.com/nlohmann/json/releases/download/v3.12.0/json.hpp", "lib\nlohmann\json.hpp") | |
| (New-Object System.Net.WebClient).DownloadFile("https://github.com/nlohmann/json/releases/download/v3.12.0/json_fwd.hpp", "lib\nlohmann\json_fwd.hpp") | |
| dir lib | |
| - name: Patch SDK | |
| shell: pwsh | |
| run: | | |
| $map = @{ | |
| "lib\foobar2000_sdk\libPPUI\libPPUI.vcxproj" = "../..;..;..\..\wtl\Include" | |
| "lib\foobar2000_sdk\foobar2000\helpers\foobar2000_sdk_helpers.vcxproj" = "..;..\..;..\..\..\wtl\Include" | |
| } | |
| foreach ($f in $map.Keys) { | |
| [xml]$x = Get-Content $f | |
| $ns = New-Object System.Xml.XmlNamespaceManager($x.NameTable) | |
| $ns.AddNamespace("msb", "http://schemas.microsoft.com/developer/msbuild/2003") | |
| $x.SelectNodes("//msb:ClCompile/msb:AdditionalIncludeDirectories", $ns) | % { $_.InnerText = $map[$f] } | |
| $x.Save($f) | |
| } | |
| - name: Setup devcmd | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Build x86 | |
| run: | | |
| msbuild ${{ env.SOL_FILE }} ${{ env.MSBUILD_CMD_X86 }} | |
| - name: Build x64 | |
| run: | | |
| msbuild ${{ env.SOL_FILE }} ${{ env.MSBUILD_CMD_X64 }} | |
| - name: Build ARM64EC | |
| run: | | |
| msbuild ${{ env.SOL_FILE }} ${{ env.MSBUILD_CMD_ARM64EC }} | |
| - name: Prepare build artifacts | |
| run: | | |
| copy "Release\foo_opensubsonic.dll" "." | |
| copy "x64\Release\foo_opensubsonic.dll" "x64" | |
| New-Item -ItemType Directory -Force -Path "arm64ec" | |
| copy "ARM64EC\Release\foo_opensubsonic.dll" "arm64ec" | |
| 7z a -tzip -mx9 "foo_opensubsonic.fb2k-component" "foo_opensubsonic.dll" "x64\foo_opensubsonic.dll" "arm64ec\foo_opensubsonic.dll" | |
| $hash = (Get-FileHash -Algorithm SHA256 "foo_opensubsonic.fb2k-component").hash.ToString().toLower() | |
| Write-Output "$hash *foo_opensubsonic.fb2k-component" > "foo_opensubsonic.fb2k-component.sha256" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v7.0.1 | |
| with: | |
| name: foo_opensubsonic | |
| path: | | |
| foo_opensubsonic.fb2k-component | |
| foo_opensubsonic.fb2k-component.sha256 |