Skip to content

Commit c0bc090

Browse files
authored
Merge pull request #281 from SkyBlade1978/master-26.1.2
Port OreSpawn 4.0.16 to Forge 26.1.2
2 parents ec4791b + 0d97dad commit c0bc090

74 files changed

Lines changed: 5018 additions & 593 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mcmod.info text
1111
*.lang text
1212
*.mcmeta text
1313
*.md text
14+
*.patch text eol=lf -diff
1415
*.properties text
1516
gradlew text eol=lf
1617
*.sh text eol=lf

.github/workflows/ci.yml

Lines changed: 139 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,146 @@
1-
name: CI
1+
name: OreSpawn 26.1.2 CI
22

3-
on: [push, pull_request]
4-
#on:
5-
# push:
6-
# branches: [ master-1.12 ]
7-
# pull_request:
8-
# # The branches below must be a subset of the branches above
9-
# branches: [ master-1.12 ]
10-
# types: [opened, synchronize, reopened]
3+
on:
4+
push:
5+
branches:
6+
- master-26.1.2
7+
- 'feature/**'
8+
pull_request:
9+
branches:
10+
- master-26.1.2
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: orespawn-26.1.2-${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
1118

1219
jobs:
20+
cold-forge-bootstrap:
21+
name: Cold Forge bootstrap
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 60
24+
steps:
25+
- name: Check out source
26+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
27+
28+
- name: Install pinned Java 25 runtime and toolchain
29+
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
30+
with:
31+
distribution: temurin
32+
java-version: '25.0.3+9.0.LTS'
33+
34+
- name: Bootstrap Forge from an empty cache
35+
shell: bash
36+
env:
37+
GRADLE_USER_HOME: ${{ runner.temp }}/orespawn-cold-gradle
38+
run: |
39+
set -euo pipefail
40+
test ! -e .gradle
41+
test ! -e "$GRADLE_USER_HOME"
42+
chmod +x ./gradlew
43+
gradle_args=(
44+
verifyMavenizerCompatibilityFixture help
45+
--no-daemon --no-build-cache --stacktrace --max-workers=2
46+
"-Dorg.gradle.java.installations.paths=$JAVA_HOME"
47+
-Dorg.gradle.java.installations.auto-detect=false
48+
-Dorg.gradle.java.installations.auto-download=false
49+
)
50+
for attempt in 1 2 3; do
51+
if (( attempt > 1 )); then
52+
echo "Retrying the cold Forge bootstrap after transient download failure ($attempt/3)"
53+
rm -rf -- "$GRADLE_USER_HOME/caches/minecraftforge" .gradle/mavenizer
54+
sleep "$((attempt * 5))"
55+
fi
56+
mkdir -p "$GRADLE_USER_HOME"
57+
attempt_log="$RUNNER_TEMP/cold-forge-bootstrap-attempt-$attempt.log"
58+
if ./gradlew "${gradle_args[@]}" 2>&1 | tee "$attempt_log"; then
59+
cp "$attempt_log" "$RUNNER_TEMP/cold-forge-bootstrap.log"
60+
break
61+
fi
62+
if (( attempt == 3 )); then
63+
echo "Cold Forge bootstrap failed after $attempt attempts" >&2
64+
exit 1
65+
fi
66+
done
67+
grep -F "OreSpawn Mavenizer compatibility runtime: Java 25.0.3" \
68+
"$RUNNER_TEMP/cold-forge-bootstrap.log"
69+
grep -F "OreSpawn Mavenizer compatibility: applied 0 rule(s) for net.minecraftforge:forge:26.1.2-64.0.9 (explicit no-op)" \
70+
"$RUNNER_TEMP/cold-forge-bootstrap.log"
71+
find "$GRADLE_USER_HOME" .gradle/mavenizer \
72+
-name '*.orespawn-compatibility' -type f -print0 \
73+
| sort -z | xargs -0 -r sha256sum > "$RUNNER_TEMP/markers-before.sha256"
74+
test -s "$RUNNER_TEMP/markers-before.sha256"
75+
76+
- name: Verify same-cache preparation is idempotent
77+
shell: bash
78+
env:
79+
GRADLE_USER_HOME: ${{ runner.temp }}/orespawn-cold-gradle
80+
run: |
81+
set -euo pipefail
82+
./gradlew verifyMavenizerCompatibilityFixture help \
83+
--no-daemon --no-build-cache --stacktrace --max-workers=2 \
84+
-Dorg.gradle.java.installations.paths="$JAVA_HOME" \
85+
-Dorg.gradle.java.installations.auto-detect=false \
86+
-Dorg.gradle.java.installations.auto-download=false
87+
find "$GRADLE_USER_HOME" .gradle/mavenizer \
88+
-name '*.orespawn-compatibility' -type f -print0 \
89+
| sort -z | xargs -0 -r sha256sum > "$RUNNER_TEMP/markers-after.sha256"
90+
diff -u "$RUNNER_TEMP/markers-before.sha256" "$RUNNER_TEMP/markers-after.sha256"
91+
1392
build:
93+
name: Build, test, and audit
1494
runs-on: ubuntu-latest
15-
name: Build
95+
timeout-minutes: 60
96+
1697
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-java@v1
98+
- name: Check out source
99+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
100+
101+
- name: Install pinned Java 25 runtime and toolchain
102+
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
103+
with:
104+
distribution: temurin
105+
java-version: '25.0.3+9.0.LTS'
106+
107+
- name: Set up Gradle
108+
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6
109+
110+
- name: Make the wrapper executable
111+
run: chmod +x ./gradlew
112+
113+
- name: Build, test, and audit release artifacts
114+
run: >-
115+
./gradlew clean check build javadoc verifyReleaseArtifacts writeReleaseChecksums
116+
verifyEclipseProductionClasspath --no-daemon --stacktrace
117+
-Dorg.gradle.java.installations.paths="$JAVA_HOME"
118+
-Dorg.gradle.java.installations.auto-detect=false
119+
-Dorg.gradle.java.installations.auto-download=false
120+
121+
- name: Upload audited release candidate
122+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
123+
with:
124+
name: OreSpawn-26.1.2-${{ github.sha }}
125+
if-no-files-found: error
126+
retention-days: 30
127+
path: |
128+
build/libs/OreSpawn-4.0.16.2601021.jar
129+
build/libs/OreSpawn-4.0.16.2601021-sources.jar
130+
build/libs/OreSpawn-4.0.16.2601021-javadoc.jar
131+
build/release/SHA256SUMS
132+
CHANGELOG.txt
133+
134+
- name: Upload diagnostics on failure
135+
if: failure()
136+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
19137
with:
20-
java-version: 8
21-
- run: chmod a+x gradlew
22-
- run: ./gradlew --version --no-daemon
23-
- run: ./gradlew setupCIWorkspace -S
24-
- run: ./gradlew clean build -S
138+
name: OreSpawn-26.1.2-diagnostics-${{ github.sha }}
139+
if-no-files-found: ignore
140+
retention-days: 14
141+
path: |
142+
build/test-results/**
143+
build/reports/**
144+
build/*-run/logs/**
145+
build/surface-integration-run/**/*.properties
146+
build/problems/**
Lines changed: 52 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,64 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL"
1+
name: CodeQL
132

14-
on: [push, pull_request]
15-
#on:
16-
# push:
17-
# branches: [ master-1.12 ]
18-
# pull_request:
19-
# # The branches below must be a subset of the branches above
20-
# branches: [ master-1.12 ]
21-
# types: [opened, synchronize, reopened]
22-
# schedule:
23-
# - cron: '43 7 * * 4'
3+
on:
4+
push:
5+
branches:
6+
- master-26.1.2
7+
- 'feature/**'
8+
pull_request:
9+
branches:
10+
- master-26.1.2
11+
schedule:
12+
- cron: '43 7 * * 4'
13+
14+
permissions:
15+
actions: read
16+
contents: read
17+
security-events: write
2418

2519
jobs:
2620
analyze:
27-
name: Analyze
21+
name: Analyze Java
2822
runs-on: ubuntu-latest
29-
permissions:
30-
actions: read
31-
contents: read
32-
security-events: write
33-
34-
strategy:
35-
fail-fast: false
36-
matrix:
37-
language: [ 'java' ]
38-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
39-
# Learn more:
40-
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
23+
timeout-minutes: 45
4124

4225
steps:
43-
- name: Checkout repository
44-
uses: actions/checkout@v2
45-
46-
# Initializes the CodeQL tools for scanning.
47-
- name: Initialize CodeQL
48-
uses: github/codeql-action/init@v1
49-
with:
50-
languages: ${{ matrix.language }}
51-
# If you wish to specify custom queries, you can do so here or in a config file.
52-
# By default, queries listed here will override any specified in a config file.
53-
# Prefix the list here with "+" to use these queries and those in the config file.
54-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
26+
- name: Check out source
27+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
5528

56-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57-
# If this step fails, then you should remove it and run the build manually (see below)
58-
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v1
29+
- name: Install pinned Java 25 runtime and toolchain
30+
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
31+
with:
32+
distribution: temurin
33+
java-version: '25.0.3+9.0.LTS'
6034

61-
# ℹ️ Command-line programs to run using the OS shell.
62-
# 📚 https://git.io/JvXDl
35+
- name: Set up Gradle
36+
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6
6337

64-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
65-
# and modify them (or add more) to build your code if your project
66-
# uses a compiled language
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4
40+
with:
41+
languages: java-kotlin
6742

68-
#- run: |
69-
# make bootstrap
70-
# make release
43+
- name: Compile production code
44+
run: |
45+
chmod +x ./gradlew
46+
gradle_args=(
47+
clean classes --no-daemon --stacktrace
48+
"-Dorg.gradle.java.installations.paths=$JAVA_HOME"
49+
-Dorg.gradle.java.installations.auto-detect=false
50+
-Dorg.gradle.java.installations.auto-download=false
51+
)
52+
for attempt in 1 2 3; do
53+
if ./gradlew "${gradle_args[@]}"; then
54+
exit 0
55+
fi
56+
if [ "$attempt" -eq 3 ]; then
57+
echo "CodeQL compilation failed after $attempt attempts." >&2
58+
exit 1
59+
fi
60+
echo "::warning::CodeQL compilation attempt $attempt failed; retrying with the preserved Forge cache."
61+
done
7162
72-
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@v1
63+
- name: Analyze
64+
uses: github/codeql-action/analyze@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Start OreSpawn release from tag
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*.*'
7+
8+
permissions:
9+
actions: read
10+
contents: read
11+
12+
concurrency:
13+
group: orespawn-release-starter-${{ github.ref_name }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
validate-release-tag:
18+
name: Validate tag for manual release confirmation
19+
if: github.repository == 'MinecraftModDevelopmentMods/OreSpawn'
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 10
22+
23+
steps:
24+
- name: Check out tagged source
25+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Validate release tag, target metadata, and prior CI
30+
env:
31+
GH_TOKEN: ${{ github.token }}
32+
run: |
33+
set -euo pipefail
34+
35+
value() { sed -n "s/^$1=//p" gradle.properties; }
36+
release_version="$(value mod_version)"
37+
minecraft_version="$(value minecraft_version)"
38+
loader_name="$(value loader_name)"
39+
loader_code="$(value loader_code)"
40+
41+
IFS=. read -r mc_major mc_minor mc_patch extra <<<"$minecraft_version"
42+
if [[ -n "${extra:-}" || -z "${mc_major:-}" || -z "${mc_minor:-}" ]]; then
43+
echo "Invalid minecraft_version=$minecraft_version" >&2
44+
exit 1
45+
fi
46+
mc_patch="${mc_patch:-0}"
47+
if [[ ! "$mc_major" =~ ^[0-9]+$ || ! "$mc_minor" =~ ^[0-9]+$ || ! "$mc_patch" =~ ^[0-9]+$ ]]; then
48+
echo "Invalid minecraft_version=$minecraft_version" >&2
49+
exit 1
50+
fi
51+
case "$loader_name:$loader_code" in
52+
forge:1|neoforge:2) ;;
53+
*) echo "Invalid loader metadata $loader_name/$loader_code" >&2; exit 1 ;;
54+
esac
55+
printf -v minor_padded '%02d' "$((10#$mc_minor))"
56+
printf -v patch_padded '%02d' "$((10#$mc_patch))"
57+
target_suffix="${mc_major}${minor_padded}${patch_padded}${loader_code}"
58+
59+
if [[ ! "$release_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.${target_suffix}$ ]]; then
60+
echo "mod_version $release_version does not match $minecraft_version $loader_name target $target_suffix" >&2
61+
exit 1
62+
fi
63+
if [[ "$GITHUB_REF_NAME" != "$release_version" ]]; then
64+
echo "Release tag must equal mod_version $release_version; found $GITHUB_REF_NAME" >&2
65+
exit 1
66+
fi
67+
68+
successful_ci="$(gh api \
69+
"repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs?per_page=100" \
70+
--jq '[.check_runs[] | select(.name == "Build, test, and audit" and .conclusion == "success")] | length')"
71+
if [[ "$successful_ci" -lt 1 ]]; then
72+
echo "The tagged commit has no successful Build, test, and audit check" >&2
73+
exit 1
74+
fi
75+
76+
- name: Record the required manual publication step
77+
env:
78+
RELEASE_WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/workflows/deploy-release.yml
79+
run: |
80+
{
81+
echo "## Release candidate validated"
82+
echo
83+
echo "Tag \`$GITHUB_REF_NAME\` matches the selected target and has a successful Build, test, and audit check."
84+
echo
85+
echo "**Nothing has been published.**"
86+
echo
87+
echo "To continue, open [Deploy OreSpawn release]($RELEASE_WORKFLOW_URL), select **Run workflow**, and enter:"
88+
echo
89+
echo "- release_version: \`$GITHUB_REF_NAME\`"
90+
echo "- curseforge_release_level: \`release\`, \`beta\`, or \`alpha\`"
91+
echo "- confirm_live_publication: \`true\`"
92+
echo
93+
echo "The dispatcher builds and audits the immutable bundle before the separate \`release\` environment approval gate."
94+
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)