forked from Learnathon-By-Geeky-Solutions/byte-breeze
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.17 KB
/
test-coverage.yml
File metadata and controls
52 lines (43 loc) · 1.17 KB
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
name: CI with SonarQube Analysis
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-analyze:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
# Checkout the code
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Set up JDK
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Ensure gradlew is executable
- name: Make gradlew executable
run: chmod +x ./gradlew
# Cache Gradle dependencies
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-
# Build and run tests with Gradle
- name: Build and Test
run: ./gradlew build jacocoTestReport --info
# Run SonarQube analysis
- name: SonarQube Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew sonar --info