Multi-platform build process (#1928)
* Add x86 to build process. - Use recommended structure for multi-platform nuget. - Separate build and pack to allow x64 and x86 builds. - Use matrix in Github Actions to reduce repetition. * Properly implement multi-platform nuget build. - Split build pipeline to setting version, building and packing. - Build AnyCPU only as reference assemblies. - Add ref folder to nuget. * Restructure project and pipeline. Based on PR review discussion. - Restore default x64,x86 build process. - Build generates platform specific nupkg. - Remove AnyCPU platform to prevent confusion. - Add custom property for building reference libraries. - AnyCPU is only set by the property. - Move nuget changes to separate target file. - Imported only when custom property is set. - Clear separation from the default build. - Merge frameworks in published library artifacts. - Re-simplify pipelines; no matrix or separate jobs.
This commit is contained in:
@@ -30,39 +30,47 @@ jobs:
|
|||||||
else { $_ -replace $m.Value, ("<Version>{0}.{1}.{2}-pre${{ github.run_number }}</Version>" -f $m.Groups[1].Value,$m.Groups[2].Value,([convert]::ToInt32($m.Groups[3].Value)+1)); }
|
else { $_ -replace $m.Value, ("<Version>{0}.{1}.{2}-pre${{ github.run_number }}</Version>" -f $m.Groups[1].Value,$m.Groups[2].Value,([convert]::ToInt32($m.Groups[3].Value)+1)); }
|
||||||
} | Set-Content Directory.Build.props
|
} | Set-Content Directory.Build.props
|
||||||
|
|
||||||
- name: NuGet restore
|
- name: Restore application packages
|
||||||
run: dotnet restore LibreHardwareMonitor.sln
|
run: dotnet restore LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj
|
||||||
|
|
||||||
- name: Build
|
- name: Build application
|
||||||
run: dotnet build LibreHardwareMonitor.sln --configuration Release --no-restore
|
run: dotnet build LibreHardwareMonitor\LibreHardwareMonitor.csproj -c Release -p:Platform=x64
|
||||||
|
|
||||||
- name: Publish net472
|
- name: Publish application
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: LibreHardwareMonitor-net472
|
name: LibreHardwareMonitor
|
||||||
path: |
|
path: |
|
||||||
bin/Release/net472
|
bin/Release/net472
|
||||||
|
|
||||||
- name: Publish netstandard20
|
- name: Restore library packages
|
||||||
uses: actions/upload-artifact@v4
|
run: dotnet restore LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj
|
||||||
with:
|
|
||||||
name: LibreHardwareMonitorLib-netstandard20
|
|
||||||
path: |
|
|
||||||
bin/Release/netstandard2.0
|
|
||||||
|
|
||||||
- name: Publish net80
|
- name: Build x64 libraries
|
||||||
uses: actions/upload-artifact@v4
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:Platform=x64
|
||||||
with:
|
|
||||||
name: LibreHardwareMonitorLib-net80
|
|
||||||
path: |
|
|
||||||
bin/Release/net8.0
|
|
||||||
|
|
||||||
- name: Publish net90
|
- name: Publish x64 libraries
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: LibreHardwareMonitorLib-net90
|
name: LibreHardwareMonitorLib (x64)
|
||||||
path: |
|
path: |
|
||||||
bin/Release/net9.0
|
bin/Release/x64
|
||||||
|
|
||||||
|
- name: Build x86 libraries
|
||||||
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:Platform=x86
|
||||||
|
|
||||||
|
- name: Publish x86 libraries
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: LibreHardwareMonitorLib (x86)
|
||||||
|
path: |
|
||||||
|
bin/Release/x86
|
||||||
|
|
||||||
|
- name: Build reference libraries
|
||||||
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:BuildOnlyRefs=true
|
||||||
|
|
||||||
|
- name: Pack main nupkg
|
||||||
|
run: dotnet pack LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release -p:PackMainNuget=true --no-build --output bin\Release
|
||||||
|
|
||||||
- name: Publish nupkg
|
- name: Publish nupkg
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
@@ -30,39 +30,47 @@ jobs:
|
|||||||
else { $_ -replace $m.Value, ("<Version>{0}.{1}.{2}-ci${{ github.run_number }}</Version>" -f $m.Groups[1].Value,$m.Groups[2].Value,([convert]::ToInt32($m.Groups[3].Value)+1)); }
|
else { $_ -replace $m.Value, ("<Version>{0}.{1}.{2}-ci${{ github.run_number }}</Version>" -f $m.Groups[1].Value,$m.Groups[2].Value,([convert]::ToInt32($m.Groups[3].Value)+1)); }
|
||||||
} | Set-Content Directory.Build.props
|
} | Set-Content Directory.Build.props
|
||||||
|
|
||||||
- name: Restore packages
|
- name: Restore application packages
|
||||||
run: dotnet restore LibreHardwareMonitor.sln
|
run: dotnet restore LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj
|
||||||
|
|
||||||
- name: Build
|
- name: Build application
|
||||||
run: dotnet build LibreHardwareMonitor.sln --configuration Release --no-restore
|
run: dotnet build LibreHardwareMonitor\LibreHardwareMonitor.csproj -c Release -p:Platform=x64
|
||||||
|
|
||||||
- name: Publish net472
|
- name: Publish application
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: LibreHardwareMonitor-net472
|
name: LibreHardwareMonitor
|
||||||
path: |
|
path: |
|
||||||
bin/Release/net472
|
bin/Release/net472
|
||||||
|
|
||||||
- name: Publish netstandard20
|
- name: Restore library packages
|
||||||
uses: actions/upload-artifact@v4
|
run: dotnet restore LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj
|
||||||
with:
|
|
||||||
name: LibreHardwareMonitorLib-netstandard20
|
|
||||||
path: |
|
|
||||||
bin/Release/netstandard2.0
|
|
||||||
|
|
||||||
- name: Publish net80
|
- name: Build x64 libraries
|
||||||
uses: actions/upload-artifact@v4
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:Platform=x64
|
||||||
with:
|
|
||||||
name: LibreHardwareMonitorLib-net80
|
|
||||||
path: |
|
|
||||||
bin/Release/net8.0
|
|
||||||
|
|
||||||
- name: Publish net90
|
- name: Publish x64 libraries
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: LibreHardwareMonitorLib-net90
|
name: LibreHardwareMonitorLib (x64)
|
||||||
path: |
|
path: |
|
||||||
bin/Release/net9.0
|
bin/Release/x64
|
||||||
|
|
||||||
|
- name: Build x86 libraries
|
||||||
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:Platform=x86
|
||||||
|
|
||||||
|
- name: Publish x86 libraries
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: LibreHardwareMonitorLib (x86)
|
||||||
|
path: |
|
||||||
|
bin/Release/x86
|
||||||
|
|
||||||
|
- name: Build reference libraries
|
||||||
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:BuildOnlyRefs=true
|
||||||
|
|
||||||
|
- name: Pack main nupkg
|
||||||
|
run: dotnet pack LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release -p:PackMainNuget=true --no-build --output bin\Release
|
||||||
|
|
||||||
- name: Publish nupkg
|
- name: Publish nupkg
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
@@ -19,12 +19,19 @@
|
|||||||
<PackageIcon>packageicon.png</PackageIcon>
|
<PackageIcon>packageicon.png</PackageIcon>
|
||||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||||
<Platforms>x64;x86</Platforms>
|
<Platforms>x64;x86</Platforms>
|
||||||
|
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
|
||||||
|
<NoWarn>$(NoWarn);CA1416</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(BuildOnlyRefs)'=='true'">
|
||||||
|
<Platform>AnyCPU</Platform>
|
||||||
|
<ProduceOnlyReferenceAssembly>true</ProduceOnlyReferenceAssembly>
|
||||||
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
<OutputPath>..\bin\Debug\</OutputPath>
|
<OutputPath>..\bin\Debug\$(Platform)\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||||
<OutputPath>..\bin\Release\</OutputPath>
|
<OutputPath>..\bin\Release\$(Platform)\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
@@ -63,4 +70,5 @@
|
|||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<Import Project="main.nuget.target" Condition="'$(PackMainNuget)' == 'true'" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<!-- For packing the multi-platform nuget after building x64, x86 and reference libs -->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
|
<NoWarn>$(NoWarn);NU5131</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\bin\$(Configuration)\x64\**\LibreHardwareMonitorLib.dll" Pack="true">
|
||||||
|
<PackagePath>runtimes\win-x64\lib\</PackagePath>
|
||||||
|
</None>
|
||||||
|
<None Include="..\bin\$(Configuration)\x64\**\LibreHardwareMonitorLib.xml" Pack="true">
|
||||||
|
<PackagePath>runtimes\win-x64\lib\</PackagePath>
|
||||||
|
</None>
|
||||||
|
<None Include="..\bin\$(Configuration)\x86\**\LibreHardwareMonitorLib.dll" Pack="true">
|
||||||
|
<PackagePath>runtimes\win-x86\lib\</PackagePath>
|
||||||
|
</None>
|
||||||
|
<None Include="..\bin\$(Configuration)\x86\**\LibreHardwareMonitorLib.xml" Pack="true">
|
||||||
|
<PackagePath>runtimes\win-x86\lib\</PackagePath>
|
||||||
|
</None>
|
||||||
|
<None Include="..\bin\$(Configuration)\AnyCPU\**\LibreHardwareMonitorLib.dll" Pack="true">
|
||||||
|
<PackagePath>ref\</PackagePath>
|
||||||
|
</None>
|
||||||
|
<None Include="..\bin\$(Configuration)\AnyCPU\**\LibreHardwareMonitorLib.xml" Pack="true">
|
||||||
|
<PackagePath>ref\</PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user