Skip to content

Commit f754872

Browse files
committed
port other qol improvements
- add View depend from GTNewHorizons/BetterQuesting#198 - add Directional arrows for quest lines from GTNewHorizons/BetterQuesting#205 - add Global and per-chapter completion percent from GTNewHorizons/BetterQuesting#223 Signed-off-by: vcwdfca <53033260+vcwdfca@users.noreply.github.com>
1 parent 86d2dc5 commit f754872

48 files changed

Lines changed: 2439 additions & 177 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 51 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,62 @@
1-
name: build.yml
1+
name: Build mod jar
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
[workflow_dispatch, push]
75

86
permissions:
97
contents: write
108

119
jobs:
1210
build:
11+
1312
runs-on: ubuntu-latest
1413

1514
steps:
16-
- name: Checkout Repository
17-
uses: actions/checkout@v3
18-
with:
19-
fetch-depth: 0
20-
21-
- name: Setup Java
22-
uses: actions/setup-java@v3
23-
with:
24-
java-version: '25'
25-
distribution: 'temurin'
26-
27-
- name: Setup Gradle
28-
uses: gradle/actions/setup-gradle@v5
29-
30-
- name: Build with Gradle
31-
run: ./gradlew build
32-
33-
- name: Strict Check and Extract
34-
id: version_check
35-
run: |
36-
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
37-
echo "Checking commit message: $COMMIT_MESSAGE"
38-
39-
if [[ "$COMMIT_MESSAGE" =~ ^[[:space:]]*[Uu]pdate[[:space:]]+([0-9]+\.[0-9]+\.[0-9]+)[[:space:]]* ]]; then
40-
VERSION="${BASH_REMATCH[1]}"
41-
echo "✅ Matched 'update $VERSION' format"
42-
43-
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION"
44-
if [ ${#VERSION_PARTS[@]} -eq 3 ] && \
45-
[[ "${VERSION_PARTS[0]}" =~ ^[0-9]+$ ]] && \
46-
[[ "${VERSION_PARTS[1]}" =~ ^[0-9]+$ ]] && \
47-
[[ "${VERSION_PARTS[2]}" =~ ^[0-9]+$ ]]; then
48-
TAG="v$VERSION"
49-
if git show-ref --tags --quiet "refs/tags/$TAG"; then
50-
echo "❌ Tag $TAG already exists"
51-
echo "should_create=false" >> $GITHUB_OUTPUT
52-
else
53-
echo "✅ Valid semantic version: $VERSION"
54-
echo "tag=$TAG" >> $GITHUB_OUTPUT
55-
echo "should_create=true" >> $GITHUB_OUTPUT
56-
fi
57-
else
58-
echo "❌ Invalid version format"
59-
echo "should_create=false" >> $GITHUB_OUTPUT
60-
fi
61-
else
62-
echo "❌ Commit message does not match 'update x.x.x' pattern"
63-
echo "should_create=false" >> $GITHUB_OUTPUT
64-
fi
65-
66-
- name: Create Tag
67-
if: steps.version_check.outputs.should_create == 'true'
68-
run: |
69-
TAG="${{ steps.version_check.outputs.tag }}"
70-
71-
if git show-ref --tags --quiet "$TAG"; then
72-
echo "❌ Tag $TAG already exists!"
73-
exit 0
74-
fi
75-
76-
echo "Creating tag: $TAG"
77-
78-
git config user.name "GitHub Actions"
79-
git config user.email "actions@github.com"
80-
81-
git tag -a "$TAG" -m "Auto-created from commit: ${{ github.event.head_commit.message }}"
82-
83-
git push origin "$TAG"
84-
85-
env:
86-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87-
88-
- name: Prepare Release Notes
89-
if: steps.version_check.outputs.should_create == 'true'
90-
run: |
91-
TAG="${{ steps.version_check.outputs.tag }}"
92-
PREV_TAG=$(git tag --list "v*" --sort=-v:refname | grep -v "^$TAG$" | head -n 1)
93-
94-
if [ -n "$PREV_TAG" ]; then
95-
RANGE="$PREV_TAG..HEAD"
96-
COMPARE_URL="https://github.com/${{ github.repository }}/compare/$PREV_TAG...$TAG"
97-
CHANGELOG=$(git log --pretty=format:"- %s (%h)" $RANGE)
98-
else
99-
COMPARE_URL="https://github.com/${{ github.repository }}/commits/master"
100-
CHANGELOG="- Initial release"
101-
fi
102-
103-
if [ -z "$CHANGELOG" ]; then
104-
CHANGELOG="- No changes found"
105-
fi
106-
107-
{
108-
echo "## $TAG"
109-
echo ""
110-
echo "### Changes"
111-
echo "$CHANGELOG"
112-
echo ""
113-
echo "### Changelog"
114-
echo "$COMPARE_URL"
115-
} > release-notes.md
116-
117-
- name: Create Release
118-
if: steps.version_check.outputs.should_create == 'true'
119-
uses: softprops/action-gh-release@v2.5.0
120-
env:
121-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122-
with:
123-
tag_name: ${{ steps.version_check.outputs.tag }}
124-
body_path: release-notes.md
125-
files: |
126-
build/libs/*.jar
127-
make_latest: true
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
- name: Set up JDK
19+
uses: actions/setup-java@v5
20+
with:
21+
java-version: '25'
22+
distribution: 'temurin'
23+
- uses: gradle/actions/setup-gradle@v6
24+
with:
25+
gradle-version: 9.6.0
26+
name: Set up Gradle
27+
- name: Add permission
28+
run: chmod +x ./gradlew
29+
- name: Set build version
30+
run: |
31+
previous_tag="$(git describe --tags --abbrev=0 --exclude=dev 2>/dev/null || echo 0.0.0)"
32+
previous_tag="${previous_tag#v}"
33+
short_hash="$(git rev-parse --short HEAD)"
34+
echo "MOD_VERSION=${previous_tag}+${short_hash}" >> "$GITHUB_ENV"
35+
echo "Build version: ${previous_tag}+${short_hash}"
36+
- name: Execute Gradle build
37+
run: ./gradlew build -x spotlessCheck -Pmod_version="${MOD_VERSION}"
38+
39+
- name: Upload a Build Artifact
40+
uses: actions/upload-artifact@v7
41+
with:
42+
path: build/libs
43+
44+
- name: Update dev tag and ensure dev release exists
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
git tag -f dev "${GITHUB_SHA}"
49+
git push --force origin refs/tags/dev
50+
if ! gh release view dev >/dev/null 2>&1; then
51+
gh release create dev --title "dev" --notes "Latest development build artifacts"
52+
fi
53+
54+
- name: Replace dev release assets
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
mapfile -t assets < <(gh release view dev --json assets --jq '.assets[].name')
59+
for asset in "${assets[@]}"; do
60+
gh release delete-asset dev "$asset" --yes
61+
done
62+
gh release upload dev build/libs/* --clobber

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
runtime-test:
10+
uses: ./.github/workflows/runtime-test.yml
11+
12+
build:
13+
needs: runtime-test
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
env:
18+
RELEASE_TAG: ${{ github.ref_name }}
19+
steps:
20+
- uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
- name: Set up JDK
24+
uses: actions/setup-java@v5
25+
with:
26+
java-version: '25'
27+
distribution: 'temurin'
28+
- uses: gradle/actions/setup-gradle@v6
29+
with:
30+
gradle-version: 9.6.0
31+
name: Set up Gradle
32+
- name: Add permission
33+
run: chmod +x ./gradlew
34+
- name: Set release version
35+
run: |
36+
RELEASE_VERSION="${RELEASE_TAG#v}"
37+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_ENV"
38+
echo "Release tag: ${RELEASE_TAG}"
39+
echo "Release version: ${RELEASE_VERSION}"
40+
- name: Execute Gradle build
41+
run: ./gradlew build -x spotlessCheck -Pmod_version="${RELEASE_VERSION}"
42+
- name: Build JitPack Maven repository
43+
run: |
44+
JITPACK_GROUP="com.github.${GITHUB_REPOSITORY_OWNER}"
45+
JITPACK_ARTIFACT_ID="${GITHUB_REPOSITORY#*/}"
46+
./gradlew --build-cache --info --stacktrace \
47+
-Ppublish_to_jitpack=true \
48+
-Pjitpack_group="${JITPACK_GROUP}" \
49+
-Pjitpack_artifact_id="${JITPACK_ARTIFACT_ID}" \
50+
-Pjitpack_version="${RELEASE_TAG}" \
51+
-Pmod_version="${RELEASE_VERSION}" \
52+
-Pgenerate_sources_jar=true \
53+
-Pgenerate_javadocs_jar=true \
54+
clean publishMavenJavaPublicationToJitpackRepository -x test -x spotlessCheck
55+
- name: Package JitPack Maven repository
56+
run: |
57+
cd build/jitpack-repository
58+
zip -r "../jitpack-repository-${RELEASE_TAG}.zip" .
59+
- name: Create GitHub release
60+
run: gh release create "$RELEASE_TAG" build/libs/* "build/jitpack-repository-${RELEASE_TAG}.zip" --title "$RELEASE_TAG" --generate-notes
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/runtime-test.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Runtime test
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
merge_group:
7+
push:
8+
branches:
9+
- '**'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
runtime-test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up JDK
24+
uses: actions/setup-java@v5
25+
with:
26+
java-version: '25'
27+
distribution: 'temurin'
28+
29+
- uses: gradle/actions/setup-gradle@v6
30+
with:
31+
gradle-version: 9.6.0
32+
name: Set up Gradle
33+
34+
- name: Add permission
35+
run: chmod +x ./gradlew
36+
37+
- name: Set build version
38+
run: |
39+
previous_tag="$(git describe --tags --abbrev=0 --exclude=dev 2>/dev/null || echo 0.0.0)"
40+
previous_tag="${previous_tag#v}"
41+
short_hash="$(git rev-parse --short HEAD)"
42+
echo "MOD_VERSION=${previous_tag}+${short_hash}" >> "$GITHUB_ENV"
43+
echo "Build version: ${previous_tag}+${short_hash}"
44+
45+
- name: Execute Gradle build
46+
run: ./gradlew build -x spotlessCheck -Pmod_version="${MOD_VERSION}"
47+
48+
- name: Install client runtime dependencies
49+
run: sudo DEBIAN_FRONTEND=noninteractive apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y xvfb
50+
51+
- name: Prepare client runtime directory
52+
run: mkdir -p run/client/mods
53+
54+
- name: Download client runtime test mod
55+
uses: robinraju/release-downloader@v1.11
56+
with:
57+
repository: headlesshq/mc-runtime-test
58+
tag: "4.4.0"
59+
fileName: "mc-runtime-test-1.12.2-*-lexforge-release.jar"
60+
out-file-path: run/client/mods
61+
62+
- name: Configure client runtime
63+
run: |
64+
mkdir -p run/client
65+
cat <<EOF >> run/client/options.txt
66+
onboardAccessibility:false
67+
pauseOnLostFocus:false
68+
EOF
69+
70+
- name: Run client runtime test
71+
run: xvfb-run -a timeout 10m ./gradlew runClient --no-daemon -Pmod_version="${MOD_VERSION}"
72+
73+
- name: Run server runtime test
74+
run: |
75+
set -euo pipefail
76+
77+
mkdir -p run/server
78+
echo "eula=true" > run/server/eula.txt
79+
80+
setsid ./gradlew runServer --no-daemon -Pmod_version="${MOD_VERSION}" > run/server/runtime-test-server.log 2>&1 &
81+
server_pid=$!
82+
83+
cleanup() {
84+
kill -TERM "-${server_pid}" 2>/dev/null || true
85+
wait "${server_pid}" 2>/dev/null || true
86+
}
87+
trap cleanup EXIT
88+
89+
deadline=$((SECONDS + 600))
90+
while [ "${SECONDS}" -lt "${deadline}" ]; do
91+
if ! kill -0 "${server_pid}" 2>/dev/null; then
92+
wait "${server_pid}" || exit_code=$?
93+
echo "Server exited before startup with code ${exit_code:-0}."
94+
tail -n 200 run/server/runtime-test-server.log || true
95+
exit 1
96+
fi
97+
98+
if [ -d run/server/crash-reports ] && find run/server/crash-reports -maxdepth 1 -type f -name "*.txt" | grep -q .; then
99+
echo "Server generated a crash report."
100+
find run/server/crash-reports -maxdepth 1 -type f -name "*.txt" -print
101+
tail -n 200 run/server/runtime-test-server.log || true
102+
exit 1
103+
fi
104+
105+
if grep -E 'Done \(|For help, type "help"' run/server/runtime-test-server.log >/dev/null 2>&1; then
106+
echo "Server startup detected."
107+
cleanup
108+
trap - EXIT
109+
exit 0
110+
fi
111+
112+
sleep 5
113+
done
114+
115+
echo "Server did not finish startup within 10 minutes."
116+
tail -n 200 run/server/runtime-test-server.log || true
117+
exit 1
118+
119+
- name: Upload runtime logs
120+
if: always()
121+
uses: actions/upload-artifact@v7
122+
with:
123+
name: runtime-test-logs
124+
if-no-files-found: ignore
125+
path: |
126+
run/client/logs
127+
run/client/crash-reports
128+
run/server/logs
129+
run/server/crash-reports
130+
run/server/runtime-test-server.log

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ build
2020
# other
2121
eclipse
2222
run
23+
/src/test

0 commit comments

Comments
 (0)