-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (163 loc) · 9.87 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# build.yml - GitHub Actions workflow specification.
#
# Copyright (c) 2023-2024 Jimmy Cassis
# SPDX-License-Identifier: MPL-2.0
name: Win32 MSVC DLL Build and Package
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
jobs:
build:
name: Build and test library
runs-on: windows-latest
continue-on-error: ${{ (matrix.platform == 'ARM64') || (matrix.platform == 'ARM64EC') }}
strategy:
matrix:
configuration: [Release] #, Debug]
platform: [x86, x64, ARM64, ARM64EC]
env:
SDK_VERSION: '2024-08-07'
SDK_SHA256: 4e2051430dce273029e3e349ec3fbd2bbe222f388b21541762f06a3abcf15990
steps:
- name: Clone foo_vis_milk2 repository
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: ${{ matrix.platform }}
- name: Cache foobar2000 SDK
uses: actions/cache@v4
id: sdk
with:
path: |
${{ github.workspace }}\external\foobar2000
${{ github.workspace }}\external\libppui
${{ github.workspace }}\external\pfc
key: ${{ runner.os }}-foobar2000_${{ env.SDK_VERSION }}-${{ hashFiles('**/fb2ksdk.patch') }}
- name: Download and install foobar2000 SDK
if: ${{ steps.sdk.outputs.cache-hit != 'true' }}
run: |
Invoke-WebRequest -Uri "https://www.foobar2000.org/files/SDK-${Env:SDK_VERSION}.7z" -OutFile "$(Get-Location)\fb2ksdk.7z"
(Get-FileHash -Path "$(Get-Location)\fb2ksdk.7z" -Algorithm SHA256).Hash -eq "${Env:SDK_SHA256}"
7z.exe x -o"$(Get-Location)\external" "$(Get-Location)\fb2ksdk.7z"
Remove-Item -Path `
"$(Get-Location)\external\foobar2000\foo_sample", `
"$(Get-Location)\external\foobar2000\foo_input_validator", `
"$(Get-Location)\external\foobar2000\helpers-mac" -Recurse
Remove-Item -Path "$(Get-Location)\external\*" -Recurse -Include *.xcodeproj, *.mm, *-apple.h, CFObject.h, *-nix.h, *-nix.cpp, *-license.txt, *-readme.txt, *-readme.html
Rename-Item -Path "$(Get-Location)\external\libPPUI" -NewName libppui
Rename-Item -Path "$(Get-Location)\external\foobar2000\SDK" -NewName sdk
Rename-Item -Path "$(Get-Location)\external\foobar2000\foobar2000_component_client" -NewName component_client
Set-Location -Path "$(Get-Location)\external"
git.exe init
git.exe config user.name "GitHub Actions"
git.exe config user.email "actions@github.com"
git.exe add foobar2000\ libppui\ pfc\
git.exe commit -m 'Initial commit'
git.exe apply --ignore-whitespace --whitespace=nowarn --verbose "$(Get-Location)\fb2ksdk.patch"
Remove-Item -Path "$(Get-Location)\.git" -Recurse -Force
- name: Clone projectm-eval repository
uses: actions/checkout@v4
with:
repository: projectM-visualizer/projectm-eval
path: external/projectm-eval
ref: master
- name: Patch projectm-eval repository
run: |
Set-Location -Path "$(Get-Location)\external\projectm-eval"
git.exe apply --ignore-whitespace --whitespace=nowarn --verbose "$(Get-Location)\..\pmeel.patch"
- name: Cache NuGet packages (DirectXTK and WTL)
uses: actions/cache@v4
id: nuget
with:
path: |
${{ github.workspace }}\external\directxtk*
${{ github.workspace }}\external\wtl*
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.config') }}
- name: Restore NuGet packages (DirectXTK and WTL)
if: ${{ steps.nuget.outputs.cache-hit != 'true' }}
run: |
nuget.exe restore foo_vis_milk2.sln
#Set-Location -Path "$(Get-Location)\external\directxtk_desktop_2019.2024.9.5.1\build\native"
#patch -p1 -F 0 -s --binary --no-backup-if-mismatch <"${{ github.workspace }}\external\dxtkwin10.patch"
#Set-Location -Path "$(Get-Location)\external\directxtk_desktop_win10.2024.9.5.1\build\native"
#patch -p1 -F 0 -s --binary --no-backup-if-mismatch <"${{ github.workspace }}\external\dxtkwin10.patch"
- name: Prepare build
id: prepare
run: |
('binpath=${{ github.workspace }}\Bin\' + ('${{ matrix.platform }}').Replace('x86', 'Win32') + '\${{ matrix.configuration }}') | Out-File -FilePath $env:GITHUB_OUTPUT -Append
('tz=' + ("{0:d2}{1:d2}" -f ((Get-TimeZone).BaseUtcOffset.Hours), ((Get-TimeZone).BaseUtcOffset.Minutes))) | Out-File -FilePath $env:GITHUB_OUTPUT -Append
#Get-Content "$(Get-Location)\foo_vis_milk2.sln" | % {$_ -replace 'EBFFFB4E-(.*)(Debug|Release)\|', 'EBFFFB4E-$1$2 FB2K|'} | Set-Content "$(Get-Location)\foo_vis_milk2_.sln"
- name: Build ${{ matrix.platform }} foobar2000 MilkDrop 2 Visualization Component for ${{ matrix.configuration }} # https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2022
run: msbuild.exe "${{ github.workspace }}\foo_vis_milk2.sln" --% -m:4 -t:Build -p:Configuration=${{ matrix.configuration }};Platform=${{ matrix.platform }};TimeZone=${{ steps.prepare.outputs.tz }} #-verbosity:diagnostic
- name: Validate ${{ matrix.platform }} foobar2000 MilkDrop 2 Visualization Component for ${{ matrix.configuration }}
# Notes: FILEVERSION appears in File Properties Details as `File version` and Get-Item as `FileVersionRaw`.
# PRODUCTVERSION does not appear in File Properties Details and apears in Get-Item as `ProductVersionRaw`.
# FileVersion does not appear in File Properties Details and apears in Get-Item as `FileVersion`.
# ProductVersion appears in File Properties Details as `Product version` and Get-Item as `ProductVersion`.
run: |
Write-Host '${{ matrix.platform }} ${{ matrix.configuration }} foo_vis_milk2.dll'
Write-Host -NoNewline 'File Size: '
Write-Host ((Get-ItemProperty ('${{ github.workspace }}\Bin\' + ('${{ matrix.platform }}').Replace('x86', 'Win32') + '\${{ matrix.configuration }}\foo_vis_milk2.dll')).length/1KB) KiB -Separator ' '
Write-Host -NoNewline 'File Version: '
(Get-ItemProperty ('${{ github.workspace }}\Bin\' + ('${{ matrix.platform }}').Replace('x86', 'Win32') + '\${{ matrix.configuration }}\foo_vis_milk2.dll')).VersionInfo.FileVersion
Write-Host -NoNewline 'Product Version: '
(Get-ItemProperty ('${{ github.workspace }}\Bin\' + ('${{ matrix.platform }}').Replace('x86', 'Win32') + '\${{ matrix.configuration }}\foo_vis_milk2.dll')).VersionInfo.ProductVersion
$vcversion=(Get-ChildItem "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\" | Where-Object { $_.PSIsContainer } | Sort-Object -Property Name -Descending | Select-Object -First 1).Name
$toolhost=('${{ matrix.platform }}' -ireplace 'ARM64(?:EC)?', 'X86').ToUpper()
$tooltarget=('${{ matrix.platform }}' -ireplace 'ARM64EC', 'arm64').ToLower()
&"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\${vcversion}\bin\Host${toolhost}\${tooltarget}\link.exe" /dump /exports /nologo ('${{ github.workspace }}\Bin\' + ('${{ matrix.platform }}').Replace('x86', 'Win32') + '\${{ matrix.configuration }}\foo_vis_milk2.dll')
#- name: Test ${{ matrix.platform }} foobar2000 MilkDrop 2 Visualization Component for ${{ matrix.configuration }}
# working-directory: ${{ github.workspace }}
# run: |
# #(Get-Content ${{ github.workspace }}\src\vis_milk2\vis.cpp).replace('if (WASABI_API_SVC == (api_service*)1)', 'goto done;') | Set-Content ${{github.workspace}}\src\vis_milk2\vis.cpp
# #msbuild.exe /t:Clean /verbosity:normal /nologo /m:4 /p:'Configuration=${{ matrix.configuration }};Platform=Win32' ${{ github.workspace }}\src\vis_milk2\milkdrop.sln
# #msbuild.exe --% /t:Build /verbosity:quiet /nologo /m:4 /p:Configuration=${{ matrix.configuration }};Platform=Win32;OutDir=$(SolutionDir)${{ matrix.configuration }}\test ${{ github.workspace }}\src\vis_milk2\milkdrop.sln
# vstest.console.exe ${{ github.workspace }}\src\vis_milk2\${{ matrix.configuration }}\test.dll
- name: Upload ${{ matrix.platform }} foobar2000 MilkDrop 2 Visualization Component for ${{ matrix.configuration }}
if: ${{ (matrix.configuration == 'Release') }} #&& ((matrix.platform == 'x86') || (matrix.platform == 'x64')) }}
uses: actions/upload-artifact@v4
with:
name: milk2-${{ matrix.platform }}-${{ matrix.configuration }}
path: |
${{ steps.prepare.outputs.binpath }}\foo_vis_milk2.dll
${{ steps.prepare.outputs.binpath }}\foo_vis_milk2.pdb
package:
name: Package foobar2000 MilkDrop 2 component
needs: build
runs-on: windows-latest
steps:
- name: Clone foo_vis_milk2 repository
uses: actions/checkout@v4
- name: Download x86 DLL
uses: actions/download-artifact@v4
with:
name: milk2-x86-Release
path: ${{ github.workspace }}\Bin\Win32\Release
- name: Download x64 DLL
uses: actions/download-artifact@v4
with:
name: milk2-x64-Release
path: ${{ github.workspace }}\Bin\x64\Release
- name: Download ARM64 DLL
uses: actions/download-artifact@v4
with:
name: milk2-ARM64-Release
path: ${{ github.workspace }}\Bin\ARM64\Release
- name: Download ARM64EC DLL
uses: actions/download-artifact@v4
with:
name: milk2-ARM64EC-Release
path: ${{ github.workspace }}\Bin\ARM64EC\Release
- name: Package foobar2000 MilkDrop 2 component
run: |
&"${{ github.workspace }}\tools\build-fb2k_component.ps1" -Version ''
- uses: actions/upload-artifact@v4
with:
name: foo_vis_milk2-component
path: ${{ github.workspace }}\foo_vis_milk2.fb2k-component