From 0e0e5e0445e89cab73001b3f089357d6bd3efa75 Mon Sep 17 00:00:00 2001 From: Matyrobbrt Date: Tue, 27 Aug 2024 11:06:18 +0300 Subject: [PATCH] Update actions to match #1172 Adds JCC and check local changes so that 1.20.x PRs can be merged. Additionally, updates to setup-gradle@v4 and the new custom action for setting up Java. --- .github/workflows/build-prs.yml | 26 +++++----- .github/workflows/check-local-changes.yml | 47 +++++++++++++++++++ .github/workflows/publish-jcc.yml | 20 ++++++++ .github/workflows/test-prs.yml | 25 ++++------ build.gradle | 2 +- projects/neoforge/build.gradle | 22 +++++++++ settings.gradle | 2 +- .../resources/reports/registry_order.json | 3 +- ...wnward_bubble_column_sustaining_block.json | 7 +++ ...upward_bubble_column_sustaining_block.json | 7 +++ .../lang/en_us.json | 4 ++ ...wnward_bubble_column_sustaining_block.json | 6 +++ ...upward_bubble_column_sustaining_block.json | 6 +++ ...wnward_bubble_column_sustaining_block.json | 3 ++ ...upward_bubble_column_sustaining_block.json | 3 ++ .../compound_ingredient_custom_types.json | 18 ++++++- .../recipes/block_tag.json | 9 +++- .../advancements/named_item.json | 9 ++-- .../loot_modifiers/smelting.json | 16 ++++--- 19 files changed, 193 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/check-local-changes.yml create mode 100644 .github/workflows/publish-jcc.yml create mode 100644 tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/downward_bubble_column_sustaining_block.json create mode 100644 tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/upward_bubble_column_sustaining_block.json create mode 100644 tests/src/generated/resources/assets/neotests_bubble_column_test/lang/en_us.json create mode 100644 tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/downward_bubble_column_sustaining_block.json create mode 100644 tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/upward_bubble_column_sustaining_block.json create mode 100644 tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/downward_bubble_column_sustaining_block.json create mode 100644 tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/upward_bubble_column_sustaining_block.json diff --git a/.github/workflows/build-prs.yml b/.github/workflows/build-prs.yml index 1c2db4fc2b..1175f732fe 100644 --- a/.github/workflows/build-prs.yml +++ b/.github/workflows/build-prs.yml @@ -31,23 +31,27 @@ jobs: run: git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }} - - name: Setup JDK 17 - uses: actions/setup-java@v2 + - name: Setup JDK 21 + uses: neoforged/actions/setup-java@main with: - java-version: '17' - distribution: 'temurin' + java-version: 21 - - name: Setup with Gradle - uses: gradle/gradle-build-action@v2 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 with: - arguments: setup cache-read-only: false + - name: Setup with Gradle + run: ./gradlew setup + - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: assemble checkFormatting - cache-read-only: false + run: ./gradlew assemble checkFormatting + + - name: Run JCC + run: ./gradlew checkJarCompatibility + + - name: Upload JCC + uses: neoforged/action-jar-compatibility/upload@v1 - name: Publish artifacts uses: neoforged/action-pr-publishing/upload@v1 diff --git a/.github/workflows/check-local-changes.yml b/.github/workflows/check-local-changes.yml new file mode 100644 index 0000000000..4b850756f1 --- /dev/null +++ b/.github/workflows/check-local-changes.yml @@ -0,0 +1,47 @@ +name: Check PR local changes + +on: + pull_request: + types: + - synchronize + - opened + - ready_for_review + - reopened + +jobs: + check-local-changes: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1000 + fetch-tags: true + + # GradleUtils will append the branch name to the version, + # but for that we need a properly checked out branch + - name: Create branch for commit + run: + git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }} + + - name: Setup JDK 21 + uses: neoforged/actions/setup-java@main + with: + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + cache-read-only: false + + - name: Setup with Gradle + run: ./gradlew setup + + - name: Run datagen with Gradle + run: ./gradlew :neoforge:runData :tests:runData + + - name: Check no local changes are present + run: | + # Print status for easier debugging + git status + if [ -n "$(git status --porcelain)" ]; then exit 1; fi diff --git a/.github/workflows/publish-jcc.yml b/.github/workflows/publish-jcc.yml new file mode 100644 index 0000000000..f4c78789bc --- /dev/null +++ b/.github/workflows/publish-jcc.yml @@ -0,0 +1,20 @@ +# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly +# The template can be found at https://github.com/neoforged/GradleUtils/blob/a65628b0c89dec60b357ce3f8f6bfa62934b8357/src/actionsTemplate/resources/.github/workflows/publish-jcc.yml + +name: Publish PR JCC output + +on: + workflow_run: + workflows: [Build PRs] + types: + - completed + +jobs: + publish-jcc: + if: true + uses: neoforged/actions/.github/workflows/publish-jcc.yml@main + with: + beta_version_pattern: .*-beta.* + secrets: + JCC_GH_APP_ID: ${{ secrets.JCC_GH_APP_ID }} + JCC_GH_APP_KEY: ${{ secrets.JCC_GH_APP_KEY }} diff --git a/.github/workflows/test-prs.yml b/.github/workflows/test-prs.yml index 3d0ef4b3d0..51afdcddad 100644 --- a/.github/workflows/test-prs.yml +++ b/.github/workflows/test-prs.yml @@ -28,29 +28,24 @@ jobs: run: git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }} - - name: Setup JDK 17 - uses: actions/setup-java@v2 + - name: Setup JDK 21 + uses: neoforged/actions/setup-java@main with: - java-version: '17' - distribution: 'temurin' + java-version: 21 - - name: Setup with Gradle - uses: gradle/gradle-build-action@v2 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 with: - arguments: setup cache-read-only: false + - name: Setup with Gradle + run: ./gradlew setup + - name: Run game tests with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: :tests:runGameTestServer - cache-read-only: false + run: ./gradlew :tests:runGameTestServer - name: Run JUnit tests with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: :tests:runUnitTests - cache-read-only: false + run: ./gradlew :tests:runUnitTests - name: Store reports if: failure() diff --git a/build.gradle b/build.gradle index 9244f6a6a5..6a5d8a1dd0 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ import java.util.regex.Matcher import java.util.regex.Pattern plugins { - id 'net.neoforged.gradleutils' version '3.0.0-alpha.10' apply false + id 'net.neoforged.gradleutils' version '3.0.0' apply false id 'com.diffplug.spotless' version '6.22.0' apply false id 'net.neoforged.licenser' version '0.7.2' id 'neoforge.formatting-conventions' diff --git a/projects/neoforge/build.gradle b/projects/neoforge/build.gradle index 0100bf10cf..bbfeefbeb9 100644 --- a/projects/neoforge/build.gradle +++ b/projects/neoforge/build.gradle @@ -1,6 +1,10 @@ +import net.neoforged.jarcompatibilitychecker.gradle.JCCPlugin +import net.neoforged.jarcompatibilitychecker.gradle.ProvideNeoForgeJarTask + plugins { id 'java-library' id 'maven-publish' + id 'net.neoforged.jarcompatibilitychecker' version '0.1.9' } rootProject.gradleutils.setupSigning(project: project, signAllPublications: true) @@ -11,6 +15,24 @@ dynamicProject { rootProject.layout.projectDirectory.dir('rejects')) } +final checkVersion = JCCPlugin.providePreviousVersion( + project.providers, project.providers.provider({['https://maven.neoforged.net/releases']}), project.providers.provider({'net.neoforged:neoforge'}) +) +final createCompatJar = tasks.register('createCompatibilityCheckJar', ProvideNeoForgeJarTask) { + // Use the same jar that the patches were generated against + cleanJar.set(tasks.generateClientBinaryPatches.clean) + maven.set('https://maven.neoforged.net/releases') + artifact.set('net.neoforged:neoforge') + version.set(checkVersion) + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(java_version) + } +} +checkJarCompatibility { + isAPI = true + baseJar = createCompatJar.flatMap { it.output } +} + installerProfile { profile = 'NeoForge' } diff --git a/settings.gradle b/settings.gradle index 1ac035355b..589f0b3ad1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,7 +7,7 @@ pluginManagement { } plugins { - id 'net.neoforged.gradle.platform' version '7.0.142' + id 'net.neoforged.gradle.platform' version '7.0.149' } rootProject.name = rootDir.name diff --git a/src/generated/resources/reports/registry_order.json b/src/generated/resources/reports/registry_order.json index 07557e0d08..e644e9e65e 100644 --- a/src/generated/resources/reports/registry_order.json +++ b/src/generated/resources/reports/registry_order.json @@ -2,6 +2,7 @@ "order": [ "minecraft:attribute", "minecraft:data_component_type", + "minecraft:armor_material", "minecraft:game_event", "minecraft:sound_event", "minecraft:fluid", @@ -70,7 +71,6 @@ "minecraft:creative_mode_tab", "minecraft:trigger_type", "minecraft:number_format_type", - "minecraft:armor_material", "minecraft:entity_sub_predicate_type", "minecraft:item_sub_predicate_type", "minecraft:map_decoration_type", @@ -79,6 +79,7 @@ "neoforge:condition_codecs", "neoforge:display_contexts", "neoforge:entity_data_serializers", + "neoforge:fluid_ingredient_type", "neoforge:fluid_type", "neoforge:global_loot_modifier_serializers", "neoforge:holder_set_type", diff --git a/tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/downward_bubble_column_sustaining_block.json b/tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/downward_bubble_column_sustaining_block.json new file mode 100644 index 0000000000..0c1432894b --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/downward_bubble_column_sustaining_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "neotests_bubble_column_test:block/downward_bubble_column_sustaining_block" + } + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/upward_bubble_column_sustaining_block.json b/tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/upward_bubble_column_sustaining_block.json new file mode 100644 index 0000000000..64bf93669e --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_bubble_column_test/blockstates/upward_bubble_column_sustaining_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "neotests_bubble_column_test:block/upward_bubble_column_sustaining_block" + } + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_bubble_column_test/lang/en_us.json b/tests/src/generated/resources/assets/neotests_bubble_column_test/lang/en_us.json new file mode 100644 index 0000000000..d8d34da9c9 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_bubble_column_test/lang/en_us.json @@ -0,0 +1,4 @@ +{ + "block.neotests_bubble_column_test.downward_bubble_column_sustaining_block": "Downward Bubble Column Sustaining block", + "block.neotests_bubble_column_test.upward_bubble_column_sustaining_block": "Upward Bubble Column Sustaining block" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/downward_bubble_column_sustaining_block.json b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/downward_bubble_column_sustaining_block.json new file mode 100644 index 0000000000..ce4a458c61 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/downward_bubble_column_sustaining_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "testframework:block/white" + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/upward_bubble_column_sustaining_block.json b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/upward_bubble_column_sustaining_block.json new file mode 100644 index 0000000000..ce4a458c61 --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/block/upward_bubble_column_sustaining_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "testframework:block/white" + } +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/downward_bubble_column_sustaining_block.json b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/downward_bubble_column_sustaining_block.json new file mode 100644 index 0000000000..1a7797eb6f --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/downward_bubble_column_sustaining_block.json @@ -0,0 +1,3 @@ +{ + "parent": "neotests_bubble_column_test:block/downward_bubble_column_sustaining_block" +} \ No newline at end of file diff --git a/tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/upward_bubble_column_sustaining_block.json b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/upward_bubble_column_sustaining_block.json new file mode 100644 index 0000000000..244bf4ae6c --- /dev/null +++ b/tests/src/generated/resources/assets/neotests_bubble_column_test/models/item/upward_bubble_column_sustaining_block.json @@ -0,0 +1,3 @@ +{ + "parent": "neotests_bubble_column_test:block/upward_bubble_column_sustaining_block" +} \ No newline at end of file diff --git a/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json b/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json index 0fbe392450..bf0487b715 100644 --- a/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json +++ b/tests/src/generated/resources/data/data_gen_test/recipes/compound_ingredient_custom_types.json @@ -47,7 +47,23 @@ "levels": {} }, "minecraft:lore": [], - "minecraft:repair_cost": 0 + "minecraft:max_damage": 131, + "minecraft:max_stack_size": 1, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0, + "minecraft:tool": { + "rules": [ + { + "blocks": "#minecraft:incorrect_for_stone_tool", + "correct_for_drops": false + }, + { + "blocks": "#minecraft:mineable/pickaxe", + "correct_for_drops": true, + "speed": 4.0 + } + ] + } }, "items": "minecraft:stone_pickaxe", "strict": true diff --git a/tests/src/generated/resources/data/neotests_block_tag_ingredient/recipes/block_tag.json b/tests/src/generated/resources/data/neotests_block_tag_ingredient/recipes/block_tag.json index 3638a4dce6..aae7551fb0 100644 --- a/tests/src/generated/resources/data/neotests_block_tag_ingredient/recipes/block_tag.json +++ b/tests/src/generated/resources/data/neotests_block_tag_ingredient/recipes/block_tag.json @@ -3,8 +3,13 @@ "category": "misc", "ingredients": [ { - "type": "neoforge:block_tag", - "tag": "minecraft:convertable_to_mud" + "type": "testframework:test_enabled", + "base": { + "type": "neoforge:block_tag", + "tag": "minecraft:convertable_to_mud" + }, + "framework": "neotests:tests", + "testId": "blockTagIngredient" }, { "item": "minecraft:water_bucket" diff --git a/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json b/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json index 678814251b..318e2f81b6 100644 --- a/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json +++ b/tests/src/generated/resources/data/neotests_custom_predicate_test/advancements/named_item.json @@ -5,9 +5,12 @@ "conditions": { "items": [ { - "type": "neotests_custom_predicate_test:custom_name", - "data1": 1, - "data2": 2 + "predicates": { + "neotests_custom_predicate_test:custom_name": { + "data1": 1, + "data2": 2 + } + } } ] }, diff --git a/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/smelting.json b/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/smelting.json index 2f6ac02127..6fac90e21b 100644 --- a/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/smelting.json +++ b/tests/src/generated/resources/data/neotests_glm_test/loot_modifiers/smelting.json @@ -4,14 +4,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "neotests_glm_test:smelt", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "neotests_glm_test:smelt", + "levels": { + "min": 1 + } } - } - ] + ] + } } }, {