-
Notifications
You must be signed in to change notification settings - Fork 187
44 lines (37 loc) · 1.78 KB
/
codecov.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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