[WIP] Add Code Cov Integration for Jacoco test #2
Workflow file for this run
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
# GitHub Actions workflow for Codecov integration | |
# This workflow builds the project, generates a coverage report, and uploads it to Codecov | |
name: Codecov | |
# Define when this workflow should run | |
on: | |
push: | |
branches: ['master'] # Run on every push to the master branch | |
pull_request: | |
branches: ['**'] # Run on every pull request, regardless of target branch | |
# Define the jobs to run | |
jobs: | |
codecov: | |
runs-on: ubuntu-latest # Use the latest Ubuntu runner | |
steps: | |
# Step 1: Check out the repository code | |
- name: Checkout code | |
uses: actions/checkout@v2 # Use v2 of the checkout action | |
with: | |
fetch-depth: '0' # Fetch all history for all branches and tags | |
# Step 2: Set up Java Development Kit | |
- name: Set up JDK | |
uses: actions/setup-java@v1 # Use v1 of the setup-java action | |
with: | |
java-version: 1.8 # Use Java 8 (adjust if your project uses a different version) | |
# Step 3: Build the project and generate coverage report | |
- name: Build and generate coverage report | |
run: ./gradlew clean build jacocoTestReport --no-daemon | |
# This runs a clean build, runs tests, and generates a JaCoCo coverage report | |
# Step 4: Upload the coverage report to Codecov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 # Use v3 of the Codecov GitHub Action | |
with: | |
file: ./build/reports/jacoco/test/jacocoTestReport.xml # Path to the coverage report | |
flags: unittests # Label these results as coming from unit tests | |
fail_ci_if_error: true # Fail the workflow if there's an error uploading to Codecov | |
# Note: No token is required for public repositories | |
# Codecov will automatically detect that this is a public repo and process the report |