Skip to content

Commit

Permalink
Follow reproducible builds best practices for package (#44)
Browse files Browse the repository at this point in the history
* Upload .nupkg as build artifact

* Make builds reproducible
  • Loading branch information
MattKotsenas authored Jun 3, 2024
1 parent d8b5eb1 commit 0b7fcd6
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 37 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ jobs:
path: ./artifacts/logs
if-no-files-found: error

# TODO: Wire up building packages. Tracked by #13.
# - name: Upload packages
# uses: actions/upload-artifact@v4
# with:
# name: packages-${{ matrix.os }}
# path: |
# ./artifacts/package
# if-no-files-found: error
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.os }}
path: |
./artifacts/package
if-no-files-found: error

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<Import Project="build/targets/artifacts/Artifacts.props" />
<Import Project="build/targets/compiler/Compiler.props" />
<Import Project="build/targets/reproducible/Reproducible.props" />
<Import Project="build/targets/versioning/Versioning.props" />
<Import Project="build/targets/tests/Tests.props" />
</Project>
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>
<Import Project="build/targets/artifacts/Artifacts.targets" />
<Import Project="build/targets/compiler/Compiler.targets" />
<Import Project="build/targets/reproducible/Reproducible.targets" />
<Import Project="build/targets/versioning/Versioning.targets" />
<Import Project="build/targets/tests/Tests.targets" />
</Project>
5 changes: 4 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<Import Project="build/targets/reproducible/Packages.props" />

<ItemGroup>
<PackageVersion Include="GetPackFromProject" Version="1.0.6" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.3" />
Expand All @@ -12,7 +15,7 @@
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="Roslynator.Analyzers" Version="2.1.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageVersion Include="Verify.Nupkg" Version="1.1.1" />
<PackageVersion Include="Verify.Nupkg" Version="1.1.5" />
<PackageVersion Include="Verify.Xunit" Version="24.2.0" />
<PackageVersion Include="xunit" Version="2.8.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<releaseNotes>Upgraded to support Visual Studio 2019</releaseNotes>
<copyright>2015-2019 Andrey Lipatkin</copyright>
<tags>moq, mock, test, analyzers</tags>
<repository type="git" commit="****************************************" />
<repository type="git" url="https://github.com/********/moq.analyzers.git" commit="****************************************" />
<dependencies>
<group targetFramework=".NETStandard2.0" />
</dependencies>
Expand Down
30 changes: 3 additions & 27 deletions Source/Moq.Analyzers/Moq.Analyzers.csproj
Original file line number Diff line number Diff line change
@@ -1,34 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProjectGuid>{41ECC571-F586-460A-9BED-23528C8210C4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Moq.Analyzers</RootNamespace>
<AssemblyName>Moq.Analyzers</AssemblyName>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFramework>netstandard2.0</TargetFramework>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>

<PropertyGroup>
<PropertyGroup Label="Package metadata">
<PackageId>Moq.Analyzers</PackageId>
<Authors>Andrey "Litee" Lipatkin</Authors>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
Expand All @@ -40,8 +19,6 @@
<Copyright>2015-2019 Andrey Lipatkin</Copyright>
<PackageTags>moq, mock, test, analyzers</PackageTags>
<DevelopmentDependency>true</DevelopmentDependency>
<NoPackageAnalysis>true</NoPackageAnalysis>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand All @@ -55,7 +32,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="NETStandard.Library" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions build/targets/reproducible/Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<ItemGroup>
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.1.1" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions build/targets/reproducible/Reproducible.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<Sdk Name="DotNet.ReproducibleBuilds.Isolated"/>

<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds" PrivateAssets="All" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions build/targets/reproducible/Reproducible.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"sdk": {
"version": "8.0.101",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
"DotNet.ReproducibleBuilds.Isolated": "1.1.1"
}
}

0 comments on commit 0b7fcd6

Please sign in to comment.