Skip to content

Commit

Permalink
Cache GitHub Actions (#565)
Browse files Browse the repository at this point in the history
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 <actions/setup-dotnet#260 (comment)>
  • Loading branch information
dalyIsaac authored Nov 3, 2023
1 parent 8111d95 commit 21ab975
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: |
Expand Down

0 comments on commit 21ab975

Please sign in to comment.