-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (52 loc) · 1.66 KB
/
ci_cd.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: CI
on:
workflow_dispatch:
push:
branches:
- main
- master
pull_request:
branches:
- main
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up JDK for Kotlin
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
# Step 3: Cache Gradle dependencies
- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Step 4: Build the project
- name: Build project
run: ./gradlew build
# Step 5: Run tests with code coverage verification
- name: Run tests and verify coverage
run: ./gradlew test
# Step 6: Generate code coverage report
- name: Generate code coverage report
run: ./gradlew jacocoTestReport
# Step 7: Upload code coverage report as artifact
- name: Generate Coverage Badge
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
badges-directory: build/reports/jacoco/test/html/badges
- name: Publish coverage report to GitHub Pages
# if: ${{ github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/reports/jacoco/test/html