Skip to content
Merged
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
25 changes: 15 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,32 @@ jobs:
permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
env:
GRADLE_OPTS: "-Dfile:encoding=UTF-8"

- name: Cache
uses: actions/cache@v4
steps:
- name: Cache glslang
uses: actions/cache@v5
with:
path: |
~/.m2/repository
~/.cache/runelite
key: ${{ runner.os }}-cache-${{ hashFiles('**/pom.xml', '**/build.sh', '**/pmd-ruleset.xml') }}
key: ${{ runner.os }}-cache-${{ hashFiles('ci/build.sh') }}
restore-keys: |
${{ runner.os }}-cache-

- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11

- name: Build
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper

- name: Build and Test
run: ./ci/build.sh
30 changes: 18 additions & 12 deletions .github/workflows/manual_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,30 @@ jobs:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper

- name: Build Shaded JAR
run: |
COMMIT_SHA=$(git rev-parse --short HEAD)
mvn clean package -Dmicrobot.commit.sha=$COMMIT_SHA
./gradlew :runelite-client:shadowJar -Pmicrobot.commit.sha=$COMMIT_SHA

- name: Read microbot.version from POM
- name: Read microbot.version from Gradle
id: version
run: |
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=microbot.version -DforceStdout)
# fallback to project.version if the property isn't defined
if [ -z "$V" ]; then
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=project.version -DforceStdout)
fi
V=$(./gradlew -q properties --console=plain | sed -n 's/^microbot.version: //p')
if [ -z "$V" ]; then V=$(grep '^microbot.version=' gradle.properties | cut -d= -f2); fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "Using version: $V"

- name: Prepare artifact name
run: |
SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)
DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
cp "$SRC" "$DEST"
Comment on lines +52 to +56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent glob handling for artifact preparation.

The SRC variable uses glob expansion via echo, but the subsequent cp command expects exactly one file. If the glob matches zero or multiple files, the copy will fail silently or incorrectly.

🔎 Proposed fix
      - name: Prepare artifact name
        run: |
-          SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)
+          SRC=$(ls runelite-client/build/libs/client-*-shaded.jar 2>/dev/null | head -n1)
+          if [ -z "$SRC" ]; then echo "No shaded JAR found"; exit 1; fi
          DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
          cp "$SRC" "$DEST"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Prepare artifact name
run: |
SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)
DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
cp "$SRC" "$DEST"
- name: Prepare artifact name
run: |
SRC=$(ls runelite-client/build/libs/client-*-shaded.jar 2>/dev/null | head -n1)
if [ -z "$SRC" ]; then echo "No shaded JAR found"; exit 1; fi
DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
cp "$SRC" "$DEST"
🤖 Prompt for AI Agents
.github/workflows/manual_nightly.yml around lines 52 to 56: the current script
uses `SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)` which relies
on `echo` and can yield zero or multiple matches while `cp` expects a single
file; replace this with proper glob handling that verifies exactly one file
before copying — expand the glob in the shell (e.g., use an array or `set --
runelite-client/build/libs/client-*-shaded.jar`), check the match count (fail
the job if zero or >1 with a clear error), then set DEST and run `cp` using the
verified single path.


- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand All @@ -57,7 +63,7 @@ jobs:
prerelease: false
title: "Nightly Build"
files: |
/home/runner/work/Microbot/Microbot/runelite-client/target/microbot-*.jar
/home/runner/work/Microbot/Microbot/runelite-client/build/libs/microbot-*.jar


- name: Upload Jar to Hetzner
Expand All @@ -66,7 +72,7 @@ jobs:
host: ${{ secrets.PROD_HOST }}
username: root
key: ${{ secrets.PROD_SSH_KEY }}
source: runelite-client/target/microbot-*.jar
source: runelite-client/build/libs/microbot-*.jar
target: /var/www/files/releases/microbot/nightly/
strip_components: 2

Expand All @@ -86,4 +92,4 @@ jobs:
EOL

- name: Deploy to Nexus
run: mvn deploy:deploy-file -DgroupId=com.microbot -DartifactId=client -Dversion=${{ steps.version.outputs.version }} -Dpackaging=jar -Dfile=runelite-client/target/microbot-${{ steps.version.outputs.version }}.jar -DrepositoryId=microbot-nightly -Durl=https://nexus.microbot.cloud/repository/microbot-nightly/
run: mvn deploy:deploy-file -DgroupId=com.microbot -DartifactId=client -Dversion=${{ steps.version.outputs.version }} -Dpackaging=jar -Dfile=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar -DrepositoryId=microbot-nightly -Durl=https://nexus.microbot.cloud/repository/microbot-nightly/
33 changes: 18 additions & 15 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
schedule:
- cron: "0 0 * * *"

env:
version: ${microbot.version}

