ci: add NuGet packages.lock.json and cache NuGet folder #717
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Core | |
on: [push, pull_request] | |
jobs: | |
dotnet: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
7.0.x | |
6.0.x | |
5.0.x | |
3.1.x | |
- 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 | |
# Unfortunatey, it becomes preinstalled with latest GitHub runner images, so have to remove it for now. | |
- name: Remove latest .NET SDK (7.0.400) | |
if: matrix.os != 'windows-latest' | |
run: sudo rm -rf ${DOTNET_ROOT}/sdk/7.0.400 | |
- run: dotnet test -c Release |