diff --git a/.github/actions/sample/action.yml b/.github/actions/sample/action.yml index 02938d7..7674c96 100644 --- a/.github/actions/sample/action.yml +++ b/.github/actions/sample/action.yml @@ -42,11 +42,32 @@ runs: run: | git submodule update --init --recursive - - name: Setup LuaMake - if: steps.cache.outputs.cache-hit != 'true' - uses: ./.github/actions/setup-luamake - with: - soluna_path: ${{ inputs.soluna_path }} + - name: Resolve LuaMake + id: luamake + if: runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' + working-directory: ${{ inputs.soluna_path }} + shell: bash + run: | + case "$RUNNER_ARCH" in + X64) + luamake_platform=linux + ;; + ARM64) + luamake_platform=linux_arm64 + ;; + *) + echo "Unsupported LuaMake runner: ${RUNNER_OS}-${RUNNER_ARCH}" >&2 + exit 1 + ;; + esac + + luamake_path="bin/luamake-bin/bin/$luamake_platform/luamake" + if [ ! -f "$luamake_path" ]; then + echo "LuaMake binary not found: $luamake_path" >&2 + exit 1 + fi + chmod +x "$luamake_path" + echo "path=$luamake_path" >> "$GITHUB_OUTPUT" - name: Setup Emscripten if: runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' @@ -60,7 +81,7 @@ runs: shell: bash working-directory: ${{ inputs.soluna_path }} run: | - luamake -compiler emcc sample + "${{ steps.luamake.outputs.path }}" -compiler emcc sample - name: Set output id: set-output diff --git a/.github/actions/setup-luamake/action.yml b/.github/actions/setup-luamake/action.yml deleted file mode 100644 index b18f312..0000000 --- a/.github/actions/setup-luamake/action.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Setup LuaMake -description: Add the repository-pinned LuaMake binary to PATH - -inputs: - soluna_path: - description: "The path to the Soluna repository. Defaults to ." - required: false - default: "." - -runs: - using: "composite" - steps: - - name: Add LuaMake to PATH - shell: bash - working-directory: ${{ inputs.soluna_path }} - run: | - case "${RUNNER_OS}-${RUNNER_ARCH}" in - Linux-X64) - luamake_platform=linux - ;; - Linux-ARM64) - luamake_platform=linux_arm64 - ;; - macOS-X64) - luamake_platform=osx - ;; - macOS-ARM64) - luamake_platform=osx_arm64 - ;; - Windows-*) - luamake_platform=win32 - ;; - *) - echo "Unsupported LuaMake runner: ${RUNNER_OS}-${RUNNER_ARCH}" >&2 - exit 1 - ;; - esac - - if [ "$RUNNER_OS" = "Windows" ]; then - soluna_root=$(pwd -W 2>/dev/null || pwd -P) - soluna_root=${soluna_root//\\//} - luamake_exe=luamake.exe - else - soluna_root=$(pwd -P) - luamake_exe=luamake - fi - - luamake_dir="$soluna_root/bin/luamake-bin/bin/$luamake_platform" - if [ ! -f "$luamake_dir/$luamake_exe" ]; then - echo "LuaMake binary not found: $luamake_dir/$luamake_exe" >&2 - exit 1 - fi - if [ "$RUNNER_OS" != "Windows" ]; then - chmod +x "$luamake_dir/$luamake_exe" - fi - echo "$luamake_dir" >> "$GITHUB_PATH" diff --git a/.github/actions/soluna/action.yml b/.github/actions/soluna/action.yml index ad0b3cf..1024a32 100644 --- a/.github/actions/soluna/action.yml +++ b/.github/actions/soluna/action.yml @@ -49,11 +49,48 @@ runs: run: | git submodule update --init --recursive shell: bash - - name: Setup LuaMake + - name: Resolve LuaMake + id: luamake if: steps.cache.outputs.cache-hit != 'true' - uses: ./.github/actions/setup-luamake - with: - soluna_path: ${{ inputs.soluna_path }} + working-directory: ${{ inputs.soluna_path }} + shell: bash + run: | + case "${RUNNER_OS}-${RUNNER_ARCH}" in + Linux-X64) + luamake_platform=linux + luamake_exe=luamake + ;; + Linux-ARM64) + luamake_platform=linux_arm64 + luamake_exe=luamake + ;; + macOS-X64) + luamake_platform=osx + luamake_exe=luamake + ;; + macOS-ARM64) + luamake_platform=osx_arm64 + luamake_exe=luamake + ;; + Windows-*) + luamake_platform=win32 + luamake_exe=luamake.exe + ;; + *) + echo "Unsupported LuaMake runner: ${RUNNER_OS}-${RUNNER_ARCH}" >&2 + exit 1 + ;; + esac + + luamake_path="bin/luamake-bin/bin/$luamake_platform/$luamake_exe" + if [ ! -f "$luamake_path" ]; then + echo "LuaMake binary not found: $luamake_path" >&2 + exit 1 + fi + if [ "$RUNNER_OS" != "Windows" ]; then + chmod +x "$luamake_path" + fi + echo "path=$luamake_path" >> "$GITHUB_OUTPUT" - name: Install Dependencies (Linux) shell: bash if: runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' @@ -73,7 +110,7 @@ runs: } else { $env:LUAMAKE_BUILD_TYPE = 'release' } - luamake -mode $env:LUAMAKE_BUILD_TYPE soluna + & "${{ steps.luamake.outputs.path }}" -mode $env:LUAMAKE_BUILD_TYPE soluna - name: Build (Unix) if: runner.os != 'Windows' && steps.cache.outputs.cache-hit != 'true' shell: bash @@ -84,7 +121,7 @@ runs: else export LUAMAKE_BUILD_TYPE=release fi - luamake -mode $LUAMAKE_BUILD_TYPE soluna + "${{ steps.luamake.outputs.path }}" -mode $LUAMAKE_BUILD_TYPE soluna - uses: mymindstorm/setup-emsdk@v14 if: runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' with: @@ -100,7 +137,7 @@ runs: else export LUAMAKE_BUILD_TYPE=release fi - luamake -mode $LUAMAKE_BUILD_TYPE -compiler emcc + "${{ steps.luamake.outputs.path }}" -mode $LUAMAKE_BUILD_TYPE -compiler emcc SOLUNA_JS="soluna.js" SOLUNA_JS_PATH=$(find bin -name $SOLUNA_JS | head -n 1) sed -i 's/setBindGroup(groupIndex,group,(growMemViews(),HEAPU32),dynamicOffsetsPtr>>2,dynamicOffsetCount)/setBindGroup(groupIndex,group,(growMemViews(),HEAPU32).subarray(dynamicOffsetsPtr>>2,(dynamicOffsetsPtr>>2)+dynamicOffsetCount))/g' "$SOLUNA_JS_PATH"