-
Notifications
You must be signed in to change notification settings - Fork 0
Add mod #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mod #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| name: Mod CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: mod | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: "21" | ||
|
|
||
| - name: Set up Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
| with: | ||
| gradle-version: "8.10.2" | ||
|
|
||
| - name: Validate matrix and run common tests | ||
| run: | | ||
| chmod +x ./gradlew | ||
| ./gradlew validateModMatrix :common:test --stacktrace --info | ||
|
|
||
| - name: Upload Gradle reports | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mod-validate-gradle-reports | ||
| path: | | ||
| mod/**/build/reports/** | ||
| mod/**/build/test-results/** | ||
|
|
||
| build: | ||
| runs-on: ubuntu-latest | ||
| needs: validate | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
| - minecraft-version: "1.21.2" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.2" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.4" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.4" | ||
| loader: forge | ||
| - minecraft-version: "1.21.4" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.5" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.5" | ||
| loader: forge | ||
| - minecraft-version: "1.21.5" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.6" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.6" | ||
| loader: forge | ||
| - minecraft-version: "1.21.6" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.7" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.7" | ||
| loader: forge | ||
| - minecraft-version: "1.21.7" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.8" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.8" | ||
| loader: forge | ||
| - minecraft-version: "1.21.8" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.9" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.9" | ||
| loader: forge | ||
| - minecraft-version: "1.21.9" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.10" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.10" | ||
| loader: forge | ||
| - minecraft-version: "1.21.10" | ||
| loader: neoforge | ||
| - minecraft-version: "1.21.11" | ||
| loader: fabric | ||
| - minecraft-version: "1.21.11" | ||
| loader: forge | ||
| - minecraft-version: "1.21.11" | ||
| loader: neoforge | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: mod | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: "21" | ||
|
|
||
| - name: Set up Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
| with: | ||
| gradle-version: "8.10.2" | ||
|
|
||
| - name: Build matrix project | ||
| id: build | ||
| env: | ||
| MINECRAFT_VERSION: ${{ matrix.minecraft-version }} | ||
| LOADER: ${{ matrix.loader }} | ||
| run: | | ||
| chmod +x ./gradlew | ||
| set -o pipefail | ||
| VERSION_KEY="${MINECRAFT_VERSION//./_}" | ||
| TASK=":versions:mc_${VERSION_KEY}:${LOADER}:build" | ||
| LOG_FILE="build-${MINECRAFT_VERSION}-${LOADER}.log" | ||
| echo "Building ${TASK}" | ||
| ./gradlew "${TASK}" --stacktrace --info 2>&1 | tee "${LOG_FILE}" | ||
| echo "log_file=${LOG_FILE}" >> "${GITHUB_OUTPUT}" | ||
|
Comment on lines
+137
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve With Suggested fix - name: Build matrix project
id: build
@@
run: |
chmod +x ./gradlew
set -o pipefail
VERSION_KEY="${MINECRAFT_VERSION//./_}"
TASK=":versions:mc_${VERSION_KEY}:${LOADER}:build"
LOG_FILE="build-${MINECRAFT_VERSION}-${LOADER}.log"
+ echo "log_file=${LOG_FILE}" >> "${GITHUB_OUTPUT}"
echo "Building ${TASK}"
- ./gradlew "${TASK}" --stacktrace --info 2>&1 | tee "${LOG_FILE}"
- echo "log_file=${LOG_FILE}" >> "${GITHUB_OUTPUT}"
+ set +e
+ ./gradlew "${TASK}" --stacktrace --info 2>&1 | tee "${LOG_FILE}"
+ status=$?
+ set -e
+ exit "${status}"Also applies to: 146-146 🤖 Prompt for AI Agents |
||
|
|
||
| - name: Write failure summary | ||
| if: failure() | ||
| env: | ||
| MINECRAFT_VERSION: ${{ matrix.minecraft-version }} | ||
| LOADER: ${{ matrix.loader }} | ||
| run: | | ||
| LOG_FILE="${{ steps.build.outputs.log_file }}" | ||
| VERSION_KEY="${MINECRAFT_VERSION//./_}" | ||
| { | ||
| echo "### Mod build failed: ${LOADER} / ${MINECRAFT_VERSION}" | ||
| echo "" | ||
| echo "**Gradle task:** \`:versions:mc_${VERSION_KEY}:${LOADER}:build\`" | ||
| echo "" | ||
| if [ -f "${LOG_FILE}" ]; then | ||
| echo "#### Error highlights" | ||
| echo '```text' | ||
| grep -E "FAILURE:|What went wrong:|Execution failed for task|error:|Caused by:|> Could not|BUILD FAILED" "${LOG_FILE}" | tail -n 40 || true | ||
| echo '```' | ||
| echo "" | ||
| echo "#### Last 120 log lines" | ||
| echo '```text' | ||
| tail -n 120 "${LOG_FILE}" | ||
| echo '```' | ||
| else | ||
| echo "No build log was captured." | ||
| fi | ||
| } >> "${GITHUB_STEP_SUMMARY}" | ||
|
|
||
| - name: Upload Gradle reports | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mod-${{ matrix.minecraft-version }}-${{ matrix.loader }}-gradle-reports | ||
| path: | | ||
| mod/**/build/reports/** | ||
| mod/**/build/test-results/** | ||
| mod/**/build/tmp/** | ||
| mod/build-*.log | ||
|
|
||
| summary: | ||
| runs-on: ubuntu-latest | ||
| needs: [validate, build] | ||
| if: always() | ||
| steps: | ||
| - name: Report overall mod CI status | ||
| run: | | ||
| { | ||
| echo "### Mod CI summary" | ||
| echo "" | ||
| echo "- validate: ${{ needs.validate.result }}" | ||
| echo "- build matrix: ${{ needs.build.result }}" | ||
| } >> "${GITHUB_STEP_SUMMARY}" | ||
|
|
||
| if [ "${{ needs.validate.result }}" != "success" ] || [ "${{ needs.build.result }}" != "success" ]; then | ||
| echo "One or more mod CI jobs failed. Open the failed matrix job for the detailed Gradle log summary." | ||
| exit 1 | ||
| fi | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,121 @@ | ||||||||||||||||
| plugins { | ||||||||||||||||
| id "java" | ||||||||||||||||
| id "dev.architectury.loom" version "${architectury_loom_version}" apply false | ||||||||||||||||
| id "architectury-plugin" version "${architectury_plugin_version}" apply false | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| ext.modSupportedMinecraftVersions = [ | ||||||||||||||||
| "1.21.2", | ||||||||||||||||
| "1.21.4", | ||||||||||||||||
| "1.21.5", | ||||||||||||||||
| "1.21.6", | ||||||||||||||||
| "1.21.7", | ||||||||||||||||
| "1.21.8", | ||||||||||||||||
| "1.21.9", | ||||||||||||||||
| "1.21.10", | ||||||||||||||||
| "1.21.11", | ||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| ext.modLoaders = ["fabric", "forge", "neoforge"] | ||||||||||||||||
|
|
||||||||||||||||
| ext.fabricApiVersions = [ | ||||||||||||||||
| "1.21.2": "0.106.1+1.21.2", | ||||||||||||||||
| "1.21.4": "0.119.4+1.21.4", | ||||||||||||||||
| "1.21.5": "0.128.2+1.21.5", | ||||||||||||||||
| "1.21.6": "0.128.2+1.21.6", | ||||||||||||||||
| "1.21.7": "0.129.0+1.21.7", | ||||||||||||||||
| "1.21.8": "0.136.1+1.21.8", | ||||||||||||||||
| "1.21.9": "0.134.1+1.21.9", | ||||||||||||||||
| "1.21.10": "0.138.4+1.21.10", | ||||||||||||||||
| "1.21.11": "0.141.4+1.21.11", | ||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| ext.forgeVersions = [ | ||||||||||||||||
| "1.21.2": null, | ||||||||||||||||
| "1.21.4": "1.21.4-54.1.16", | ||||||||||||||||
| "1.21.5": "1.21.5-55.1.10", | ||||||||||||||||
| "1.21.6": "1.21.6-56.0.4", | ||||||||||||||||
| "1.21.7": "1.21.7-57.0.3", | ||||||||||||||||
| "1.21.8": "1.21.8-58.1.18", | ||||||||||||||||
| "1.21.9": "1.21.9-59.0.5", | ||||||||||||||||
| "1.21.10": "1.21.10-60.1.9", | ||||||||||||||||
| "1.21.11": "1.21.11-61.1.8", | ||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| ext.neoForgeVersions = [ | ||||||||||||||||
| "1.21.2": "21.2.1-beta", | ||||||||||||||||
| "1.21.4": "21.4.157", | ||||||||||||||||
| "1.21.5": "21.5.97", | ||||||||||||||||
| "1.21.6": "21.6.20-beta", | ||||||||||||||||
| "1.21.7": "21.7.25-beta", | ||||||||||||||||
| "1.21.8": "21.8.53", | ||||||||||||||||
| "1.21.9": "21.9.16-beta", | ||||||||||||||||
| "1.21.10": "21.10.64", | ||||||||||||||||
| "1.21.11": "21.11.42", | ||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| allprojects { | ||||||||||||||||
| group = mod_group | ||||||||||||||||
| version = mod_version | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| subprojects { project -> | ||||||||||||||||
| apply plugin: "java" | ||||||||||||||||
|
|
||||||||||||||||
| java { | ||||||||||||||||
| toolchain { | ||||||||||||||||
| languageVersion = JavaLanguageVersion.of(21) | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| tasks.withType(JavaCompile).configureEach { | ||||||||||||||||
| options.encoding = "UTF-8" | ||||||||||||||||
| options.release = 21 | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| repositories { | ||||||||||||||||
| maven { url = "https://maven.fabricmc.net/" } | ||||||||||||||||
| maven { url = "https://maven.minecraftforge.net/" } | ||||||||||||||||
| maven { url = "https://maven.neoforged.net/releases/" } | ||||||||||||||||
| maven { url = "https://maven.architectury.dev/" } | ||||||||||||||||
| mavenCentral() | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+76
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove repository declarations; they violate The CI pipeline fails because 🔧 Proposed fix }
-
- repositories {
- maven { url = "https://maven.fabricmc.net/" }
- maven { url = "https://maven.minecraftforge.net/" }
- maven { url = "https://maven.neoforged.net/releases/" }
- maven { url = "https://maven.architectury.dev/" }
- mavenCentral()
- }
}
project(":common") {📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: Mod CI / 1_validate.txt[error] 77-77: Gradle build failed during project evaluation. Build configured to prefer settings repositories over project repositories, but repository 'maven' was added by build.gradle. (org.gradle.api.InvalidUserCodeException) 🪛 GitHub Actions: Mod CI / validate[error] 77-77: Gradle configuration failed while evaluating root project 'minecraft-script-mod'. Build was configured to prefer settings repositories over project repositories, but repository 'maven' was added by build file 'build.gradle' (repository mutation disallowed on project). 🤖 Prompt for AI Agents |
||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| project(":common") { | ||||||||||||||||
| dependencies { | ||||||||||||||||
| testImplementation platform("org.junit:junit-bom:5.10.3") | ||||||||||||||||
| testImplementation "org.junit.jupiter:junit-jupiter" | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| test { | ||||||||||||||||
| useJUnitPlatform() | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| tasks.register("validateModMatrix") { | ||||||||||||||||
| inputs.file(rootProject.file("../minecraft_script/versions/index.json")) | ||||||||||||||||
| doLast { | ||||||||||||||||
| def index = new groovy.json.JsonSlurper().parse(rootProject.file("../minecraft_script/versions/index.json")) | ||||||||||||||||
| def expectedVersions = index.supported.findAll { it != "26.1" } | ||||||||||||||||
| if (expectedVersions != modSupportedMinecraftVersions) { | ||||||||||||||||
| throw new GradleException("modSupportedMinecraftVersions must equal versions/index.json supported minus 26.1. expected=${expectedVersions}, actual=${modSupportedMinecraftVersions}") | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| def missingProjects = [] | ||||||||||||||||
| expectedVersions.each { mcVersion -> | ||||||||||||||||
| modLoaders.each { loader -> | ||||||||||||||||
| if (loader == "forge" && forgeVersions[mcVersion] == null) { | ||||||||||||||||
| return | ||||||||||||||||
| } | ||||||||||||||||
| def projectPath = ":versions:mc_${mcVersion.replace(".", "_")}:${loader}" | ||||||||||||||||
| if (findProject(projectPath) == null) { | ||||||||||||||||
| missingProjects.add(projectPath) | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| if (!missingProjects.isEmpty()) { | ||||||||||||||||
| throw new GradleException("Missing mod matrix projects: ${missingProjects.join(", ")}") | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pin all GitHub Actions to commit SHAs.
Using floating tags (
@v4) leaves CI vulnerable to upstream action supply-chain drift and violates the repository’s stated policy. Pin each action to an immutable full-length commit SHA.Suggested hardening diff
Also applies to: 23-23, 29-29, 38-38, 78-78, 81-81, 87-87, 103-103
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 20-20: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 20-20: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Source: Linters/SAST tools