From 6ea72554516f7f9f4aac75579bc818f7225b4729 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:02:11 +0100 Subject: [PATCH 1/5] feat(action): Windows support --- action.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c917270..f1166c1 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,8 @@ inputs: runs: using: composite steps: - - name: Bootstrap HeadlessMC + - name: Bootstrap HeadlessMc (Linux) + if: runner.os != 'Windows' run: | mkdir -p HeadlessMC run/mods cat <> HeadlessMC/config.properties @@ -61,6 +62,22 @@ runs: EOF shell: bash + - name: Bootstrap HeadlessMc (Windows) + if: runner.os == 'Windows' + run: | + New-Item -ItemType Directory -Force -Path HeadlessMC, run/mods | Out-Null + $currentDir = (Get-Location).Path -replace '\\', '\\\\' + $javaPath = "$env:JAVA_HOME\bin\java.exe" -replace '\\', '\\\\' + $config = @( + "hmc.java.versions=$javaPath", + "hmc.gamedir=$currentDir\\run", + "hmc.offline=true", + "hmc.rethrow.launch.exceptions=true", + "hmc.exit.on.failed.command=true" + ) + $config | Set-Content -Path HeadlessMC\config.properties -Encoding utf8 + shell: pwsh + - if: inputs.dummy-assets == 'true' name: Configure Dummy Assets run: echo hmc.assets.dummy=true >> HeadlessMC/config.properties From 71f25b2baa56404ac4818a40b293241b6818ff90 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Fri, 14 Nov 2025 02:02:15 +0100 Subject: [PATCH 2/5] chore(ci): Run latest version also on windows and macOS --- .github/workflows/lifecycle.yml | 39 ++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lifecycle.yml b/.github/workflows/lifecycle.yml index 6cb03cc..730c13b 100644 --- a/.github/workflows/lifecycle.yml +++ b/.github/workflows/lifecycle.yml @@ -88,6 +88,7 @@ jobs: import os import json import re + import copy build_matrix = {"include": []} run_matrix = {"version": []} @@ -140,6 +141,25 @@ jobs: mc_versions = mc_versions if mc_versions else [item.get("mc") for item in build_matrix["include"] if "mc" in item] run_matrix['version'].extend([item for item in run_data if item["mc"] in mc_versions]) + for entry in run_matrix['version']: + entry['runner'] = 'blacksmith-2vcpu-ubuntu-2204' + entry['cache'] = 'blacksmith' + entry['xvfb'] = True + + additional_runs = [] + for item in run_matrix['version']: + runners = [ ('blacksmith-2vcpu-ubuntu-2204', 'blacksmith') ] # also add non-xvfb runs for ubuntu + if len(additional_runs) < 9: # add other runners only for the latest version * 3 modloaders * 3 runners + runners += [ ('windows-latest', 'github'), ('macos-latest', 'github') ] + for runner, cache in runners: + entry = copy.deepcopy(item) + entry['runner'] = runner + entry['cache'] = cache + entry['xvfb'] = False + additional_runs.append(entry) + + run_matrix['version'] += additional_runs + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: print(json.dumps(build_matrix, indent=2)) fh.write(f'build-matrix={json.dumps(build_matrix)}\n') @@ -169,12 +189,11 @@ jobs: needs: - matrices - build - runs-on: blacksmith-2vcpu-ubuntu-2204 strategy: fail-fast: false matrix: ${{ insert }}: ${{ fromJSON(needs.matrices.outputs.run-matrix) }} - xvfb: [true, false] + runs-on: ${{ matrix.version.runner }} steps: - name: Checkout # TODO: simplify away this step, currently needed for `uses: ./` uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 @@ -191,7 +210,15 @@ jobs: mkdir -p run/mods cp mc-runtime-test-*-${{ matrix.version.type }}-release.jar run/mods - - name: Setup Java temurin-${{ matrix.version.java }} + - name: Setup Github Java temurin-${{ matrix.version.java }} + if: matrix.version.cache == 'github' + uses: actions/setup-java@v5 + with: + java-version: ${{ matrix.version.java }} + distribution: temurin + + - name: Setup Blacksmith Java temurin-${{ matrix.version.java }} + if: matrix.version.cache == 'blacksmith' uses: useblacksmith/setup-java@4ef812391eff6e9737ba13bf0356d0f702877a64 # v5 with: java-version: ${{ matrix.version.java }} @@ -201,14 +228,14 @@ jobs: timeout-minutes: 3 uses: ./ with: - cache-mc: "blacksmith" + cache-mc: ${{ matrix.version.cache }} mc: ${{ matrix.version.mc }} mc-runtime-test: none modloader: ${{ matrix.version.modloader }} regex: ${{ matrix.version.regex }} java: ${{ matrix.version.java }} - xvfb: ${{ matrix.xvfb }} - headlessmc-command: ${{ !matrix.xvfb && '-lwjgl' || '' }} --retries 3 --jvm -Djava.awt.headless=true + xvfb: ${{ matrix.version.xvfb }} + headlessmc-command: ${{ !matrix.version.xvfb && '-lwjgl' || '' }} --retries 3 --jvm -Djava.awt.headless=true release: if: needs.release-please.outputs.release_created == 'true' From c45abba3987ffeb3743f59a98595bef19c3f224c Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Fri, 14 Nov 2025 14:49:21 +0100 Subject: [PATCH 3/5] feat(action): Update to HeadlessMc 2.7.1 --- .github/workflows/test-local-action.yml | 2 +- README.md | 2 +- action.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-local-action.yml b/.github/workflows/test-local-action.yml index bd56ebd..9094fb6 100644 --- a/.github/workflows/test-local-action.yml +++ b/.github/workflows/test-local-action.yml @@ -33,7 +33,7 @@ name: Test local action default: "1.3.5+85d85a934f" hmc-version: description: HeadlessMC version - default: "2.7.0" + default: "2.7.1" env: java_version: ${{ github.event.inputs.java }} diff --git a/README.md b/README.md index ce608c2..e2abcee 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ The following table summarizes the available inputs for customization: | `fabric-api` | Fabric API version to download or none | | `0.97.0`, `none` | | `fabric-gametest-api` | Fabric GameTest API version or none | | `1.3.5+85d85a934f`, `none` | | `download-hmc` | Download HeadlessMC | | `true`, `false` | -| `hmc-version` | HeadlessMC version | | `2.7.0`, `1.5.0` | +| `hmc-version` | HeadlessMC version | | `2.7.1`, `1.5.0` | | `cache-mc` | Cache `.minecraft`
(`true` defaults to `blacksmith`) | | `github`, `blacksmith`, `true`, `false` | --- diff --git a/action.yml b/action.yml index f1166c1..27af306 100644 --- a/action.yml +++ b/action.yml @@ -41,7 +41,7 @@ inputs: default: "true" hmc-version: description: HeadlessMC version - default: "2.7.0" + default: "2.7.1" cache-mc: description: Cache .minecraft (blacksmith, github, true (defaults to blacksmith), false) default: "github" From bb2025e19fe00ffaa31b959b9baa0fdd0d9c3966 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 18 Nov 2025 19:27:46 +0100 Subject: [PATCH 4/5] chore(ci): fix potential issue if api is changed --- .github/workflows/lifecycle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lifecycle.yml b/.github/workflows/lifecycle.yml index 730c13b..878754a 100644 --- a/.github/workflows/lifecycle.yml +++ b/.github/workflows/lifecycle.yml @@ -137,7 +137,7 @@ jobs: build_matrix['include'], run_matrix['version'] = build_data, run_data if dirs_to_filter: - build_matrix['include'].extend([item for item in build_data if item["dir"] in dirs_to_filter and (item["mc"] in mc_versions or not mc_versions)]) + build_matrix['include'].extend([item for item in build_data if item["dir"] in dirs_to_filter and ("mc" not in item or (item["mc"] in mc_versions or not mc_versions))]) mc_versions = mc_versions if mc_versions else [item.get("mc") for item in build_matrix["include"] if "mc" in item] run_matrix['version'].extend([item for item in run_data if item["mc"] in mc_versions]) From bcb36d2a327ac6d060a885511515a8916ba3ffb1 Mon Sep 17 00:00:00 2001 From: okafke <65917827+okafke@users.noreply.github.com> Date: Tue, 18 Nov 2025 20:17:27 +0100 Subject: [PATCH 5/5] chore(ci): do not fail on empty run matrix if api is being built --- .github/workflows/lifecycle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lifecycle.yml b/.github/workflows/lifecycle.yml index 878754a..7f62adb 100644 --- a/.github/workflows/lifecycle.yml +++ b/.github/workflows/lifecycle.yml @@ -184,7 +184,7 @@ jobs: java: ${{ matrix.java }} run: - if: github.event_name != 'push' + if: github.event_name != 'push' && fromJSON(needs.matrices.outputs.run-matrix).version[0] != null name: Run tests needs: - matrices