ci: add CI workflow for building and packaging foo_opensubsonic #1
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: Patch SDK | |
| run: | | |
| (Get-Content "lib\foobar2000_sdk\foobar2000\helpers\foobar2000_sdk_helpers.vcxproj") ` | |
| | ForEach-Object { $_ -replace '\.\.\\packages\\wtl', '..\..\..\..\packages\wtl' } ` | |
| | Set-Content "lib\foobar2000_sdk\foobar2000\helpers\foobar2000_sdk_helpers.vcxproj" | |
| - name: Download WTL and nlohmann/json | |
| run: | | |
| (New-Object System.Net.WebClient).DownloadFile("https://downloads.sourceforge.net/project/wtl/WTL%2010.0/WTL%2010.0.10320/WTL10_10320.zip", "${{ runner.temp }}\wtl.zip") | |
| 7z x "${{ runner.temp }}\wtl.zip" -o"lib\WTL" > nul | |
| 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") | |
| - 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 |