Update licensing information #42
This file contains 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
# 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: '2023-09-23' | |
SDK_SHA256: c64a9e972a77c4f49a9b67464e5a25f0353cf6758c8a537f8c972e55c93b4364 | |
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, *-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 init | |
git config user.name "GitHub Actions" | |
git config user.email "actions@github.com" | |
git add foobar2000\ libppui\ pfc\ | |
git commit -m 'Initial commit' | |
git 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 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 restore foo_vis_milk2.sln | |
- 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 | |
$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\14.37.32822\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 |