fix: goldmapper on ci

This commit is contained in:
neoapps-dev
2026-09-01 14:01:39 +03:00
parent 5d21aaee3e
commit 9a9c11c716
7 changed files with 159 additions and 50 deletions
+36 -4
View File
@@ -3,7 +3,37 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build-goldmapper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: install mingw toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
- name: setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "pnpm"
- name: build GoldMapper
run: pnpm goldmapper
- uses: actions/upload-artifact@v4
with:
name: goldmapper
path: |
src-tauri/resources/GoldMapperLib.dll
src-tauri/resources/GoldMapperLauncher.exe
src-tauri/resources/SDL2.dll
build-tauri: build-tauri:
needs: [build-goldmapper]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -27,10 +57,6 @@ jobs:
with: with:
submodules: true submodules: true
- name: build GoldMapper
shell: bash
run: pnpm goldmapper
- name: install dependencies (ubuntu only) - name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' if: matrix.platform == 'ubuntu-22.04'
run: | run: |
@@ -47,6 +73,12 @@ jobs:
node-version: lts/* node-version: lts/*
cache: "pnpm" cache: "pnpm"
- name: download GoldMapper
uses: actions/download-artifact@v4
with:
name: goldmapper
path: src-tauri/resources
- name: install Rust stable - name: install Rust stable
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
+36 -5
View File
@@ -17,8 +17,37 @@ jobs:
cat RELEASE_NOTES.md >> "$GITHUB_OUTPUT" cat RELEASE_NOTES.md >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT"
build-goldmapper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: install mingw toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
- name: setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "pnpm"
- name: build GoldMapper
run: pnpm goldmapper
- uses: actions/upload-artifact@v4
with:
name: goldmapper
path: |
src-tauri/resources/GoldMapperLib.dll
src-tauri/resources/GoldMapperLauncher.exe
src-tauri/resources/SDL2.dll
publish-tauri: publish-tauri:
needs: get-version needs: [get-version, build-goldmapper]
permissions: permissions:
contents: write contents: write
strategy: strategy:
@@ -40,10 +69,6 @@ jobs:
with: with:
submodules: true submodules: true
- name: build GoldMapper
shell: bash
run: pnpm goldmapper
- name: install dependencies (ubuntu only) - name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' if: matrix.platform == 'ubuntu-22.04'
run: | run: |
@@ -60,6 +85,12 @@ jobs:
node-version: lts/* node-version: lts/*
cache: "pnpm" cache: "pnpm"
- name: download GoldMapper
uses: actions/download-artifact@v4
with:
name: goldmapper
path: src-tauri/resources
- name: install Rust stable - name: install Rust stable
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
+1 -1
View File
@@ -12,7 +12,7 @@
"post-build:macos": "bash src-tauri/scripts/post-build-macos.sh", "post-build:macos": "bash src-tauri/scripts/post-build-macos.sh",
"android:assets": "node scripts/download-android-assets.mjs", "android:assets": "node scripts/download-android-assets.mjs",
"flatpak": "flatpak-builder --user --install-deps-from=flathub --repo=emerald-repo --force-clean build-flatpak flatpak/io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.yml && flatpak build-bundle emerald-repo emerald.flatpak io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher", "flatpak": "flatpak-builder --user --install-deps-from=flathub --repo=emerald-repo --force-clean build-flatpak flatpak/io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.yml && flatpak build-bundle emerald-repo emerald.flatpak io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher",
"goldmapper": "bash scripts/build-goldmapper.sh" "goldmapper": "node scripts/build-goldmapper.mjs"
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "^2", "@tauri-apps/api": "^2",
+81
View File
@@ -0,0 +1,81 @@
import { spawnSync } from "node:child_process";
import { existsSync, copyFileSync, mkdirSync, readdirSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
const ROOT_DIR = path.resolve(SCRIPT_DIR, "..");
const GOLDMAPPER_DIR = path.join(ROOT_DIR, "GoldMapper");
const BUILD_DIR = path.join(GOLDMAPPER_DIR, "build");
const RESOURCES_DIR = path.join(ROOT_DIR, "src-tauri", "resources");
const TOOLCHAIN_MINGW = path.join(SCRIPT_DIR, "toolchain-mingw.cmake");
const IS_WINDOWS = process.platform === "win32";
function run(cmd, args, cwd) {
console.log(`> ${cmd} ${args.join(" ")}`);
const res = spawnSync(cmd, args, {
cwd,
stdio: "inherit",
shell: IS_WINDOWS,
});
if (res.status !== 0) {
process.exit(res.status ?? 1);
}
}
if (
!existsSync(
path.join(GOLDMAPPER_DIR, "third_party", "minhook", "include", "MinHook.h"),
)
) {
console.log("Initializing minhook submodule...");
run(
"git",
["-C", GOLDMAPPER_DIR, "submodule", "update", "--init", "--recursive"],
ROOT_DIR,
);
}
console.log("Configuring GoldMapper...");
const configureArgs = ["-B", BUILD_DIR, "-DCMAKE_BUILD_TYPE=Release"];
if (!IS_WINDOWS) {
configureArgs.push("-DCMAKE_TOOLCHAIN_FILE=" + TOOLCHAIN_MINGW);
}
configureArgs.push(GOLDMAPPER_DIR);
run("cmake", configureArgs, ROOT_DIR);
console.log("Building GoldMapper...");
run("cmake", ["--build", BUILD_DIR, "--config", "Release"], ROOT_DIR);
console.log("Copying binaries to resources...");
mkdirSync(RESOURCES_DIR, { recursive: true });
const outputs = [
{
source: "GoldMapperLib.dll",
names: ["GoldMapperLib.dll", "libGoldMapperLib.dll"], //neo: dont ask me vro idk why it does that
},
{ source: "GoldMapperLauncher.exe", names: ["GoldMapperLauncher.exe"] },
{
source: "SDL2.dll",
names: ["SDL2.dll"],
dir: path.join(GOLDMAPPER_DIR, "third_party", "SDL2-2.32.6", "lib", "x64"),
},
];
for (const entry of outputs) {
const dir = entry.dir ?? BUILD_DIR;
const file = path.join(dir, entry.source);
if (existsSync(file)) {
copyFileSync(file, path.join(RESOURCES_DIR, entry.source));
continue;
}
const candidate = readdirSync(dir).find((f) =>
entry.names.some((n) => f.toLowerCase() === n.toLowerCase()),
);
if (!candidate) {
console.error(`Missing build output: ${entry.source}`);
process.exit(1);
}
copyFileSync(
path.join(dir, candidate),
path.join(RESOURCES_DIR, entry.source),
);
}
console.log("GoldMapper build complete.");
-40
View File
@@ -1,40 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
GOLDMAPPER_DIR="$ROOT_DIR/GoldMapper"
BUILD_DIR="$GOLDMAPPER_DIR/build"
RESOURCES_DIR="$ROOT_DIR/src-tauri/resources"
if ! command -v xwin &> /dev/null; then
echo "Installing xwin..."
cargo install xwin
fi
if [ ! -d "$HOME/.cache/xwin/splat" ]; then
echo "Downloading Windows SDK and CRT..."
xwin --accept-license 16299.309000601.3633040603 splat --output "$HOME/.cache/xwin/splat"
fi
if [ ! -f "$GOLDMAPPER_DIR/third_party/minhook/include/MinHook.h" ]; then
echo "Initializing minhook submodule..."
git -C "$GOLDMAPPER_DIR" submodule update --init --recursive
fi
echo "Configuring GoldMapper..."
cmake -B "$BUILD_DIR" \
-DCMAKE_TOOLCHAIN_FILE="$GOLDMAPPER_DIR/toolchain-xwin.cmake" \
-DCMAKE_BUILD_TYPE=Release \
"$GOLDMAPPER_DIR"
echo "Building GoldMapper..."
cmake --build "$BUILD_DIR" --config Release
echo "Copying binaries to resources..."
mkdir -p "$RESOURCES_DIR"
cp "$BUILD_DIR/GoldMapperLib.dll" "$RESOURCES_DIR/"
cp "$BUILD_DIR/GoldMapperLauncher.exe" "$RESOURCES_DIR/"
cp "$BUILD_DIR/../third_party/SDL2-2.32.6/lib/x64/SDL2.dll" "$RESOURCES_DIR/"
echo "GoldMapper build complete."
+5
View File
@@ -0,0 +1,5 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)