Skip to content

Workflows made more correct #15

Workflows made more correct

Workflows made more correct #15

Workflow file for this run

name: Codecov Coverage
on:
push:
branches:
- main
- codecov-workflows
#- 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:
context: ./backend
dotnet-version: 6.0.x # Use the version your project requires
# Restore dependencies
- name: Restore dependencies
run: dotnet restore ./backend
# Build the project
- name: Build
run: dotnet build ./backend --no-restore
# Step 5: Run tests and collect code coverage
- name: Test and calculate coverage
run: |
dotnet test ./backend --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:
context: ./backend
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