Skip to content

Commit

Permalink
ci: add NuGet packages.lock.json and cache NuGet folder
Browse files Browse the repository at this point in the history
  • Loading branch information
skwasjer committed Nov 10, 2023
1 parent 4dc7b12 commit 0e4f7a4
Show file tree
Hide file tree
Showing 22 changed files with 138,272 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ jobs:
- name: Remove latest .NET SDK (7.0.400)
run: sudo rm -rf ${DOTNET_ROOT}/sdk/7.0.400

- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ jobs:
- name: dotnet info
run: dotnet --info

- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
# https://github.com/actions/runner-images/blob/ubuntu22/20230821.1/images/linux/Ubuntu2204-Readme.md
# There is an issue with latest SDK on Linux with .NET Framework:
# https://github.com/microsoft/vstest/issues/4549
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ jobs:
- name: Remove latest .NET SDK (7.0.400)
run: sudo rm -rf ${DOTNET_ROOT}/sdk/7.0.400

- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install Sonar scanner
run: dotnet tool install --global dotnet-sonarscanner

Expand Down
12 changes: 10 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>$(NoWarn);IDE0079;S1135;CA1510;CA1511;CA1512;CA1513</NoWarn>
<NoWarn Condition="'$(Configuration)'=='Release'">$(NoWarn);NETSDK1138</NoWarn>
<WarningsAsErrors>$(WarningsAsErrors);NU1605;NU1701</WarningsAsErrors>
<ContinuousIntegrationBuild Condition="'$(Configuration)'=='Release'">true</ContinuousIntegrationBuild>
<ContinuousIntegrationBuild Condition="'$(CI)'!=''">true</ContinuousIntegrationBuild>
</PropertyGroup>

<!-- NuGet lock file & restore behavior-->
<PropertyGroup>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;win7-x86</RuntimeIdentifiers>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<AutomaticallyUseReferenceAssemblyPackages>false</AutomaticallyUseReferenceAssemblyPackages>
<RestoreLockedMode Condition="'$(ContinuousIntegrationBuild)'=='true'">true</RestoreLockedMode>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<PropertyGroup>
Expand Down
9 changes: 9 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<Project>

<ItemGroup>
<Using Remove="System.Net.Http" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
Loading

0 comments on commit 0e4f7a4

Please sign in to comment.