Skip to content
Closed
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
6 changes: 0 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

10 changes: 0 additions & 10 deletions .github/scripts/generate-matrices.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#!/usr/bin/env bash
# Derives the CI job matrices from supported-versions.json (the single source
# of truth for supported Minecraft versions) and writes them to GITHUB_OUTPUT:
# - build: one entry per build variant -> { mc, java }
# - launch: one entry per launchable version -> { mc, java, pregen_world }
# - publish: one entry per build variant -> { mc, java, game_versions, range }
# pregen_world marks versions whose Fabric API has no client gametest module;
# their launch test needs a pre-generated world (see generate-test-world.sh).
# game_versions is the newline-separated list of Minecraft versions the
# variant's jar covers (fed to mc-publish), range is its human-readable form
# for the release name (e.g. "1.21-1.21.5").
set -euo pipefail

JSON=supported-versions.json
Expand Down
11 changes: 0 additions & 11 deletions .github/scripts/generate-test-world.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
#!/usr/bin/env bash
# Generates a vanilla singleplayer world save for the given Minecraft version
# by briefly running that version's dedicated server, and places it where the
# launch test expects it (launchtest/run/saves/ci-world).
#
# Only needed for versions whose Fabric API has no client gametest module
# (before 1.21.4): their launch test cannot create a world in-game, so the
# client auto-joins this save via --quickPlaySingleplayer instead. Using the
# exact same Minecraft version to generate the world avoids any world-upgrade
# prompts when the client opens it.
set -euo pipefail

MC_VERSION="${1:?usage: generate-test-world.sh <minecraft-version>}"
Expand All @@ -22,8 +13,6 @@ SERVER_URL="$(curl -sSf "$MANIFEST_URL" | jq -r '.downloads.server.url')"
curl -sSfo server.jar "$SERVER_URL"

echo "eula=true" > eula.txt
# A flat world keeps generation fast and renders instantly on the CI software
# renderer. The default gamemode (survival) matches the gametest-based runs.
cat > server.properties <<'EOF'
level-name=ci-world
level-type=minecraft\:flat
Expand Down
13 changes: 0 additions & 13 deletions .github/scripts/publish-screenshots.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
#!/usr/bin/env bash
# Collects the launch-test screenshots uploaded as artifacts by every matrix
# job of the current workflow run, normalizes their names, and commits them to
# the ci-screenshots branch so they can be embedded (as raw.githubusercontent
# URLs) in a PR comment and in the job summary.
#
# Leaves the normalized screenshots in screenshots-publish/ for the comment
# step: <sha>/mc-<version>-survival.png and <sha>/mc-<version>-title.png.
#
# Required env: GITHUB_TOKEN, GITHUB_REPOSITORY, GITHUB_RUN_ID, GITHUB_SHA
set -euo pipefail

api() {
curl -sSf -H "Authorization: Bearer $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" "$@"
}

# --- Download every launch-screenshots-mc* artifact of this run -------------
mkdir -p artifact-zips shots
api "https://api.github.com/repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts?per_page=100" > artifacts.json

Expand All @@ -28,7 +18,6 @@ while IFS=: read -r id name; do
unzip -oq "artifact-zips/$id.zip" -d "shots/$mc"
done < <(jq -r '.artifacts[] | select(.name | startswith("launch-screenshots-mc")) | "\(.id):\(.name)"' artifacts.json)

# --- Normalize names (gametest screenshots carry a timestamp prefix) --------
PUBLISH="screenshots-publish/$GITHUB_SHA"
mkdir -p "$PUBLISH"

Expand All @@ -49,7 +38,6 @@ if [ "$count" -eq 0 ]; then
exit 0
fi

# --- Commit to the ci-screenshots branch ------------------------------------
REMOTE="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
if ! git clone --quiet --depth 1 --branch ci-screenshots "$REMOTE" ci-screenshots-branch 2>/dev/null; then
mkdir -p ci-screenshots-branch
Expand All @@ -68,7 +56,6 @@ fi
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit --quiet -m "CI screenshots for $GITHUB_SHA"

