-
Notifications
You must be signed in to change notification settings - Fork 25
49 lines (46 loc) · 1.32 KB
/
gradle-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
name: Gradle build
on:
workflow_call:
inputs:
JAVA_VERSION:
required: false
default: 21
type: number
SERVICE_LOCATION:
required: true
type: string
secrets:
SLACK_WEBHOOK_URL:
required: true
jobs:
maven-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ inputs.JAVA_VERSION }}
server-id: ossrh
settings-path: ${{ github.workspace }}
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-
- uses: actions/[email protected]
- name: Run tests
run: |
cd ${{ inputs.SERVICE_LOCATION }}
./gradlew test
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,author,commit,workflow,job # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: "${{ github.event_name != 'pull_request' && failure() }}" # Pick up events even if the job fails or is canceled.