Skip to content

Commit

Permalink
Add github actions for unit tests and code quality (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
GregHib authored Jan 23, 2024
1 parent 82262e9 commit 2a44459
Show file tree
Hide file tree
Showing 59 changed files with 954 additions and 519 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
qodana:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: JUnit Tests
on:
pull_request:
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
architecture: x64
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Grant Permissions to gradlew
run: chmod +x gradlew
- name: Run unit tests
run: ./gradlew test
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ gradle-app.setting
# Cache of project
.gradletasknamecache
/gradle/
gradlew
gradlew.bat
*.lock
/data/dump/
/data/saves/
Expand Down
17 changes: 15 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

buildscript {
dependencies {
classpath(kotlin("gradle-plugin", version = "1.8.21"))
Expand Down Expand Up @@ -26,6 +28,7 @@ allprojects {
dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation("org.junit.jupiter:junit-jupiter-api:${findProperty("junitVersion")}")
testImplementation("org.junit.jupiter:junit-jupiter-engine:${findProperty("junitVersion")}")
}

tasks {
Expand All @@ -39,5 +42,15 @@ allprojects {
kotlinOptions.freeCompilerArgs = listOf("-Xinline-classes", "-Xcontext-receivers", "-Xjvm-default=all-compatibility")
}
}

}
if (name != "game") {
tasks.test {
maxHeapSize = "4096m"
useJUnitPlatform()
failFast = true
testLogging {
events("passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package world.gregs.voidps.cache
import world.gregs.voidps.buffer.write.Writer

interface DefinitionEncoder<T : Definition> {
open fun Writer.encode(definition: T, members: T) {
fun Writer.encode(definition: T, members: T) {
encode(definition)
}

open fun Writer.encode(definition: T) {
fun Writer.encode(definition: T) {
encode(definition, definition)
}
}
Loading

0 comments on commit 2a44459

Please sign in to comment.