Include .NET 5 in all builds and check test status (#826)

Signed-off-by: Hal Spang <halspang@microsoft.com>
This commit is contained in:
halspang 2022-01-28 08:33:10 -08:00 committed by GitHub
parent 8ba4234578
commit a8acdea23f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 5 deletions

View File

@ -23,16 +23,19 @@ jobs:
include: include:
- dotnet-version: '3.1' - dotnet-version: '3.1'
install-3: true install-3: true
install-5: false
display-name: '.NET Core 3.1' display-name: '.NET Core 3.1'
framework: 'netcoreapp3.1' framework: 'netcoreapp3.1'
prefix: 'netcoreapp31' prefix: 'netcoreapp31'
- dotnet-version: '5.0' - dotnet-version: '5.0'
install-3: false install-3: false
install-5: true
display-name: '.NET 5.0' display-name: '.NET 5.0'
framework: 'net5' framework: 'net5'
prefix: 'net5' prefix: 'net5'
- dotnet-version: '6.0' - dotnet-version: '6.0'
install-3: false install-3: false
install-5: false
display-name: '.NET 6.0' display-name: '.NET 6.0'
framework: 'net6' framework: 'net6'
prefix: 'net6' prefix: 'net6'
@ -112,7 +115,12 @@ jobs:
if: matrix.install-3 if: matrix.install-3
with: with:
dotnet-version: 3.1.x dotnet-version: 3.1.x
- name: Setup .NET 6.0 - name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
if: matrix.install-5
with:
dotnet-version: 5.0.x
- name: Setup .NET 6.0 # We always need 6.0 to build.
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: 6.0.x dotnet-version: 6.0.x
@ -120,6 +128,7 @@ jobs:
# disable deterministic builds, just for test run. Deterministic builds break coverage for some reason # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason
run: dotnet build --configuration release /p:GITHUB_ACTIONS=false run: dotnet build --configuration release /p:GITHUB_ACTIONS=false
- name: Run Test - name: Run Test
id: tests
continue-on-error: true # proceed if tests fail, the report step will report the failure with more details. continue-on-error: true # proceed if tests fail, the report step will report the failure with more details.
run: | run: |
dotnet test ${{ github.workspace }}/test/Dapr.E2E.Test/Dapr.E2E.Test.csproj \ dotnet test ${{ github.workspace }}/test/Dapr.E2E.Test/Dapr.E2E.Test.csproj \
@ -133,6 +142,9 @@ jobs:
/p:CollectCoverage=true \ /p:CollectCoverage=true \
/p:CoverletOutputFormat=opencover \ /p:CoverletOutputFormat=opencover \
/p:GITHUB_ACTIONS=false /p:GITHUB_ACTIONS=false
- name: Check test failure in PR
if: github.event_name == 'pull_request' && steps.tests.outcome != 'success'
run: exit 1
- name: Upload test coverage - name: Upload test coverage
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
with: with:

View File

@ -46,16 +46,19 @@ jobs:
include: include:
- dotnet-version: '3.1' - dotnet-version: '3.1'
install-3: true install-3: true
install-5: false
display-name: '.NET Core 3.1' display-name: '.NET Core 3.1'
framework: 'netcoreapp3.1' framework: 'netcoreapp3.1'
prefix: 'netcoreapp31' prefix: 'netcoreapp31'
- dotnet-version: '5.0' - dotnet-version: '5.0'
install-3: false install-3: false
install-5: true
display-name: '.NET 5.0' display-name: '.NET 5.0'
framework: 'net5' framework: 'net5'
prefix: 'net5' prefix: 'net5'
- dotnet-version: '6.0' - dotnet-version: '6.0'
install-3: false install-3: false
install-5: false
display-name: '.NET 6.0' display-name: '.NET 6.0'
framework: 'net6' framework: 'net6'
prefix: 'net6' prefix: 'net6'
@ -68,7 +71,12 @@ jobs:
if: matrix.install-3 if: matrix.install-3
with: with:
dotnet-version: 3.1.x dotnet-version: 3.1.x
- name: Setup .NET 6.0 - name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
if: matrix.install-5
with:
dotnet-version: 5.0.x
- name: Setup .NET 6.0 # We always need 6.0 to build.
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: 6.0.x dotnet-version: 6.0.x
@ -76,7 +84,8 @@ jobs:
# disable deterministic builds, just for test run. Deterministic builds break coverage for some reason # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason
run: dotnet build --configuration release /p:GITHUB_ACTIONS=false run: dotnet build --configuration release /p:GITHUB_ACTIONS=false
- name: Test - name: Test
continue-on-error: true # proceed if tests fail, the report step will report the failure with more details. id: tests
continue-on-error: true # proceed if tests fail to allow for the report generation in master or next step failure in PR
run: | run: |
dotnet test \ dotnet test \
--configuration release \ --configuration release \
@ -90,6 +99,9 @@ jobs:
/p:CollectCoverage=true \ /p:CollectCoverage=true \
/p:CoverletOutputFormat=opencover \ /p:CoverletOutputFormat=opencover \
/p:GITHUB_ACTIONS=false /p:GITHUB_ACTIONS=false
- name: Check test failure in PR
if: github.event_name == 'pull_request' && steps.tests.outcome != 'success'
run: exit 1
- name: Upload test coverage - name: Upload test coverage
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
with: with:

View File

@ -1,4 +1,4 @@
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Copyright 2021 The Dapr Authors // Copyright 2021 The Dapr Authors
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -124,7 +124,18 @@ namespace Dapr.E2E.Test
{ {
var targetFrameworkName = ((TargetFrameworkAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(TargetFrameworkAttribute), false).FirstOrDefault()).FrameworkName; var targetFrameworkName = ((TargetFrameworkAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(TargetFrameworkAttribute), false).FirstOrDefault()).FrameworkName;
string frameworkMoniker; string frameworkMoniker;
frameworkMoniker = targetFrameworkName == ".NETCoreApp,Version=v3.1" ? "netcoreapp3.1" : "net5"; if (targetFrameworkName == ".NETCoreApp,Version=v3.1")
{
frameworkMoniker = "netcoreapp3.1";
}
else if (targetFrameworkName == ".NETCoreApp,Version=v5.0")
{
frameworkMoniker = "net5";
}
else
{
frameworkMoniker = "net6";
}
return frameworkMoniker; return frameworkMoniker;
} }