-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (81 loc) · 3.3 KB
/
gradle.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
GITHUB_ACTOR: ${{github.actor}}
GITHUB_TOKEN: ${{github.token}}
GITHUB_SHA: ${{github.sha}}
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
PERSONAL_GITHUB_TOKEN: ${{secrets.PERSONAL_GITHUB_TOKEN}}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: '0' # will fetch the entire history
- name: "Set up JDK 21"
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: "Build with Gradle - cached"
uses: burrunan/gradle-cache-action@v2
with:
concurrent: true
gradle-build-scan-report: false
build-root-directory: .
multi-cache-enabled: false
arguments: clean build jacocoTestReport --parallel
- name: "Create Github Release"
# Release job, only for pushes to the main development branch
if: github.event_name == 'push'
&& github.actor != 'dependabot[bot]'
&& github.ref == 'refs/heads/main'
&& github.repository == 'petrmac/crag-db'
&& !contains(toJSON(github.event.commits.*.message), '[skip release]')
id: create_release
run: |
./gradlew githubRelease
- name: "Download Code Climate Test Reporter"
if: github.actor != 'dependabot[bot]' # Exclude for Dependabot
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
# Report test coverage to Code Climate
- name: "Report coverage to Code Climate"
if: github.actor != 'dependabot[bot]' # Exclude for Dependabot
env:
# Set CC_TEST_REPORTER_ID as secret of your repo
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/java"
run: |
./cc-test-reporter format-coverage build/reports/jacoco/test/jacocoTestReport.xml --input-type jacoco
./cc-test-reporter upload-coverage
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2