jobs:
build:
runs-on: ubuntu-latest # You can choose a different runner if needed
Expand All @@ -31,24 +28,30 @@ jobs:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper

- name: Build Shaded JAR
run: |
COMMIT_SHA=$(git rev-parse --short HEAD)
mvn clean package -Dmicrobot.commit.sha=$COMMIT_SHA
./gradlew :runelite-client:shadowJar -Pmicrobot.commit.sha=$COMMIT_SHA

- name: Read microbot.version from POM
- name: Read microbot.version from Gradle
id: version
run: |
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=microbot.version -DforceStdout)
# fallback to project.version if the property isn't defined
if [ -z "$V" ]; then
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=project.version -DforceStdout)
fi
V=$(./gradlew -q properties --console=plain | sed -n 's/^microbot.version: //p')
if [ -z "$V" ]; then V=$(grep '^microbot.version=' gradle.properties | cut -d= -f2); fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "Using version: $V"

- name: Prepare artifact name
run: |
SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)
DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
cp "$SRC" "$DEST"
Comment on lines +49 to +53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Glob may match multiple files or none, causing silent misbehavior.

The echo client-*-shaded.jar pattern assumes exactly one match. If multiple shaded JARs exist (or none), SRC will contain a space-separated list (or the literal glob), causing cp to fail or copy the wrong file.

🔎 Suggested hardening
      - name: Prepare artifact name
        run: |
-          SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)
+          shopt -s nullglob
+          FILES=(runelite-client/build/libs/client-*-shaded.jar)
+          if [ "${#FILES[@]}" -ne 1 ]; then
+            echo "Expected exactly 1 shaded jar, found ${#FILES[@]}" >&2
+            exit 1
+          fi
+          SRC="${FILES[0]}"
           DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
           cp "$SRC" "$DEST"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Prepare artifact name
run: |
SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)
DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
cp "$SRC" "$DEST"
- name: Prepare artifact name
run: |
shopt -s nullglob
FILES=(runelite-client/build/libs/client-*-shaded.jar)
if [ "${#FILES[@]}" -ne 1 ]; then
echo "Expected exactly 1 shaded jar, found ${#FILES[@]}" >&2
exit 1
fi
SRC="${FILES[0]}"
DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
cp "$SRC" "$DEST"
🤖 Prompt for AI Agents
.github/workflows/nightly.yml around lines 49-53: the glob assignment to SRC can
expand to zero or multiple matches causing cp to misbehave; change the script to
enable safe globbing, capture matches into an array, verify the array length is
exactly 1 (exit with an error message if 0 or >1), then set SRC to the single
matched path and proceed to cp DEST — this ensures you fail fast on no/multiple
matches instead of silently copying the wrong file.


- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand All @@ -57,15 +60,15 @@ jobs:
prerelease: false
title: "Nightly Build"
files: |
/home/runner/work/Microbot/Microbot/runelite-client/target/microbot-*.jar
/home/runner/work/Microbot/Microbot/runelite-client/build/libs/microbot-*.jar

- name: Upload Jar to Hetzner
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.PROD_HOST }}
username: root
key: ${{ secrets.PROD_SSH_KEY }}
source: runelite-client/target/microbot-*.jar
source: runelite-client/build/libs/microbot-*.jar
target: /var/www/files/releases/microbot/nightly/
strip_components: 2

Expand All @@ -85,4 +88,4 @@ jobs:
EOL

- name: Deploy to Nexus
run: mvn deploy:deploy-file -DgroupId=com.microbot -DartifactId=client -Dversion=${{ steps.version.outputs.version }} -Dpackaging=jar -Dfile=runelite-client/target/microbot-${{ steps.version.outputs.version }}.jar -DrepositoryId=microbot-nightly -Durl=https://nexus.microbot.cloud/repository/microbot-nightly/
run: mvn deploy:deploy-file -DgroupId=com.microbot -DartifactId=client -Dversion=${{ steps.version.outputs.version }} -Dpackaging=jar -Dfile=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar -DrepositoryId=microbot-nightly -Durl=https://nexus.microbot.cloud/repository/microbot-nightly/
35 changes: 19 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
branches:
- main

env:
version: ${microbot.version}

jobs:
build:
runs-on: ubuntu-latest # You can choose a different runner if needed
Expand All @@ -23,25 +20,31 @@ jobs:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper

- name: Build Shaded JAR
run: |
COMMIT_SHA=$(git rev-parse --short HEAD)
mvn clean package -Dmicrobot.commit.sha=$COMMIT_SHA
./gradlew :runelite-client:shadowJar -Pmicrobot.commit.sha=$COMMIT_SHA


