Skip to content

Commit

Permalink
Merge branch 'main' into dev/patch
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeGBLP authored Jan 21, 2025
2 parents 42c9a1d + aaac07b commit 0d4a04e
Show file tree
Hide file tree
Showing 65 changed files with 1,484 additions and 735 deletions.
128 changes: 120 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Build and test
name: Tests

on:
- push
- pull_request

jobs:
build:
Expand All @@ -12,27 +13,138 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 17
java-version: 21
distribution: 'adopt'
- name: Install Gradle
uses: sdkman/sdkman-action@main
with:
candidate: gradle
version: 8.6
version: 8.9
- name: Generate Gradle wrapper
run: gradle wrapper
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew shadowjar
run: ./gradlew build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Lusk.jar
path: build/libs/*.jar
test:
test_build:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
- name: Install Gradle
uses: sdkman/sdkman-action@main
with:
candidate: gradle
version: 8.9
- name: Generate Gradle wrapper
run: gradle wrapper
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
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: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/[email protected]
with:
test_script_directory: src/test/scripts
skript_repo_ref: dev/feature
extra_plugins_directory: extra-plugins/
test_2_10_0:
runs-on: ubuntu-latest
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/[email protected]
with:
test_script_directory: src/test/scripts
skript_repo_ref: 2.10.0
extra_plugins_directory: extra-plugins/
test_2_9_5:
runs-on: ubuntu-latest
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/[email protected]
with:
test_script_directory: src/test/scripts
skript_repo_ref: 2.9.5
extra_plugins_directory: extra-plugins/
test_2_8_7:
runs-on: ubuntu-latest
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/[email protected]
with:
test_script_directory: src/test/scripts
skript_repo_ref: 2.8.7
extra_plugins_directory: extra-plugins/
test_2_7_3:
runs-on: ubuntu-latest
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/[email protected]
with:
test_script_directory: src/test/scripts
skript_repo_ref: 2.7.3
extra_plugins_directory: extra-plugins/
test_2_6_4:
runs-on: ubuntu-latest
needs: [test_build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -42,8 +154,8 @@ jobs:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/skript-test-action@v1.1
uses: SkriptLang/skript-test-action@v1.2
with:
test_script_directory: src/test/scripts
skript_repo_ref: dev/patch
skript_repo_ref: 2.6.4
extra_plugins_directory: extra-plugins/
37 changes: 37 additions & 0 deletions .github/workflows/java-17-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Java 17 Tests #CI (MC 1.19.4-1.20.4)

on:
- push
- pull_request


jobs:
build:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Install Gradle
uses: sdkman/sdkman-action@main
with:
candidate: gradle
version: 8.9
- name: Generate Gradle wrapper
run: gradle wrapper
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Skript and run test scripts
run: ./gradlew clean skriptTestJava17
- name: Upload Nightly Build
uses: actions/upload-artifact@v4
if: success()
with:
name: lusk-nightly
path: build/libs/*
93 changes: 85 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.apache.tools.ant.filters.ReplaceTokens
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id 'com.gradleup.shadow' version '8.3.0'
Expand All @@ -13,6 +14,8 @@ version = "1.3.3-beta1"
def latestJava = 21
def oldestJava = 16

def java17 = 17


repositories {
mavenCentral()
Expand All @@ -27,11 +30,26 @@ repositories {
dependencies {
implementation('org.jetbrains:annotations:20.1.0')
compileOnly("io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT")
compileOnly('com.github.SkriptLang:Skript:2.9.5')
compileOnly('com.github.SkriptLang:Skript:2.10.0')
implementation('org.bstats:bstats-bukkit:3.0.2')
implementation('com.vdurmont:semver4j:3.1.0')
implementation('net.wesjd:anvilgui:1.10.3-SNAPSHOT')
shadow('junit:junit:3.8.2')

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 {
testImplementation.extendsFrom shadow
}

java {
Expand All @@ -46,18 +64,77 @@ 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) {
if (timeout == 0) {
timeout = 300000 // 5 minutes
}
def artifact = 'build' + File.separator + 'libs' + File.separator + 'Lusk-nightly.jar'
tasks.register(name, JavaExec) {
description = desc
dependsOn build
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(javaVersion)
}
group = 'execution'
classpath = files([
artifact,
sourceSets.main.runtimeClasspath,
configurations.testRuntimeClasspath
])
main = 'it.jakegblp.lusk.test.platform.PlatformMain'
args = [
'build/test_runners',
'src/test/scripts',
'src/test/resources/runner_data',
environments,
project.findProperty('verbosity') ?: "null",
timeout
]
}
}
}

String environments = 'src/test/environments/'
createTestTask('skriptTestJava17', 'Runs tests on all Java 17 environments.', environments + 'paper-1.19.4.json', java17, -1)
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading

0 comments on commit 0d4a04e

Please sign in to comment.