Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/test-with-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
name: Run Tests

on:
push:
branches:
- 'main'
- 'release/**'
pull_request:
branches: [ 'main' ]

env:
CACHE_VERSION: 1.3.1
GRADLE_OPTS: -Xmx5g -Xms2g -XX:MaxMetaspaceSize=1g
ORG_GRADLE_PROJECT_kotlinDaemonJvmArgs: -Xmx4g -Xms1g -XX:MaxMetaspaceSize=1g

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout repository code
uses: actions/checkout@v4
Expand All @@ -30,7 +36,7 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Check if secrets exists
- name: Check if secrets exist
id: check_secret
run: |
if [ -n "${{ secrets.AWS_ACCESS_KEY_ID }}" ]; then
Expand All @@ -52,11 +58,11 @@ jobs:
key: cache-${{ env.cache_version }}-${{ hashFiles('data/cache/main_file_cache.idx255') }}
path: data/cache/
enableCrossOsArchive: 'true'
restore-keys:
restore-keys: |
cache-${{ env.cache_version }}
cache-

- name: Download game cache files (on main branch only)
- name: Download game cache files (on main branch only)
if: steps.check_secret.outputs.exists == 'true' && steps.cache-files.outputs.cache-hit != 'true'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -73,17 +79,20 @@ jobs:
echo "cache_exists=false" >> $GITHUB_OUTPUT
fi

- name: Clean build artifacts
run: ./gradlew clean

- name: Run all tests
if: steps.check-cache-files.outputs.cache_exists == 'true'
run: ./gradlew test
run: ./gradlew test --no-build-cache

- name: Run unit tests
- name: Run unit tests (fallback if no cache)
if: steps.check-cache-files.outputs.cache_exists != 'true'
run: ./gradlew test -x :game:test
run: ./gradlew test -x :game:test --no-build-cache

- name: Upload coverage report to Codecov
if: steps.check_secret.outputs.exists == 'true'
uses: codecov/codecov-action@v4.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: GregHib/void
slug: 2011Scape/game-server
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#org.gradle.java.home=C:/Users/<name>/.jdks/openjdk-19.0.1/
kotlin.daemon.jvmargs=-Xmx4g -Xms1g -XX:MaxMetaspaceSize=1g
junitVersion = 5.10.2
ktorVersion = 2.3.8
displeeCacheVersion = 7.1.7
Expand All @@ -19,4 +20,4 @@ postgresqlVersion=42.7.3
hikariVersion=5.1.0
testcontainersVersion=1.20.4
postgresVersion=16.2.0
embeddedPostgresVersion=2.1.0
embeddedPostgresVersion=2.1.0
Loading