This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
58 lines (51 loc) · 1.72 KB
/
gradle-build-and-test.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
name: Gradle build and test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
buildAndTest:
runs-on: ubuntu-latest
steps:
# print all github info (e.g. branch name, commit id, etc)
# - name: Github info
# run: |
# echo "${{ toJSON(github) }}"
# print all runner (host pc) info (e.g. os, etc)
# - name: Runner info
# run: |
# echo "${{ toJSON(runner) }}"
# set up github actions
- uses: actions/checkout@v2
# set up the jdk
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '8'
# there's various versions (oracle / openjdk, etc). due to licensing, we'll use the AdoptOpenJDK version
# because it's free
distribution: 'adopt'
# add a cache to avoid having to redownload gradle pkgs for every build
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build
- 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
# what's the outcome?
- run: |
echo "job completed: ${{ job.status }}."