Skip to content

Commit

Permalink
update codecov file
Browse files Browse the repository at this point in the history
  • Loading branch information
SydZero committed Nov 20, 2024
1 parent 221f8fa commit d133bb0
Showing 1 changed file with 45 additions and 15 deletions.
60 changes: 45 additions & 15 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- codecov-workflows
pull_request:
branches:
- main
Expand All @@ -19,26 +18,25 @@ jobs:
uses: actions/checkout@v2

# Setup .NET environment
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
context: ./backend
dotnet-version: 6.0.x # Use the version your project requires
context: ./frontend
dotnet-version: 18 # Use the version your project requires

# Restore dependencies
- name: Restore dependencies
run: dotnet restore ./backend
- name: Install dependencies
run: npm install
working-directory: ./frontend

# Build the project
- name: Build
run: dotnet build ./backend --no-restore
run: npm build ./frontend

# Step 5: Run tests and collect code coverage
- name: Test and calculate coverage
run: |
dotnet test ./backend --no-build --verbosity normal --logger "console;verbosity=detailed" \
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
/p:CoverletOutput=./TestResults/coverage.cobertura.xml
run: npm run test:coverage
working-directory: ./frontend


# Step 6: Upload the code coverage report to Codecov
Expand All @@ -47,6 +45,38 @@ jobs:
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
files: ./frontend/coverage/lcov.info # Ensure the correct path for the coverage file
flags: vite-tests
fail_ci_if_error: true
# # 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 --logger "console;verbosity=detailed" \
# /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
# /p:CoverletOutput=./TestResults/coverage.cobertura.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

0 comments on commit d133bb0

Please sign in to comment.