From 1b704f076454cf8253d38e2707d731ece4e4bb40 Mon Sep 17 00:00:00 2001 From: Hanchin Hsieh Date: Tue, 16 Dec 2025 12:46:25 +0800 Subject: [PATCH] ci: ensure shdc version --- .github/actions/soluna/action.yml | 27 --------------------------- clibs/soluna/compile_shader.lua | 10 +++++++++- clibs/soluna/make.lua | 1 - clibs/soluna/shader2c.lua | 17 ----------------- 4 files changed, 9 insertions(+), 46 deletions(-) diff --git a/.github/actions/soluna/action.yml b/.github/actions/soluna/action.yml index 1d57ee6..3ddacc1 100644 --- a/.github/actions/soluna/action.yml +++ b/.github/actions/soluna/action.yml @@ -42,33 +42,6 @@ runs: run: | git submodule update --init --recursive shell: bash - - uses: actions/checkout@v5 - if: steps.cache.outputs.cache-hit != 'true' - with: - repository: floooh/sokol-tools-bin - ref: "a06f19929ff8f9824ec6dd87c21329b1f205809e" - path: sokol-tools-bin - fetch-depth: 1 - - name: Setup sokol-shdc - if: steps.cache.outputs.cache-hit != 'true' - shell: bash - run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - TARGET_DIR="C:/Windows/System32" - SHDC_BINARY="sokol-shdc.exe" - FIND_PATH="bin/win32" - elif [[ "$RUNNER_OS" == "macOS" ]]; then - TARGET_DIR="/usr/local/bin" - SHDC_BINARY="sokol-shdc" - FIND_PATH="bin/osx_arm64" - else # Linux - TARGET_DIR="/usr/local/bin" - SHDC_BINARY="sokol-shdc" - FIND_PATH="bin/linux" - fi - echo "Setting up sokol-tools from sokol-tools-bin/$FIND_PATH" - find sokol-tools-bin/$FIND_PATH -name $SHDC_BINARY -exec cp {} $TARGET_DIR \; - $SHDC_BINARY -h - uses: yuchanns/actions-luamake@v1 if: steps.cache.outputs.cache-hit != 'true' with: diff --git a/clibs/soluna/compile_shader.lua b/clibs/soluna/compile_shader.lua index 42caa78..9669afb 100644 --- a/clibs/soluna/compile_shader.lua +++ b/clibs/soluna/compile_shader.lua @@ -1,7 +1,15 @@ local lm = require "luamake" local fs = require "bee.filesystem" -local shdc = lm.shdc or "" +local paths = { + windows = "$PATH/win32/$NAME.exe", + macos = "$PATH/osx_arm64/$NAME", + linux = "$PATH/linux/$NAME", +} +local shdc = assert(paths[lm.os]):gsub("%$(%u+)", { + PATH = tostring(lm.basedir / "bin/sokol-tools-bin/bin"), + NAME = "sokol-shdc", +}) local function compile_shader(src, name, lang) local dep = name .. "_shader" diff --git a/clibs/soluna/make.lua b/clibs/soluna/make.lua index 1c6dcd5..eb4a0ce 100644 --- a/clibs/soluna/make.lua +++ b/clibs/soluna/make.lua @@ -19,7 +19,6 @@ if ok then local output = process.stdout:read "a" commit = output:match "^%s*(.-)%s*$" process:wait() - print("Hash version: " .. commit) end end diff --git a/clibs/soluna/shader2c.lua b/clibs/soluna/shader2c.lua index ea2fa5a..f51d3c0 100644 --- a/clibs/soluna/shader2c.lua +++ b/clibs/soluna/shader2c.lua @@ -1,23 +1,6 @@ local subprocess = require "bee.subprocess" -local platform = require "bee.platform" local shdcexe, src, target, lang = ... -local function find_executable(name) - local handle = io.popen("where " .. name .. " 2>nul") - if handle then - local path = handle:read("*line") - local success = handle:close() - if success and path and path ~= "" then - return path:gsub("%s+$", "") - end - end - return name -end - -if shdcexe == "" then - shdcexe = platform.os == "windows" and find_executable("sokol-shdc.exe") or "sokol-shdc" -end - local process = assert(subprocess.spawn { shdcexe, "--input",