From e6ae12f7813effed6bce142e4962902bd6e4b5b3 Mon Sep 17 00:00:00 2001 From: Justin Nelson Date: Thu, 7 Dec 2023 14:43:16 -0800 Subject: [PATCH] Test Caching NuGet Dependencies for Linux and Windows GitHub Actions --- .github/workflows/8_0_Core_Unit_Tests_Linux.yaml | 9 +++++++++ .github/workflows/8_0_Core_Unit_Tests_Win.yaml | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/8_0_Core_Unit_Tests_Linux.yaml b/.github/workflows/8_0_Core_Unit_Tests_Linux.yaml index 4a4215c88..859f05302 100644 --- a/.github/workflows/8_0_Core_Unit_Tests_Linux.yaml +++ b/.github/workflows/8_0_Core_Unit_Tests_Linux.yaml @@ -66,6 +66,15 @@ jobs: - name: Pull step-ca Docker Image run: docker pull smallstep/step-ca + - name: Cache NuGet Dependencies + uses: actions/cache@v3 + with: + path: $HOME/.nuget/packages + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-nuget-${{ hashFiles('./certify/src/Certify.Tests/Certify.Core.Tests.Unit/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget + - name: Install Dependencies & Build Certify.Core.Tests.Unit run: | dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.2.0 diff --git a/.github/workflows/8_0_Core_Unit_Tests_Win.yaml b/.github/workflows/8_0_Core_Unit_Tests_Win.yaml index a994eb62e..9a3ad38ce 100644 --- a/.github/workflows/8_0_Core_Unit_Tests_Win.yaml +++ b/.github/workflows/8_0_Core_Unit_Tests_Win.yaml @@ -67,13 +67,22 @@ jobs: - name: Pull step-ca Docker Image run: docker pull jrnelson90/step-ca-win + - name: Cache NuGet Dependencies + uses: actions/cache@v3 + with: + path: C:\%HOME_PATH%\.nuget\packages + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-nuget-${{ hashFiles('./certify/src/Certify.Tests/Certify.Core.Tests.Unit/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget + - name: Install Dependencies & Build Certify.Core.Tests.Unit run: | dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.2.0 dotnet add package GitHubActionsTestLogger dotnet build -c Debug -f net8.0 --property WarningLevel=0 /clp:ErrorsOnly working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit - + - name: Run Certify.Core.Tests.Unit Tests run: | $env:GITHUB_WORKSPACE="$env:GITHUB_WORKSPACE\certify"