From 21ab97579efd6d32fbcb36e55a0225f85b9c08eb Mon Sep 17 00:00:00 2001 From: Isaac Daly Date: Fri, 3 Nov 2023 22:20:21 +1100 Subject: [PATCH] Cache GitHub Actions (#565) Improved `commit` workflow job times from an average of 8m to: - 6m 30s uncached - 5m 30s cached Times were improved by: - Adding caching - Installing packages to the `D:\` drive, as described in --- .github/workflows/commit.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 4611d491a..47f583d30 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -15,6 +15,11 @@ on: - ".github/pull_request_template.md" - "README.md" +env: + # We install the packages to the D:\ drive to avoid the slow IO on the C:\ drive. + # Based on https://github.com/actions/setup-dotnet/issues/260#issuecomment-1790162905 + NUGET_PACKAGES: D:\a\.nuget\packages + jobs: commit: strategy: @@ -26,7 +31,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ${{ env.NUGET_PACKAGES }} + key: ${{ matrix.platform }}-nuget-${{ hashFiles('Directory.Packages.props') }} + restore-keys: | + ${{ matrix.platform }}-nuget-${{ hashFiles('Directory.Packages.props') }} + ${{ matrix.platform }}-nuget- - name: Restore dependencies run: |