- name: Read microbot.version from POM
- name: Read microbot.version from Gradle
id: version
run: |
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=microbot.version -DforceStdout)
# fallback to project.version if the property isn't defined
if [ -z "$V" ]; then
V=$(mvn -q -f runelite-client/pom.xml help:evaluate \
-Dexpression=project.version -DforceStdout)
fi
V=$(./gradlew -q properties --console=plain | sed -n 's/^microbot.version: //p')
if [ -z "$V" ]; then V=$(grep '^microbot.version=' gradle.properties | cut -d= -f2); fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "Using version: $V"

- name: Prepare artifact name
run: |
SRC=$(echo runelite-client/build/libs/client-*-shaded.jar)
DEST=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar
cp "$SRC" "$DEST"
Comment on lines +42 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Same glob assumption issue as in nightly.yml.

The echo client-*-shaded.jar pattern assumes exactly one match exists. Consider adding validation to fail fast if zero or multiple files match the pattern.

🤖 Prompt for AI Agents
In .github/workflows/release.yml around lines 42 to 46, the script assumes the
glob runelite-client/build/libs/client-*-shaded.jar matches exactly one file;
modify the step to expand the glob into an array, check the number of matches,
and fail fast if the count is zero or greater than one (printing the count and
the matching filenames), otherwise proceed to set DEST and copy the single
matched file; ensure the step returns a non‑zero exit code on failure so the
workflow stops.


- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand All @@ -50,15 +53,15 @@ jobs:
prerelease: false
title: "Release ${{ steps.version.outputs.version }}"
files: |
/home/runner/work/Microbot/Microbot/runelite-client/target/microbot-*.jar
/home/runner/work/Microbot/Microbot/runelite-client/build/libs/microbot-*.jar

- name: Upload Jar to Hetzner
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.PROD_HOST }}
username: root
key: ${{ secrets.PROD_SSH_KEY }}
source: runelite-client/target/microbot-*.jar
source: runelite-client/build/libs/microbot-*.jar
target: /var/www/files/releases/microbot/stable/
strip_components: 2

Expand All @@ -78,7 +81,7 @@ jobs:
EOL

- name: Deploy to Nexus
run: mvn deploy:deploy-file -DgroupId=com.microbot -DartifactId=client -Dversion=${{ steps.version.outputs.version }} -Dpackaging=jar -Dfile=runelite-client/target/microbot-${{ steps.version.outputs.version }}.jar -DrepositoryId=microbot-release -Durl=https://nexus.microbot.cloud/repository/microbot-release/
run: mvn deploy:deploy-file -DgroupId=com.microbot -DartifactId=client -Dversion=${{ steps.version.outputs.version }} -Dpackaging=jar -Dfile=runelite-client/build/libs/microbot-${{ steps.version.outputs.version }}.jar -DrepositoryId=microbot-release -Durl=https://nexus.microbot.cloud/repository/microbot-release/

- name: Get Auth Token
id: auth
Expand All @@ -96,4 +99,4 @@ jobs:
-H "Authorization: Bearer ${{ steps.auth.outputs.token }}" \
-H "Content-Type: application/json" \
-d "{\"version\":\"${{ steps.version.outputs.version }}\"}" \
https://microbot.cloud/api/version/client
https://microbot.cloud/api/version/client
61 changes: 36 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
target
nbactions.xml
nb-configuration.xml
/nbproject/
project.properties
*.iml
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/
.project
.settings/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.vscode
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
/docs/diff.txt
/sqllite.pom.patch
/debug_temp_version.txt
/tordemon.patch
/commit.ps1
/runelite-client_part1.txt
/commit_overview.txt
/runelite-client_part2.txt
/unnamed.patch
/sqllite.patch
/runelite-client_part3.txt
/hs_err_pid44304.log
/commit_overview.html
/commits.html
/runelite-client_part4.txt
/runelite-client_part5.txt
/cache/target/*
1 change: 0 additions & 1 deletion .mvn/jvm.config

This file was deleted.

43 changes: 43 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2024, LlemonDuck <napkinorton@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

tasks.register("cleanAll") {
gradle.includedBuilds.forEach { build -> this@register.dependsOn(build.task(":clean")) }
}
tasks.register("buildAll") {
gradle.includedBuilds.forEach { build -> this@register.dependsOn(build.task(":build")) }
}
tasks.register("assembleAll") {
gradle.includedBuilds.forEach { build -> this@register.dependsOn(build.task(":assemble")) }
}
tasks.register("testAll") {
gradle.includedBuilds.forEach { build -> this@register.dependsOn(build.task(":test")) }
}
tasks.register("publishAll") {
this@register.dependsOn(gradle.includedBuild("cache").task(":publish"))
this@register.dependsOn(gradle.includedBuild("runelite-api").task(":publish"))
this@register.dependsOn(gradle.includedBuild("runelite-client").task(":publish"))
this@register.dependsOn(gradle.includedBuild("runelite-jshell").task(":publish"))
}
Loading