-
-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (86 loc) · 3.23 KB
/
build.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Build
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
types: [ opened, synchronize, reopened ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0 # Shallow clones should be disabled for better analysis relevancy
- name: Set up JDK 21
uses: actions/setup-java@v4.2.1
with:
java-version: '21'
distribution: 'zulu'
cache: 'gradle'
- name: Validate Gradle Wrapper
run: ./gradlew --version
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle dependencies
uses: actions/cache@v3.3.2
with:
path: ${{ env.GRADLE_HOME }}/caches
key: |
gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
-${{ hashFiles('**/*.gradle*') }}
-${{ hashFiles('**/buildSrc/**') }}
-${{ github.sha }}
restore-keys: |
gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
-${{ hashFiles('**/*.gradle*') }}
-${{ hashFiles('**/buildSrc/**') }}
- name: Run checks and test
run: ./gradlew detekt ktlintCheck --build-cache --no-daemon --stacktrace --gradle-user-home "$GRADLE_HOME"
- name: Build with Gradle and test
run: ./gradlew build -x koverVerify # Skipping koverVerify to avoid failure if coverage has lowered
- name: Generate Test Coverage Xml Report
run: ./gradlew koverXmlReport
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2.2.3
with:
parallel: true
flag-name: run-${{ join(matrix.*, '-') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./build/reports/jacoco/test/jacocoTestReport.xml
debug: false
measure: true
format: jacoco
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3.1.4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./build/reports/kover/
# files: ./build/reports/kover/report.xml
# verbose: true
- name: Upload test coverage to Code Climate
uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/kotlin"
with:
coverageCommand: ./gradlew test jacocoTestReport
coverageLocations: ./build/reports/jacoco/test/jacocoTestReport.xml:jacoco
debug: true
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./build/reports/jacoco/test/jacocoTestReport.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}