Skip to content

Commit

Permalink
Changed some things in the test workflows and build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeGBLP committed Jan 21, 2025
1 parent d47e7e7 commit aaac07b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
name: Lusk.jar
path: build/libs/*.jar
build_2:
test_build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
Expand All @@ -51,15 +51,15 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew testBuild
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Lusk_back.jar
path: build/libs/*.jar
test_dev_feature:
runs-on: ubuntu-latest
needs: [build]
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -76,7 +76,7 @@ jobs:
extra_plugins_directory: extra-plugins/
test_2_10_0:
runs-on: ubuntu-latest
needs: [build]
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -93,7 +93,7 @@ jobs:
extra_plugins_directory: extra-plugins/
test_2_9_5:
runs-on: ubuntu-latest
needs: [build]
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -110,7 +110,7 @@ jobs:
extra_plugins_directory: extra-plugins/
test_2_8_7:
runs-on: ubuntu-latest
needs: [build]
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -127,7 +127,7 @@ jobs:
extra_plugins_directory: extra-plugins/
test_2_7_3:
runs-on: ubuntu-latest
needs: [build_2]
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -144,7 +144,7 @@ jobs:
extra_plugins_directory: extra-plugins/
test_2_6_4:
runs-on: ubuntu-latest
needs: [build_2]
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down
49 changes: 38 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ dependencies {
implementation('com.vdurmont:semver4j:3.1.0')
implementation('net.wesjd:anvilgui:1.10.3-SNAPSHOT')
shadow('junit:junit:3.8.2')
implementation 'com.google.code.gson:gson:2.11.0'
testImplementation 'com.google.code.gson:gson:2.11.0'
testImplementation 'com.google.guava:guava:32.1.2-jre'

compileOnly 'org.projectlombok:lombok:1.18.36'
annotationProcessor 'org.projectlombok:lombok:1.18.36'

testCompileOnly 'org.projectlombok:lombok:1.18.36'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.36'

testRuntimeOnly 'com.google.code.gson:gson:2.11.0'
testRuntimeOnly 'com.google.guava:guava:32.1.2-jre'
testImplementation 'com.google.code.gson:gson:2.11.0'
testImplementation 'com.google.guava:guava:32.1.2-jre'
}

configurations {
Expand All @@ -62,22 +64,47 @@ processResources {
filter(ReplaceTokens, tokens: [version: version])
}


build {
dependsOn shadowJar
tasks.withType(JavaCompile).configureEach {
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
}
}

shadowJar {
archiveFileName = project.name + "-" + project.version + ".jar"
relocate 'org.bstats', 'it.jakegblp.lusk.libs.bstats'
relocate 'net.wesjd.anvilgui', 'it.jakegblp.lusk.libs.anvilgui'

exclude 'it/jakegblp/lusk/test/**'
}

tasks.build {
dependsOn shadowJar
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
}
tasks.register('testShadowJar', ShadowJar) {
archiveFileName = project.name + "-" + project.version + "-test.jar"
from sourceSets.main.output // Main compiled classes
from sourceSets.test.output // Test compiled classes and resources
configurations = [project.configurations.testRuntimeClasspath] // Include test runtime dependencies

relocate 'org.bstats', 'it.jakegblp.lusk.libs.bstats'
relocate 'net.wesjd.anvilgui', 'it.jakegblp.lusk.libs.anvilgui'
relocate 'com.google.common', 'it.jakegblp.lusk.libs.guava'
relocate 'com.google.gson', 'it.jakegblp.lusk.libs.gson'
}


tasks.register('testBuild') {
dependsOn testShadowJar
description = "Runs a test build"
group = "build"
doLast {
println "Test build completed: ${testShadowJar.archiveFile.get().asFile}"
}
}



// Create a test task with given name, environments dir/file, dev mode and java version.
// -1 on the timeout means it'll be disabled.
void createTestTask(String name, String desc, String environments, int javaVersion, long timeout) {
Expand All @@ -95,7 +122,7 @@ void createTestTask(String name, String desc, String environments, int javaVersi
classpath = files([
artifact,
sourceSets.main.runtimeClasspath,
configurations.testRuntimeClasspath // Includes test dependencies like Gson
configurations.testRuntimeClasspath
])
main = 'it.jakegblp.lusk.test.platform.PlatformMain'
args = [
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/runner_data/server.properties.generic
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource-pack=
level-name=world
rcon.password=
player-idle-timeout=0
motd=A Skript Server
motd=A Lusk Testing Server
query.port=25580
debug=false
force-gamemode=false
Expand Down

0 comments on commit aaac07b

Please sign in to comment.