Skip to content

Commit

Permalink
migrate to minver from gitversion
Browse files Browse the repository at this point in the history
  • Loading branch information
tocsoft committed Jul 17, 2020
1 parent 8c13075 commit 298d814
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 63 deletions.
42 changes: 4 additions & 38 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,14 @@ jobs:
git fetch --prune --unshallow
git submodule -q update --init --recursive
- name: Fetch Tags for GitVersion
run: |
git fetch --tags
- name: Fetch master for GitVersion
if: github.ref != 'refs/heads/master'
run: git branch --create-reflog master origin/master

- name: Install GitVersion
uses: gittools/actions/[email protected]
with:
versionSpec: "5.1.x"

- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/[email protected]

- name: Setup DotNet SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.101"
dotnet-version: "3.1.x"

- name: Pack
shell: pwsh
run: ./ci-pack.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
run: ./ci-pack.ps1

- name: Publish to MyGet
shell: pwsh
Expand Down Expand Up @@ -104,31 +87,14 @@ jobs:
git fetch --prune --unshallow
git submodule -q update --init --recursive
- name: Fetch Tags for GitVersion
run: |
git fetch --tags
- name: Fetch master for GitVersion
if: github.ref != 'refs/heads/master'
run: git branch --create-reflog master origin/master

- name: Install GitVersion
uses: gittools/actions/[email protected]
with:
versionSpec: "5.1.x"

- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/[email protected]

- name: Setup DotNet SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.101"
dotnet-version: "3.1.x"

- name: Build
shell: pwsh
run: ./ci-build.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
run: ./ci-build.ps1

- name: Test
shell: pwsh
Expand Down
7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<DebugType Condition="'$(codecov)' != ''">full</DebugType>
<NullableContextOptions>disable</NullableContextOptions>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>false</SignAssembly>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
</PropertyGroup>

Expand Down Expand Up @@ -73,6 +72,12 @@
<VersionSuffix></VersionSuffix>
</PropertyGroup>

<!--MinVer Properties for versioning-->
<PropertyGroup>
<MinVerTagPrefix>v</MinVerTagPrefix>
<MinVerVerbosity>normal</MinVerVerbosity>
</PropertyGroup>

<!-- Default settings that are otherwise undefined -->
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)shared-infrastructure/SixLabors.snk</AssemblyOriginatorKeyFile>
Expand Down
5 changes: 4 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.3.1" PrivateAssets="All" />
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
<PackageReference Update="StyleCop.Analyzers" PrivateAssets="All" Version="1.1.118" />


<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Update="MinVer" PrivateAssets="All" Version="2.3.0" />

<!--Src Dependencies-->
<PackageReference Update="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Update="System.IO.Compression" Version="4.3.0" />
Expand Down
7 changes: 0 additions & 7 deletions GitVersion.yml

This file was deleted.

7 changes: 1 addition & 6 deletions ci-build.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
param(
[Parameter(Mandatory, Position = 0)]
[string]$version
)

dotnet clean -c Release

$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"

# Building for packing and publishing.
dotnet build -c Release /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
dotnet build -c Release /p:RepositoryUrl=$repositoryUrl
7 changes: 1 addition & 6 deletions ci-pack.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
param(
[Parameter(Mandatory, Position = 0)]
[string]$version
)

dotnet clean -c Release

$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"

# Building for packing and publishing.
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:RepositoryUrl=$repositoryUrl
13 changes: 13 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<!--Add deterministic builds in CI-->
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<!--TODO: Delete this once tests Stylecop issues are fixed-->
<PackageReference Include="StyleCop.Analyzers" IsImplicitlyDefined="true" />
Expand Down
12 changes: 12 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
<GeneratedInternalsVisibleToFile Condition="'$(GeneratedInternalsVisibleToFile)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).InternalsVisibleTo$(DefaultLanguageSourceExtension)</GeneratedInternalsVisibleToFile>
</PropertyGroup>

<!-- Workaround for running Coverlet with Determenistic builds -->
<!-- https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/DeterministicBuild.md -->
<Target Name="CoverletGetPathMap"
DependsOnTargets="InitializeSourceRootMappedPaths"
Returns="@(_LocalTopLevelSourceRoot)"
Condition="'$(DeterministicSourcePaths)' == 'true'">
<ItemGroup>
<_LocalTopLevelSourceRoot Include="@(SourceRoot)" Condition="'%(SourceRoot.NestedRoot)' == ''"/>
</ItemGroup>
</Target>


<ItemDefinitionGroup>
<InternalsVisibleTo>
<Visible>false</Visible>
Expand Down
6 changes: 4 additions & 2 deletions src/SixLabors.Fonts/SixLabors.Fonts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
<PackageReference Include="System.Buffers" />
<PackageReference Include="System.Memory" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
<PackageReference Include="Microsoft.SourceLink.GitHub"/>
<PackageReference Include="MinVer" PrivateAssets="All" />
</ItemGroup>

<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />
Expand Down
4 changes: 2 additions & 2 deletions tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
<!--https://github.com/actions/setup-dotnet/issues/72-->
<DotNetCliToolReference Update="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<!--Test Dependencies-->
<PackageReference Update="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Update="coverlet.collector" Version="1.2.0" PrivateAssets="All"/>
<PackageReference Update="coverlet.collector" Version="1.3.0" PrivateAssets="All"/>
<PackageReference Update="coverlet.msbuild" Version="2.8.0" PrivateAssets="All"/>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.5.0-preview-20200116-01" />
<PackageReference Update="Moq" Version="4.10.0" />
Expand Down

0 comments on commit 298d814

Please sign in to comment.