-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (59 loc) · 2.26 KB
/
gradle_tests.yaml
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
name: Game Unit Tests
on: [push, pull_request] # Will trigger whenever a push is made to the branch, regardless of which branch
jobs:
run_unit_tests:
runs-on: ubuntu-latest # Running on this OS, if we need it changed lmk
steps:
- uses: actions/checkout@v2 # Checkout repo to remote machine
- name: Set up OpenJDK17
uses: actions/setup-java@v1
with:
java-version: '17'
- name: Cache Gradle packages # Allows us to reuse packages between runs
uses: actions/cache@v2 # If the files specified in key change we dump old cache else re-use
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Unit Tests
id: tests # Unique ID to reference later to color our message
run: |
cd $GRADLE_DIR
chmod +x ./gradlew
./gradlew --stacktrace test
env:
GRADLE_DIR: 'source' # Modify this to wherever './gradlew' is
- name: Test Success
uses: rjstone/discord-webhook-notify@v1
if: success()
with:
severity: info
username: GitHub
details: Test Succeeded!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Test Failure
uses: rjstone/discord-webhook-notify@v1
if: failure()
with:
severity: error
username: GitHub
details: Test Failed!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Test Cancelled
uses: rjstone/discord-webhook-notify@v1
if: cancelled()
with:
severity: warn
username: GitHub
details: Test Cancelled!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Cleanup Gradle Cache
if: always()
# 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