Create dotnet.yml

This commit is contained in:
XY Wang 2021-09-20 18:14:03 +08:00 committed by GitHub
parent 1cd33779d3
commit 9bc6a2eb8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

56
.github/workflows/dotnet.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: .NET Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# 安装 .NET Core
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.202
# 添加 MSBuild.exe 到环境变量: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@2008f912f56e61277eefaac6d1888b750582aa16
# 安装 NuGet
- name: Setup NuGet
uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NuGetAPIKey }}
nuget-version: '5.x'
# 还原 NuGet 包
- name: NuGet restore
run: nuget restore
# 编译整个项目
- name: Build the solution
run: msbuild /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
# 执行单元测试
- name: Execute unit tests
run: dotnet test -c $env:Configuration
env:
Configuration: ${{ matrix.configuration }}