Team 2 engineers - Final sprint 2 merge #752
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |