Skip to content

Test net8.0/net9.0 separately #38

Test net8.0/net9.0 separately

Test net8.0/net9.0 separately #38

Workflow file for this run

name: default
env:
DOTNET_NOLOGO: true
on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
cache: true
cache-dependency-path: ./**/packages.lock.json
dotnet-version: |
8.0.x
9.0.x
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: Build solution
run: dotnet build --configuration Release --no-restore
test:
needs: [build]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
cache: true
cache-dependency-path: ./**/packages.lock.json
dotnet-version: |
8.0.x
9.0.x
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: Run tests (net8.0)
run: foreach( $project in Get-ChildItem "ESCd.Extensions.*.Tests.csproj" -Recurse ) { dotnet test "$($project.FullName)" -f net8.0 --no-restore --results-directory TestResultsNet80 --logger "trx;logFileName=$($project.BaseName).trx" --collect:"XPlat Code Coverage" /p:WarningLevel=0 -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true }
shell: pwsh
- name: Upload artifact 'test-results-net80'
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results-net80
path: TestResultsNet80
- name: Report test results (net8.0)
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: test results (net8.0)
path: TestResultsNet80/**/*.trx
reporter: dotnet-trx
- name: Generate coverage results (net8.0)
uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: TestResultsNet80/**/coverage.cobertura.xml
reporttypes: "Cobertura;MarkdownSummary"
targetdir: CoverageResultsNet80
title: coverage results (net8.0)
- name: Upload artifact 'coverage-results-net80'
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: coverage-results-net80
path: CoverageResultsNet80
- name: Report coverage results (net8.0)
uses: cryptoc1/cobertura-action@master
if: success() || failure()
with:
fail_below_threshold: false
link_missing_lines: true
minimum_coverage: 80
path: CoverageResultsNet80/Cobertura.xml
repo_token: ${{ secrets.GITHUB_TOKEN }}
report_name: coverage results (net8.0)
show_branch: false
show_class_names: true
show_missing: true
skip_covered: false
- name: Run tests (net9.0)
run: foreach( $project in Get-ChildItem "ESCd.Extensions.*.Tests.csproj" -Recurse ) { dotnet test "$($project.FullName)" -f net9.0 --no-restore --results-directory TestResultsNet90 --logger "trx;logFileName=$($project.BaseName).trx" --collect:"XPlat Code Coverage" /p:WarningLevel=0 -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true }
shell: pwsh
- name: Upload artifact 'test-results-net90'
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results-net90
path: TestResultsNet90
- name: Report test results (net9.0)
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: test results (net9.0)
path: TestResultsNet90/**/*.trx
reporter: dotnet-trx
- name: Generate coverage results (net9.0)
uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: TestResultsNet90/**/coverage.cobertura.xml
reporttypes: "Cobertura;MarkdownSummary"
targetdir: CoverageResultsNet90
title: coverage results (net9.0)
- name: Upload artifact 'coverage-results-net90'
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: coverage-results-net90
path: CoverageResultsNet90
- name: Report coverage results (net9.0)
uses: cryptoc1/cobertura-action@master
if: success() || failure()
with:
fail_below_threshold: false
link_missing_lines: true
minimum_coverage: 80
path: CoverageResultsNet90/Cobertura.xml
repo_token: ${{ secrets.GITHUB_TOKEN }}
report_name: coverage results (net9.0)
show_branch: false
show_class_names: true
show_missing: true
skip_covered: false
- name: Publish coverage results
if: success() || failure()
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
pack:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
cache: true
cache-dependency-path: ./**/packages.lock.json
dotnet-version: |
8.0.x
9.0.x
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: Create packages
run: dotnet pack --configuration Release --output dist /p:WarningLevel=0
- name: Upload artifact 'packages'
uses: actions/upload-artifact@v4
with:
name: packages
path: dist
publish:
if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/develop')
needs: [pack]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: global.json
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
cache: false
dotnet-version: |
8.0.x
9.0.x
- name: Download artifact 'packages'
uses: actions/download-artifact@v4
with:
name: packages
- name: Push packages
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate