Skip to content

Commit

Permalink
Action updates (#1172)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt authored Jun 24, 2024
1 parent 003f3e4 commit 238c02a
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 24 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,31 @@ jobs:
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}

- name: Validate wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'

- name: Setup with Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
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
48 changes: 48 additions & 0 deletions .github/workflows/check-local-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
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
20 changes: 20 additions & 0 deletions .github/workflows/publish-jcc.yml
Original file line number Diff line number Diff line change
@@ -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 }}
18 changes: 7 additions & 11 deletions .github/workflows/test-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ jobs:
java-version: '21'
distribution: 'temurin'

- name: Setup with Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
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()
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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-alpha.13' apply false
id 'com.diffplug.spotless' version '6.22.0' apply false
id 'net.neoforged.licenser' version '0.7.2'
id 'neoforge.formatting-conventions'
Expand Down
22 changes: 22 additions & 0 deletions projects/neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}

apply plugin: 'net.neoforged.gradleutils'
Expand All @@ -18,6 +22,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'
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/generated/resources/data/c/tags/item/tools/bow.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"values": [
"minecraft:brush",
"minecraft:bow",
{
"id": "#c:tools/brushes",
"id": "#forge:tools/bows",
"required": false
},
{
Expand Down
1 change: 0 additions & 1 deletion src/generated/resources/reports/registry_order.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"neoforge:attachment_types",
"neoforge:biome_modifier_serializers",
"neoforge:condition_codecs",
"neoforge:display_contexts",
"neoforge:entity_data_serializers",
"neoforge:fluid_ingredient_type",
"neoforge:fluid_type",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"parent": "minecraft:item/generated",
"display": {
"custom_transformtype_test:hanging": {
"neotests:hanging": {
"rotation": [
62,
147,
Expand Down

0 comments on commit 238c02a

Please sign in to comment.