Skip to content

Commit c194b39

Browse files
committed
ci: add CI workflow for building and packaging foo_opensubsonic
1 parent f016c91 commit c194b39

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on: [pull_request, push, workflow_dispatch]
4+
5+
permissions: {}
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: ${{ github.head_ref != '' }}
10+
11+
jobs:
12+
ci:
13+
name: Build
14+
runs-on: windows-latest
15+
16+
env:
17+
FBSDK_VERSION: 2025-03-07
18+
19+
SOL_FILE: foo_opensubsonic.sln
20+
MSBUILD_CMD_X86: /maxcpucount /property:RestorePackagesConfig=true,Configuration=Release,Platform=Win32 /target:restore,build
21+
MSBUILD_CMD_X64: /maxcpucount /property:RestorePackagesConfig=true,Configuration=Release,Platform=x64 /target:restore,build
22+
MSBUILD_CMD_ARM64EC: /maxcpucount /property:RestorePackagesConfig=true,Configuration=Release,Platform=ARM64EC /target:restore,build
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v6.0.2
27+
28+
- name: Download and extract foobar2000 SDK
29+
run: |
30+
(New-Object System.Net.WebClient).DownloadFile("https://www.foobar2000.org/files/SDK-${{ env.FBSDK_VERSION }}.7z", "${{ runner.temp }}\fbsdk.7z")
31+
7z x "${{ runner.temp }}\fbsdk.7z" -o"lib\foobar2000_sdk" > nul
32+
33+
- name: Patch SDK
34+
run: |
35+
(Get-Content "lib\foobar2000_sdk\foobar2000\helpers\foobar2000_sdk_helpers.vcxproj") `
36+
| ForEach-Object { $_ -replace '\.\.\\packages\\wtl', '..\..\..\..\packages\wtl' } `
37+
| Set-Content "lib\foobar2000_sdk\foobar2000\helpers\foobar2000_sdk_helpers.vcxproj"
38+
39+
- name: Download WTL and nlohmann/json
40+
run: |
41+
(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")
42+
7z x "${{ runner.temp }}\wtl.zip" -o"lib\WTL" > nul
43+
44+
New-Item -ItemType Directory -Force -Path "lib\nlohmann"
45+
(New-Object System.Net.WebClient).DownloadFile("https://github.com/nlohmann/json/releases/download/v3.12.0/json.hpp", "lib\nlohmann\json.hpp")
46+
(New-Object System.Net.WebClient).DownloadFile("https://github.com/nlohmann/json/releases/download/v3.12.0/json_fwd.hpp", "lib\nlohmann\json_fwd.hpp")
47+
48+
- name: Setup devcmd
49+
uses: ilammy/msvc-dev-cmd@v1
50+
51+
- name: Build x86
52+
run: |
53+
msbuild ${{ env.SOL_FILE }} ${{ env.MSBUILD_CMD_X86 }}
54+
55+
- name: Build x64
56+
run: |
57+
msbuild ${{ env.SOL_FILE }} ${{ env.MSBUILD_CMD_X64 }}
58+
59+
- name: Build ARM64EC
60+
run: |
61+
msbuild ${{ env.SOL_FILE }} ${{ env.MSBUILD_CMD_ARM64EC }}
62+
63+
- name: Prepare build artifacts
64+
run: |
65+
copy "Release\foo_opensubsonic.dll" "."
66+
copy "x64\Release\foo_opensubsonic.dll" "x64"
67+
68+
New-Item -ItemType Directory -Force -Path "arm64ec"
69+
copy "ARM64EC\Release\foo_opensubsonic.dll" "arm64ec"
70+
71+
7z a -tzip -mx9 "foo_opensubsonic.fb2k-component" "foo_opensubsonic.dll" "x64\foo_opensubsonic.dll" "arm64ec\foo_opensubsonic.dll"
72+
73+
$hash = (Get-FileHash -Algorithm SHA256 "foo_opensubsonic.fb2k-component").hash.ToString().toLower()
74+
Write-Output "$hash *foo_opensubsonic.fb2k-component" > "foo_opensubsonic.fb2k-component.sha256"
75+
76+
- name: Upload build artifacts
77+
uses: actions/upload-artifact@v7.0.1
78+
with:
79+
name: foo_opensubsonic
80+
path: |
81+
foo_opensubsonic.fb2k-component
82+
foo_opensubsonic.fb2k-component.sha256

0 commit comments

Comments
 (0)