-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (46 loc) · 1.71 KB
/
java-ci.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
name: Java CI
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
java: [ '8', '11']
name: JDK ${{ matrix.Java }} build
steps:
- uses: actions/[email protected]
- name: Set up Java
uses: actions/[email protected]
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
cache: gradle
- name: Before Script
run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && chmod +x ./cc-test-reporter && ./cc-test-reporter before-build
- name: Validate Gradle wrapper
uses: gradle/[email protected]
- name: Build with Gradle headless
uses: coactions/[email protected]
with:
run: ./gradlew clean build jacocoTestReport
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Test & publish code coverage
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: f740894bc369a848482675e2a3efa7e99a029894bdbccd5cde1fbae0753982d7
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/java"
with:
coverageLocations: ${{github.workspace}}/build/reports/jacoco/test/jacocoTestReport.xml:jacoco