[ci skip] ci: switch to codecov for coverage

This commit is contained in:
Oliver Booth 2024-02-12 10:20:35 +00:00
parent 52c85f3498
commit ac82200303
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
4 changed files with 18 additions and 52 deletions

View File

@ -33,6 +33,11 @@ jobs:
- name: Restore dependencies
run: dotnet restore
- name: Install dotCover
shell: powershell
run: |
dotnet tool install --global JetBrains.dotCover.GlobalTool
- name: Build
run: dotnet build --no-restore --configuration Release
@ -44,3 +49,15 @@ jobs:
- name: Test .NET 7
run: dotnet test --no-build --verbosity normal --configuration Release --framework net7.0
- name: Test .NET 8
run: dotnet test --no-build --verbosity normal --configuration Release --framework net8.0
- name: Collect coverage
run: dotnet dotcover test --dcReportType=HTML
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
env:
token: ${{ secrets.CODECOV_TOKEN }}
slug: oliverbooth/X10D

View File

@ -1,50 +0,0 @@
name: Build
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"X10D" /o:"oliverbooth" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html
dotnet build --no-incremental
dotnet dotcover test --dcReportType=HTML
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

View File

@ -2,7 +2,7 @@
<p align="center">
<a href="https://github.com/oliverbooth/X10D/actions/workflows/dotnet.yml"><img src="https://img.shields.io/github/actions/workflow/status/oliverbooth/X10D/dotnet.yml?style=flat-square" alt="GitHub Workflow Status" title="GitHub Workflow Status"></a>
<a href="https://github.com/oliverbooth/X10D/issues"><img src="https://img.shields.io/github/issues/oliverbooth/X10D?style=flat-square" alt="GitHub Issues" title="GitHub Issues"></a>
<a href="https://sonarcloud.io/dashboard?id=X10D"><img src="https://img.shields.io/sonar/coverage/X10D?server=https%3A%2F%2Fsonarcloud.io&style=flat-square" alt="Coverage"></a>
<a href="https://app.codecov.io/gh/oliverbooth/X10D/"><img src="https://img.shields.io/codecov/c/github/oliverbooth/X10D?style=flat-square" alt="Coverage"></a>
<a href="https://www.nuget.org/packages/X10D/"><img src="https://img.shields.io/nuget/dt/X10D?style=flat-square" alt="NuGet Downloads" title="NuGet Downloads"></a>
<a href="https://www.nuget.org/packages/X10D/"><img src="https://img.shields.io/nuget/v/X10D?label=stable&style=flat-square" alt="Stable Version" title="Stable Version"></a>
<a href="https://www.nuget.org/packages/X10D/"><img src="https://img.shields.io/nuget/vpre/X10D?label=nightly&style=flat-square" alt="Nightly Version" title="Nightly Version"></a>

View File

@ -36,7 +36,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{
.github\workflows\nightly.yml = .github\workflows\nightly.yml
.github\workflows\prerelease.yml = .github\workflows\prerelease.yml
.github\workflows\release.yml = .github\workflows\release.yml
.github\workflows\sonarcloud.yml = .github\workflows\sonarcloud.yml
.github\workflows\source_validator.yml = .github\workflows\source_validator.yml
.github\workflows\unity.yml = .github\workflows\unity.yml
EndProjectSection