GitHub Actions: Cache nuget packages

This commit is contained in:
Genteure 2021-05-02 22:52:52 +08:00
parent 329f123bea
commit 72161a3e65

View File

@ -7,6 +7,7 @@ on:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
@ -20,6 +21,13 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache Nuget Packages
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore Packages
run: dotnet restore -v m
- name: Run Tests
@ -36,6 +44,13 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache Nuget Packages
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Restore Packages
@ -60,6 +75,13 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache Nuget Packages
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore Packages
run: dotnet restore -v m
- name: Build CLI