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 11, 2023
1 parent 4dc7b12 commit 6de148d
Show file tree
Hide file tree
Showing 24 changed files with 138,282 additions and 9 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
15 changes: 12 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
<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>
<WarningsAsErrors>$(WarningsAsErrors);NU1601;NU1603;NU1605;NU1608;NU1701</WarningsAsErrors>
<ContinuousIntegrationBuild Condition="'$(CI)'!=''">true</ContinuousIntegrationBuild>
</PropertyGroup>

<!-- NuGet lock file & restore behavior-->
<PropertyGroup>
<!--Support for different operating systems. Last RID is specifically for .NET 4.x -->
<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>
7 changes: 7 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ nuget:
project_feed: true
# disable_publish_on_pr: true
before_build:
- dotnet nuget locals global-packages --clear # AppVeyor's default NuGet global cache has invalid package references... :|
- dotnet restore
build:
project: IbanNet.sln
Expand Down
Loading

0 comments on commit 6de148d

Please sign in to comment.