Skip to content

Commit

Permalink
Introduce gradle build cache caching to action and fix formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Dec 24, 2023
1 parent 45ceea7 commit 615297b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
6 changes: 5 additions & 1 deletion .github/actions/gradle-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ runs:
with:
distribution: 'microsoft'
java-version: '17'
cache: 'gradle'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
7 changes: 1 addition & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
cache: 'gradle'
- uses: ./.github/actions/gradle-setup
- name: Validate no assets
run: test ! -d ./src/generated
- name: Generate assets
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/export_guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ jobs:
- name: Install Software OpenGL Rendering
run: sudo apt-get install xvfb libgl1-mesa-dri zopfli
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
cache: 'gradle'
- uses: ./.github/actions/gradle-setup
- name: Generate Assets
run: ./gradlew runData
- name: Export Guide
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/localization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ jobs:
with:
distribution: 'microsoft'
java-version: '17'
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
- uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "18"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Download new translations from crowdin
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ test {
]
}

//tasks.named('test').configure {
// it.inputs.file(tasks.named('writeMinecraftClasspath').map { it.outputs.files.singleFile })
//}
tasks.named('test').configure {
it.inputs.file(tasks.named('writeMinecraftClasspath').map { it.outputs.files.singleFile })
}

dependencies {
buildtoolsImplementation 'de.siegmar:fastcsv:2.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ void testCodecEncodeMinimal() {
.build();

var recipeJson = Recipe.CODEC.encodeStart(JsonOps.INSTANCE, recipe).get().left().get();
assertEquals("""
{"mode":"cool","input":{"block":{"id":"minecraft:grass_block"}},"output":{"block":{"id":"minecraft:dirt"}},"type":"ae2:entropy"}
""".trim(), recipeJson.toString());
assertEquals(
"""
{"mode":"cool","input":{"block":{"id":"minecraft:grass_block"}},"output":{"block":{"id":"minecraft:dirt"}},"type":"ae2:entropy"}
"""
.trim(),
recipeJson.toString());
}

@Test
void testCodecDecodeMinimal() {
var jsonEl = new Gson().fromJson("""
{"mode":"cool","input":{"block":{"id":"minecraft:grass_block"}},"output":{"block":{"id":"minecraft:dirt"}},"type":"ae2:entropy"}
""", JsonElement.class);
var jsonEl = new Gson().fromJson(
"""
{"mode":"cool","input":{"block":{"id":"minecraft:grass_block"}},"output":{"block":{"id":"minecraft:dirt"}},"type":"ae2:entropy"}
""",
JsonElement.class);

var recipe = (EntropyRecipe) Recipe.CODEC.decode(JsonOps.INSTANCE, jsonEl).getOrThrow(false, s -> {
throw new RuntimeException(s);
Expand Down

0 comments on commit 615297b

Please sign in to comment.