This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
changed correct port #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Codecov Coverage | |
on: | |
push: | |
branches: | |
- main | |
- codecov-workflows | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout code | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Setup .NET environment | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x # Use the version your project requires | |
# Restore dependencies | |
- name: Restore dependencies | |
run: dotnet restore | |
# Build the project | |
- name: Build | |
run: dotnet build --no-restore | |
# Step 5: Run tests and collect code coverage | |
- name: Test and calculate coverage | |
run: | | |
dotnet test --no-build --verbosity normal \ | |
/p:CollectCoverage=true /p:CoverletOutputFormat=opencover \ | |
/p:CoverletOutput=./TestResults/coverage.opencover.xml | |
# Step 6: Upload the code coverage report to Codecov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # Add the Codecov token in the GitHub secrets | |
files: ./TestResults/coverage.opencover.xml # Ensure the correct path for the coverage file | |
flags: unittests | |
fail_ci_if_error: true |