Skip to content

Merge pull request #142 from UQcsse3200/Team-2--Alasdair-Branch #1301

Merge pull request #142 from UQcsse3200/Team-2--Alasdair-Branch

Merge pull request #142 from UQcsse3200/Team-2--Alasdair-Branch #1301

Workflow file for this run

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