Skip to content

Enable RollForward to run on the latest .NET SDKs #1357

Enable RollForward to run on the latest .NET SDKs

Enable RollForward to run on the latest .NET SDKs #1357

Workflow file for this run

# For details of what checks are run for PRs please refer below
name: .NET Core CI
on: [pull_request, workflow_dispatch]
jobs:
# Fail if there are build warnings
#
# As a general code quality check we use FxCop analyzers.
#
# To check for build warnings locally you may need to run a clean build.
#
# This can be done by running `dotnet clean` before running `dotnet build`
build-warnings:
name: Build warnings check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/[email protected]
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.x
- name: Build
run: dotnet build /WarnAsError
# Fail if there are any failed tests
#
# We support all current LTS versions of .NET Core and Windows, Mac and Linux.
#
# To check for failing tests locally run `dotnet test`.
#
# Although you can build previous versions of .NET Core projects with the
# latest SDK you can't run them. So to run tests for all target versions you
# will need all current LTS version runtimes installed.
#
# If installing all required runtimes is problematic you can specify a
# particular version like this `dotnet test --framework netcoreapp2.1`.
test:
name: Tests for .net core ${{ matrix.framework }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
framework: ['net6.0','net7.0', 'net8.0']
timeout-minutes: 30
steps:
- uses: actions/[email protected]
- name: Setup dotnet 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Setup dotnet 7
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.x'
- name: Setup dotnet 6
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'
- name: Tests
run: dotnet test --framework ${{ matrix.framework }} --collect:"XPlat Code Coverage;Format=cobertura" --results-directory "TestResults"
# see https://github.com/danielpalme/ReportGenerator/blob/main/.github/workflows/ci.yml
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@v5
with:
reports: 'TestResults/**/coverage.cobertura.xml'
targetdir: 'coveragereport'
reporttypes: 'HtmlInline;Cobertura;MarkdownSummaryGithub'
# Error: Resource not accessible by integration => permission issue
# - name: Add Coverage PR Comment
# uses: marocchino/sticky-pull-request-comment@v2
# if: github.event_name == 'pull_request'
# with:
# recreate: true
# path: ./coveragereport/SummaryGithub.md
- name: Write to Job Summary
run: cat ./coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
shell: bash
- name: Upload coverage report artifact
if: ${{ matrix.os == 'ubuntu-latest' && matrix.framework == 'net8.0' }}
uses: actions/upload-artifact@v4
with:
name: CoverageReport_${{ matrix.framework }}_${{ matrix.os }}
path: coveragereport