Skip to content

Commit

Permalink
Merge branch 'master' into modded-player-interaction-compat
Browse files Browse the repository at this point in the history
  • Loading branch information
altrisi committed Jun 27, 2024
2 parents abc06a4 + 2ea6108 commit 3e910ce
Show file tree
Hide file tree
Showing 24 changed files with 664 additions and 64 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'gradle'
- name: Grant execute permission to gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- uses: actions/upload-artifact@v3
- name: Build and run Gametest with Gradle
run: ./gradlew build runGametest
- uses: actions/upload-artifact@v4
with:
name: "Compiled artifacts for Pull Request #${{github.event.number}}"
path: build/libs
- uses: actions/upload-artifact@v4
if: always()
with:
name: gametest-results
path: build/junit.xml
15 changes: 10 additions & 5 deletions .github/workflows/devbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'gradle'
- name: Grant execute permission to gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- uses: actions/upload-artifact@v3
- name: Build and run Gametest with Gradle
run: ./gradlew build runGametest
- uses: actions/upload-artifact@v4
with:
name: Compiled artifacts for ${{ github.sha }}
path: build/libs
- uses: actions/upload-artifact@v4
if: always()
with:
name: Gametest results for ${{ github.sha }}
path: build/junit.xml
14 changes: 7 additions & 7 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
extra-branch-curse-version: ${{ steps.properties.outputs.release-extra-curse-version }}
steps:
- name: Checkout the sources
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Determine release type
id: type
run: |
Expand All @@ -41,7 +41,7 @@ jobs:
if ! ${{ steps.properties.outputs.release-extra-branch }}; then
echo "matrix-to-exclude=Snapshots" >> $GITHUB_OUTPUT
fi
- uses: actions/github-script@v6
- uses: actions/github-script@v7
env:
READ_VERSION: ${{ steps.properties.outputs.mod_version }}
with:
Expand Down Expand Up @@ -78,11 +78,11 @@ jobs:
echo "curse-versions=${{ needs.Get-Properties.outputs.curse-versions }}" >> $GITHUB_OUTPUT
fi
- name: Checkout the sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ steps.getbranchinfo.outputs.branchname }}
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
Expand All @@ -97,7 +97,7 @@ jobs:
output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")"
echo "jarname=$output" >> $GITHUB_OUTPUT
- name: Save build artifacts in the action
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts for ${{ matrix.branch }}
path: build/libs
Expand Down Expand Up @@ -127,11 +127,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Carpet extra sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: master
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/testreport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Attach test report

# Needs to be run separately because runs on external repositories can't add checks
on:
workflow_run:
workflows: [ "Pull Request Builds" ]
types: [ completed ]

jobs:
Upload:
runs-on: ubuntu-latest
steps:
- name: Download Test Report
uses: actions/download-artifact@v4
with:
name: gametest-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Attach Test Report
uses: mikepenz/action-junit-report@v3
with:
commit: ${{github.event.workflow_run.head_sha}}
report_paths: 'junit.xml'
check_name: Gametest report
summary: "Note that most functionality isn't currently tested by Gametest"
58 changes: 48 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -9,15 +9,13 @@ repositories {
}
}

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
base {
archivesName = project.archives_base_name
}

archivesBaseName = project.archives_base_name
version = project.minecraft_version+'-'+project.mod_version
group = project.maven_group

loom {
}

dependencies {
//to change the versions see the gradle.properties file
Expand All @@ -26,11 +24,48 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "carpet:fabric-carpet:${project.minecraft_version}-${project.carpet_core_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// for gametests
modRuntimeOnly fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version)
modRuntimeOnly fabricApi.module("fabric-api-base", project.fabric_api_version)
modRuntimeOnly fabricApi.module("fabric-gametest-api-v1", project.fabric_api_version)
}

sourceSets {
gametest {
java {
compileClasspath += main.output
compileClasspath += main.compileClasspath
runtimeClasspath += main.output
runtimeClasspath += main.runtimeClasspath
}
}
}

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
loom {
runs {
gametest {
inherit server
name "Game Test"
vmArg "-Dfabric-api.gametest"
//vmArg "-Dmixin.debug.countInjections=true" // gnembon/fabric-carpet#1938
vmArg "-Dfabric-api.gametest.report-file=${project.buildDir}/junit.xml"
source sourceSets.gametest
runDir "build/gametest"
ideConfigGenerated = false
}
}
runConfigs.configureEach {
// to be able to create and run gametests on regular debug
source sourceSets.gametest
}
mods {
"carpet-extra" {
sourceSet sourceSets.main
}
"carpet-extra-gametest" {
sourceSet sourceSets.gametest
}
}
}

processResources {
Expand All @@ -55,6 +90,9 @@ java {
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
Expand Down
12 changes: 7 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
# check available versions on maven (https://masa.dy.fi/maven/carpet/fabric-carpet/) for the given minecraft version you are using
carpet_core_version=1.4.141+v240429
carpet_core_version=1.4.147+v240613
# for gametests
fabric_api_version=0.100.3+1.21

# Mod Properties
mod_version = 1.4.141
mod_version = 1.4.147
maven_group = carpet-extra
archives_base_name = carpet-extra

Expand All @@ -21,7 +23,7 @@ org.gradle.jvmargs=-Xmx1G
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
# This is needed because CF uses too vague names for prereleases and release candidates
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-curse-versions = Minecraft 1.20:1.20.5,Minecraft 1.20:1.20.6
release-curse-versions = Minecraft 1.21:1.21
# Whether or not to build another branch on release
release-extra-branch = false
# The name of the second branch to release
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 11 additions & 0 deletions src/gametest/java/carpetextra/ExportPathChanger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package carpetextra;

import net.fabricmc.api.ModInitializer;
import net.minecraft.test.StructureTestUtil;

public class ExportPathChanger implements ModInitializer {
@Override
public void onInitialize() {
StructureTestUtil.testStructuresDirectoryName = "../src/gametest/resources/data/carpet-extra/gametest/structure";
}
}
Loading

0 comments on commit 3e910ce

Please sign in to comment.