diff --git a/.github/workflows/lifecycle.yml b/.github/workflows/lifecycle.yml index 6cb03cc..7f62adb 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": []} @@ -136,10 +137,29 @@ 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]) + 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') @@ -164,17 +184,16 @@ 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 - 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' 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 c917270..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" @@ -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