Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try fixing GitVersion when running parallel builds #61

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/features-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
push:
branches:
- '*'
- '*/*'
- '!master' # all branches except master
pull_request:
branches:
- '*'
- '*/*'
- '!master' # all branches except master

env:
Expand All @@ -34,25 +36,25 @@ jobs:
dotnet-version: 3.1.200

- name: Restore library
run: dotnet restore src/BlazorLazyLoading.sln --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet restore src/BlazorLazyLoading.sln -p:BLLUseLocalNugetPackages=true

- name: Build library
run: dotnet build src/BlazorLazyLoading.sln -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet build src/BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Test library
run: dotnet test src/BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Pack library
run: dotnet pack src/BlazorLazyLoading.sln -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet pack src/BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Restore demo
run: dotnet restore demo/Demo.sln --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet restore demo/Demo.sln -p:BLLUseLocalNugetPackages=true

- name: Build demo
run: dotnet build demo/Demo.sln -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet build demo/Demo.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Publish demo
run: dotnet publish demo/ServerHost/ServerHost.csproj -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true -o output/demo
run: dotnet publish demo/ServerHost/ServerHost.csproj -c Release -p:BLLUseLocalNugetPackages=true -o output/demo

- name: Test demo
run: dotnet test demo/Demo.sln -c Release -p:BLLUseLocalNugetPackages=true
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ jobs:
dotnet-version: 3.1.200

- name: Restore library
run: dotnet restore src/BlazorLazyLoading.sln --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet restore src/BlazorLazyLoading.sln -p:BLLUseLocalNugetPackages=true

- name: Build library
run: dotnet build src/BlazorLazyLoading.sln -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet build src/BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Test library
run: dotnet test src/BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Pack library
run: dotnet pack src/BlazorLazyLoading.sln -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet pack src/BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Restore demo
run: dotnet restore demo/Demo.sln --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet restore demo/Demo.sln -p:BLLUseLocalNugetPackages=true

- name: Build demo
run: dotnet build demo/Demo.sln -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true
run: dotnet build demo/Demo.sln -c Release -p:BLLUseLocalNugetPackages=true

- name: Publish demo
run: dotnet publish demo/ServerHost/ServerHost.csproj -c Release --disable-parallel -p:BLLUseLocalNugetPackages=true -o output/demo
run: dotnet publish demo/ServerHost/ServerHost.csproj -c Release -p:BLLUseLocalNugetPackages=true -o output/demo

- name: Test demo
run: dotnet test demo/Demo.sln -c Release -p:BLLUseLocalNugetPackages=true
Expand Down
1 change: 1 addition & 0 deletions src/BlazorLazyLoading.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuget", "nuget", "{593AE082-BD15-4FEB-8DC2-20D4ABA3AFD4}"
ProjectSection(SolutionItems) = preProject
nuget\Directory.Build.props = nuget\Directory.Build.props
nuget\GitVersion.proj_ = nuget\GitVersion.proj_
nuget\NugetCommon.props = nuget\NugetCommon.props
EndProjectSection
EndProject
Expand Down
1 change: 1 addition & 0 deletions src/nuget/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Import Project="$(MSBuildThisFileDirectory)NugetCommon.props" />

<!-- set package icon -->
<!-- we only want the icon on main packages, not internal -->
<PropertyGroup>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>
Expand Down
18 changes: 18 additions & 0 deletions src/nuget/GitVersion.proj_
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project>

<PropertyGroup>
<Temp Condition="'$(Temp)' == ''">/tmp</Temp>
<BaseIntermediateOutputPath>$(Temp)/$(SolutionName)/GitVersion/obj</BaseIntermediateOutputPath>
<OutputPath>$(Temp)/$(SolutionName)/GitVersion/bin</OutputPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)/Microsoft.Common.CurrentVersion.targets" />
<Import Project="$(BaseIntermediateOutputPath)/$(MSBuildThisFileName)$(MSBuildThisFileExtension).nuget.g.targets" Condition="Exists('$(BaseIntermediateOutputPath)/$(MSBuildThisFileName)$(MSBuildThisFileExtension).nuget.g.targets')" />
<ItemGroup>
<PackageReference Include="GitVersionTask" Version="5.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="Build" DependsOnTargets="GetVersion;WriteVersionInfoToBuildLog" Returns="$(GitVersion_NuGetVersion)" />

</Project>
21 changes: 13 additions & 8 deletions src/nuget/NugetCommon.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<Project>

<ItemGroup>
<PackageReference Include="GitVersionTask" Version="5.2.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup>
<PackageOutputDir>$(RepoDir)output\nuget</PackageOutputDir>
Expand All @@ -32,7 +25,19 @@
<Copyright>Ivan Sanz Carasa (isc30)</Copyright>
</PropertyGroup>

<Target Name="SetNuspecProperties" BeforeTargets="Build;Pack;Restore">
<Target Name="GetVersion" BeforeTargets="DispatchToInnerBuilds;BeforeBuild;CoreBuild;GetAssemblyVersion;CoreCompile;GenerateNuspec;Pack">
<!-- Keep restore separate and include extra property to prevent caching (restore and other targets in same MSBuild call is not a scenario supported by MSBuild) -->
<MSBuild Projects="$(MSBuildThisFileDirectory)GitVersion.proj_" Targets="Restore" Properties="SolutionDir=$(SolutionDir);SolutionName=$(SolutionName);Restoring=true" />
<MSBuild Projects="$(MSBuildThisFileDirectory)GitVersion.proj_" Targets="Build" Properties="SolutionDir=$(SolutionDir);SolutionName=$(SolutionName)">
<Output TaskParameter="TargetOutputs" PropertyName="Version" />
</MSBuild>
<PropertyGroup>
<PackageVersion>$(Version)</PackageVersion>
</PropertyGroup>
<Message Text="GitVersion: $(Version)" Importance="high" />
</Target>

<Target Name="SetNuspecProperties" AfterTargets="GetVersion">
<Message Importance="normal" Text="Stamping MsBuild vars into Nuspec" />
<PropertyGroup>
<NuspecProperties>$(NuspecProperties);configuration=$(Configuration)</NuspecProperties>
Expand Down