# Retry the push in case a concurrent run updated the branch first.
for _ in 1 2 3; do
if git push --quiet origin ci-screenshots; then
echo "Published screenshots to ci-screenshots/$GITHUB_SHA"
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# Build the mod for every Stonecutter variant, then launch-test the built jars
# on EVERY supported Minecraft version concurrently: each launch job boots a
# real production Fabric client under XVFB with the covering variant's jar and
# version-matched runtime mods, enters a survival singleplayer world with the
# HUD active, screenshots it, and fails if anything crashes on the way.
# The screenshot report job embeds all screenshots in a PR comment (via the
# ci-screenshots branch) and in the job summary, and the modrinth bundle job
# packages the release jars with their per-jar Minecraft version lists.
#
# Both job matrices are generated from supported-versions.json — add a version
# there (see README) and every job picks it up.

name: build
on: push

# contents: write lets the screenshot report push to the ci-screenshots branch,
# pull-requests: write lets it comment on the associated pull request.
permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -67,14 +53,6 @@ jobs:
name: betterhud-mc${{ matrix.mc }}
path: versions/${{ matrix.mc }}/build/libs/*.jar

# One job per supported Minecraft version (not per build variant): the
# 1.21 variant jar is launch-tested on 1.21-1.21.5, the 1.21.6 variant jar
# on 1.21.6-1.21.11, and so on.
#
# pregen_world marks versions whose Fabric API has no client gametest module
# (before 1.21.4): for those a vanilla world save is generated first with
# that version's dedicated server, and the client auto-joins it instead of
# creating one through the gametest API.
launch-test:
name: launch mc${{ matrix.mc }}
runs-on: ubuntu-24.04
Expand All @@ -101,7 +79,6 @@ jobs:
run: chmod +x ./gradlew

- name: install xvfb
# Provides a virtual display so the Minecraft client can launch headlessly.
run: sudo apt-get update && sudo apt-get install -y xvfb

- name: generate singleplayer test world
Expand All @@ -115,7 +92,6 @@ jobs:
run: test -n "$(find launchtest/run/screenshots -name '*betterhud-survival-world.png' -print -quit 2>/dev/null)"

- name: upload screenshots
# Consumed by the screenshot-report job below.
if: always()
uses: actions/upload-artifact@v7
with:
Expand Down Expand Up @@ -175,7 +151,6 @@ jobs:
`<table>\n${rows}</table>`,
].join('\n');

// Always show the grid in the job summary, even without a PR.
await core.summary.addRaw(body).write();

const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
Expand All @@ -189,7 +164,6 @@ jobs:
return;
}

// Keep a single comment up to date instead of posting one per push.
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: pr.number, per_page: 100,
Expand All @@ -207,9 +181,6 @@ jobs:
});
}

# Builds every variant and bundles the release jars together with UPLOAD.md,
# which lists exactly which Minecraft versions to select for each jar when
# uploading to Modrinth. Download the "modrinth-upload" artifact and follow it.
modrinth-bundle:
name: modrinth bundle
runs-on: ubuntu-24.04
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# Publishes the mod to Modrinth and CurseForge on demand: bump `mod_version`
# in gradle.properties, push, then run this workflow from the Actions tab.
# It builds every Stonecutter variant and uploads each release jar as its own
# version on both platforms, selecting exactly the Minecraft versions that jar
# covers — driven by supported-versions.json, the same single source of truth
# the build and launch-test matrices use.
#
# Required repository secrets (Settings -> Secrets and variables -> Actions):
# - MODRINTH_TOKEN: Modrinth PAT with the "Create versions" scope
# (https://modrinth.com/settings/pats)
# - CURSEFORGE_TOKEN: CurseForge API token
# (https://legacy.curseforge.com/account/api-tokens)
#
# This workflow only builds; correctness on every supported Minecraft version
# is already covered by the launch tests that run on every push (build.yml),
# so make sure the commit you release from is green there first.

name: publish
on:
workflow_dispatch:
Expand Down Expand Up @@ -45,7 +28,6 @@ on:
permissions:
contents: read

# Never let two release runs interleave their uploads.
concurrency:
group: publish
cancel-in-progress: false
Expand Down Expand Up @@ -73,9 +55,6 @@ jobs:
echo "Releasing BetterHUD $version"

- name: check the required tokens are configured
# mc-publish silently skips a platform whose token is empty, which
# would make a run "succeed" while publishing nothing — fail early
# instead if a selected platform has no token.
env:
PLATFORMS: ${{ inputs.platforms }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
Expand All @@ -93,9 +72,6 @@ jobs:
runs-on: ubuntu-24.04
needs: matrices
strategy:
# Publish one variant at a time, oldest first (supported-versions.json
# order), so the newest-Minecraft version ends up as the most recently
# uploaded — and a failure stops before uploading the rest.
max-parallel: 1
fail-fast: true
matrix:
Expand All @@ -122,8 +98,6 @@ jobs:
- name: publish to modrinth and curseforge
uses: Kir-Antipov/mc-publish@v3.3
with:
# An empty token makes mc-publish skip that platform, which is how
# the "platforms" input narrows the run to a single site.
modrinth-id: betterhudfabric
modrinth-token: ${{ inputs.platforms != 'curseforge' && secrets.MODRINTH_TOKEN || '' }}
curseforge-id: 1375095
Expand Down
16 changes: 0 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,31 @@
# gradle

.gradle/
build/
out/
classes/

# eclipse

*.launch

# idea

.idea/
*.iml
*.ipr
*.iws

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store

# fabric

run/

# stonecutter

versions/*/.gradle/
versions/*/build/
versions/*/run/
versions/*/src/
*.stonecutter.tmp

# java

hs_err_*.log
replay_*.log
*.hprof
Expand Down
15 changes: 2 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
plugins {
// Loom 1.14+ splits into two sibling plugins:
// - `net.fabricmc.fabric-loom-remap` handles obfuscated MC (1.21.x with intermediary)
// - `net.fabricmc.fabric-loom` handles unobfuscated MC (26.1+, Mojang names native)
// We declare both with `apply false` and pick the right one for the current variant.
id 'net.fabricmc.fabric-loom-remap' version "${loom_version}" apply false
id 'net.fabricmc.fabric-loom' version "${loom_version}" apply false
id 'maven-publish'
}

def mcVersion = stonecutter.current.version
def isLegacy = stonecutter.eval(mcVersion, '<26') // 1.21.x family
def hasHudElementRegistry = stonecutter.eval(mcVersion, '>=1.21.6') // 1.21.6+ and 26+
def isLegacy = stonecutter.eval(mcVersion, '<26')
def hasHudElementRegistry = stonecutter.eval(mcVersion, '>=1.21.6')

apply plugin: isLegacy ? 'net.fabricmc.fabric-loom-remap' : 'net.fabricmc.fabric-loom'

// Per-MC Java version (21 for 1.21.x, 25 for 26.1+).
def javaVersionInt = Integer.parseInt(project.java_version)
def javaLang = JavaVersion.toVersion(javaVersionInt)
def mixinJavaCompat = "JAVA_${javaVersionInt}"
Expand All @@ -31,8 +26,6 @@ repositories {
maven { url 'https://maven.terraformersmc.com/releases/' }
}

// MC 26+ uses fabric-rendering-v1's transitive deps but rejects ASM coming from
// annotation processors.
if (!isLegacy) {
configurations.configureEach {
if (name.toLowerCase().contains('annotationprocessor')) {
Expand All @@ -41,9 +34,6 @@ if (!isLegacy) {
}
}

// Every variant declares fabric-api, modmenu, and cloth-config as runtime deps
// (not bundled). 1.21.x uses modImplementation for intermediary remapping; 26.x
// uses plain implementation against unobfuscated MC.
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"

Expand Down Expand Up @@ -118,6 +108,5 @@ publishing {
}
}
repositories {
// Add publish repos here if/when needed.
}
}
6 changes: 0 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true

# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349
org.gradle.configuration-cache=false

# Acknowledge using Groovy DSL with Stonecutter (Kotlin DSL is recommended but Groovy works).
dev.kikugie.stonecutter.hard_mode=true

# Single loom version covers all MC variants. The `fabric-loom-remap` plugin id
# handles obfuscated MC (1.21.x), while `fabric-loom` handles unobfuscated MC (26.2+).
loom_version=1.17-SNAPSHOT

# Mod Properties (shared)
mod_version=2.1.1
maven_group=dsns.betterhud
archives_base_name=betterhud
Loading
Loading