From bcb9f8a6d7d68a6e52d69ff4be0e2c2df2fe3aaf Mon Sep 17 00:00:00 2001 From: leso-kn Date: Fri, 27 Oct 2023 19:16:15 +0200 Subject: [PATCH 1/6] Fix C module loading on windows --- main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 8f056ea0..dbb5abe4 100644 --- a/main.js +++ b/main.js @@ -173,13 +173,13 @@ async function install_plain_lua_windows(luaExtractPath, luaInstallPath, luaVers } }) - objs["lua"] = [ ...objs["lua"], ...objs["lib"] ] - objs["luac"] = [ ...objs["luac"], ...objs["lib"] ] - let luaXYZ = luaVersion.split(".") let libFile = "lua" + luaXYZ[0] + luaXYZ[1] + ".lib" let dllFile = "lua" + luaXYZ[0] + luaXYZ[1] + ".dll" + objs["lua"] = [ ...objs["lua"], libFile ] + objs["luac"] = [ ...objs["luac"], ...objs["lib"] ] + await msvc_link(luaExtractPath, "link /nologo /DLL", dllFile, objs["lib"]); await msvc_link(luaExtractPath, "link /nologo", "luac.exe", objs["luac"]); await msvc_link(luaExtractPath, "link /nologo", "lua.exe", objs["lua"]); @@ -187,7 +187,7 @@ async function install_plain_lua_windows(luaExtractPath, luaInstallPath, luaVers const luaHpp = (await exists(pathJoin(src, "lua.hpp"))) ? "lua.hpp" : "../etc/lua.hpp" const headers = [ "lua.h", "luaconf.h", "lualib.h", "lauxlib.h", luaHpp ] - await install_files(pathJoin(luaInstallPath, "bin"), luaExtractPath, [ "lua.exe", "luac.exe" ]) + await install_files(pathJoin(luaInstallPath, "bin"), luaExtractPath, [ "lua.exe", "luac.exe", dllFile ]) await install_files(pathJoin(luaInstallPath, "lib"), luaExtractPath, [ dllFile, libFile ]) await install_files(pathJoin(luaInstallPath, "include"), src, headers) } From eb1773958da367c9e80cff086ba47a6789b7c9c3 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 26 Aug 2024 14:37:27 -0300 Subject: [PATCH 2/6] Download LuaJIT rolling release from git As requested by luajit.org: https://luajit.org/download.html --- README.md | 9 +++--- main.js | 91 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index f873a372..e41aada1 100644 --- a/README.md +++ b/README.md @@ -65,14 +65,15 @@ Examples of versions: * `"5.2.4"` * `"5.3.5"` * `"5.4.1"` -* `"luajit-2.0.5"` -* `"luajit-2.1.0-beta3"` +* `"luajit-2.0"` +* `"luajit-2.1"` +* `"luajit-master"` * `"luajit-openresty"` The version specifies where the source is downloaded from: -* `luajit-openresty` — will allways pull master from https://github.com/openresty/luajit2 -* Anything starting with `luajit-` — from http://luajit.org/download.html +* `luajit-openresty` — will always pull master from https://github.com/openresty/luajit2 +* Anything else starting with `luajit-` — pulls a master or version branch from https://github.com/luajit/luajit * Anything else — from https://www.lua.org/ftp/ **Version aliases** diff --git a/main.js b/main.js index dbb5abe4..e7912290 100644 --- a/main.js +++ b/main.js @@ -19,7 +19,35 @@ const VERSION_ALIASES = { "5.2": "5.2.4", "5.3": "5.3.6", "5.4": "5.4.4", - "luajit": "luajit-2.1.0-beta3", + "luajit": "luajit-2.1", +} + +const LUAJIT_REPOS = { + "luajit-2.0": { + "url": "https://github.com/luajit/luajit.git", + "branch": "v2.0", + "binary": "luajit" + }, + "luajit-2.1": { + "url": "https://github.com/luajit/luajit.git", + "branch": "v2.1", + "binary": "luajit" + }, + "luajit-2.1.0-beta3": { + "url": "https://github.com/luajit/luajit.git", + "branch": "v2.1.0-beta3", + "binary": "luajit-2.1.0-beta3" + }, + "luajit-master": { + "url": "https://github.com/luajit/luajit.git", + "branch": "master", + "binary": "luajit" + }, + "luajit-openresty": { + "url": "https://github.com/openresty/luajit2.git", + "branch": "v2.1-agentzh", + "binary": "luajit" + }, } const isMacOS = () => (process.platform || "").startsWith("darwin") @@ -49,13 +77,27 @@ async function finish_luajit_install(src, dst, luajit) { } } -async function install_luajit_openresty(luaInstallPath) { +async function install_luajit(luaInstallPath, luaVersion) { + const luajitVersion = luaVersion.substr("luajit-".length) + + let repo = LUAJIT_REPOS[luaVersion]; + if (!repo) { + repo = { + "url": LUAJIT_REPOS["luajit-master"].url, + "branch": "v" + luajitVersion, + "binary": "luajit" + } + } + const buildPath = path.join(process.env["RUNNER_TEMP"], BUILD_PREFIX) const luaCompileFlags = core.getInput('luaCompileFlags') + // "luajit" or "luajit2" + const baseDir = repo.url.match(/.*\/(.*)\.git/)[1] + await io.mkdirP(buildPath) - await exec.exec("git clone https://github.com/openresty/luajit2.git", undefined, { + await exec.exec(`git clone --branch ${repo.branch} --single-branch ${repo.url}`, undefined, { cwd: buildPath }) @@ -70,45 +112,15 @@ async function install_luajit_openresty(luaInstallPath) { } await exec.exec(`make ${finalCompileFlags}`, undefined, { - cwd: pathJoin(buildPath, "luajit2"), + cwd: pathJoin(buildPath, baseDir), ...(isWindows() ? { env: { SHELL: 'cmd' }} : {}) }) await exec.exec(`make -j install PREFIX="${luaInstallPath}"`, undefined, { - cwd: pathJoin(buildPath, "luajit2") + cwd: pathJoin(buildPath, baseDir) }) - await finish_luajit_install(pathJoin(buildPath, "luajit2", "src"), luaInstallPath, "luajit") -} - -async function install_luajit(luaInstallPath, luajitVersion) { - const luaExtractPath = pathJoin(process.env["RUNNER_TEMP"], BUILD_PREFIX, `LuaJIT-${luajitVersion}`) - - const luaCompileFlags = core.getInput('luaCompileFlags') - - const luaSourceTar = await tc.downloadTool(`https://luajit.org/download/LuaJIT-${luajitVersion}.tar.gz`) - await io.mkdirP(luaExtractPath) - await tc.extractTar(luaSourceTar, path.join(process.env["RUNNER_TEMP"], BUILD_PREFIX)) - - let finalCompileFlags = "-j" - - if (isMacOS()) { - finalCompileFlags += " MACOSX_DEPLOYMENT_TARGET=10.15" - } - - if (luaCompileFlags) { - finalCompileFlags += ` ${luaCompileFlags}` - } - - await exec.exec(`make ${finalCompileFlags}`, undefined, { - cwd: luaExtractPath - }) - - await exec.exec(`make -j install PREFIX="${luaInstallPath}"`, undefined, { - cwd: luaExtractPath - }) - - await finish_luajit_install(pathJoin(luaExtractPath, "src"), luaInstallPath, `luajit-${luajitVersion}`) + await finish_luajit_install(pathJoin(buildPath, baseDir, "src"), luaInstallPath, repo.binary) } async function msvc_link(luaExtractPath, linkCmd, outFile, objs) { @@ -231,13 +243,8 @@ async function install_plain_lua(luaInstallPath, luaVersion) { } async function install(luaInstallPath, luaVersion) { - if (luaVersion == "luajit-openresty") { - return await install_luajit_openresty(luaInstallPath) - } - if (luaVersion.startsWith("luajit-")) { - const luajitVersion = luaVersion.substr("luajit-".length) - return await install_luajit(luaInstallPath, luajitVersion) + return await install_luajit(luaInstallPath, luaVersion) } return await install_plain_lua(luaInstallPath, luaVersion) From d518792328e41404ff260c1655257ff3cefe0d1e Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 26 Aug 2024 14:49:46 -0300 Subject: [PATCH 3/6] CI: add more supported configurations --- .github/workflows/test.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a264088e..99f18754 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,8 +7,17 @@ jobs: strategy: fail-fast: false matrix: - luaVersion: ["5.1.5", "5.2.4", "5.3.6", "5.4.4", "luajit-2.0.5", "luajit-2.1.0-beta3", "luajit-openresty", "5.1", "5.4"] + luaVersion: ["5.1.5", "5.2.4", "5.3.6", "5.4.4", "luajit", "luajit-2.0", "luajit-2.1", "luajit-2.0.5", "luajit-2.1.0-beta3", "luajit-openresty", "5.1", "5.4"] machineTag: ["ubuntu-latest", "macos-latest", "windows-latest"] + exclude: + - luaVersion: "luajit-2.0" + machineTag: "macos-latest" + - luaVersion: "luajit-2.0.5" + machineTag: "macos-latest" + - luaVersion: "luajit-2.0.5" + machineTag: "windows-latest" + - luaVersion: "luajit-2.1.0-beta3" + machineTag: "windows-latest" runs-on: ${{ matrix.machineTag }} @@ -32,8 +41,17 @@ jobs: strategy: fail-fast: false matrix: - luaVersion: ["5.1.5", "5.2.4", "5.3.6", "5.4.4", "luajit-2.0.5", "luajit-2.1.0-beta3", "luajit-openresty", "5.1", "5.4"] + luaVersion: ["5.1.5", "5.2.4", "5.3.6", "5.4.4", "luajit", "luajit-2.0", "luajit-2.1", "luajit-2.0.5", "luajit-2.1.0-beta3", "luajit-openresty", "5.1", "5.4"] machineTag: ["ubuntu-latest", "macos-latest", "windows-latest"] + exclude: + - luaVersion: "luajit-2.0" + machineTag: "macos-latest" + - luaVersion: "luajit-2.0.5" + machineTag: "macos-latest" + - luaVersion: "luajit-2.0.5" + machineTag: "windows-latest" + - luaVersion: "luajit-2.1.0-beta3" + machineTag: "windows-latest" runs-on: ${{ matrix.machineTag }} From ade3f210ba74542da46eadad99219e5c6d498b4a Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 26 Aug 2024 16:17:43 -0300 Subject: [PATCH 4/6] latest PUC Lua is 5.4.7 --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index e7912290..7caf3478 100644 --- a/main.js +++ b/main.js @@ -18,7 +18,7 @@ const VERSION_ALIASES = { "5.1": "5.1.5", "5.2": "5.2.4", "5.3": "5.3.6", - "5.4": "5.4.4", + "5.4": "5.4.7", "luajit": "luajit-2.1", } From 9a6d2fea5b9a053b7a12876ffaff2b5aa7b9b153 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 27 Aug 2024 01:40:38 -0300 Subject: [PATCH 5/6] luajit: Copy Windows library to lib as well --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index 7caf3478..1b278242 100644 --- a/main.js +++ b/main.js @@ -66,6 +66,7 @@ const processCwd = () => { async function finish_luajit_install(src, dst, luajit) { if (isWindows()) { await fsp.copyFile(pathJoin(src, "lua51.dll"), pathJoin(dst, "bin", "lua51.dll")) + await fsp.copyFile(pathJoin(src, "lua51.dll"), pathJoin(dst, "lib", "lua51.dll")) await exec.exec(`ln -s ${luajit} lua.exe`, undefined, { cwd: pathJoin(dst, "bin") From c1e8c4a5fa64ac5f6467ea35d8b59fb5a167232e Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 28 Oct 2024 18:25:09 -0300 Subject: [PATCH 6/6] [fork] update URLs in README --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e41aada1..e153fc3a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Github Action for Lua and LuaJIT -### `leafo/gh-actions-lua` +### `luarocks/gh-actions-lua` -[![Actions Status](https://github.com/leafo/gh-actions-lua/workflows/test/badge.svg)](https://github.com/leafo/gh-actions-lua/actions) +[![Actions Status](https://github.com/luarocks/gh-actions-lua/workflows/test/badge.svg)](https://github.com/luarocks/gh-actions-lua/actions) **Note**: You must use version 8 or greater as GitHub has deprecated older versions of the actions core libraries. @@ -13,7 +13,7 @@ directly in workflows. Other Lua GitHub actions: -* [`leafo/gh-actions-luarocks`](https://github.com/leafo/gh-actions-luarocks) +* [`luarocks/gh-actions-luarocks`](https://github.com/luarocks/gh-actions-luarocks) * inputs: `luarocksVersion` @@ -22,13 +22,13 @@ Other Lua GitHub actions: Install Lua: (Will typically default to the latest release, 5.4.4 as of this readme) ```yaml -- uses: leafo/gh-actions-lua@v10 +- uses: luarocks/gh-actions-lua@v10 ``` Install specific version of Lua: ```yaml -- uses: leafo/gh-actions-lua@v10 +- uses: luarocks/gh-actions-lua@v10 with: luaVersion: "5.1.5" ``` @@ -36,7 +36,7 @@ Install specific version of Lua: Install specific version of LuaJIT: ```yaml -- uses: leafo/gh-actions-lua@v10 +- uses: luarocks/gh-actions-lua@v10 with: luaVersion: "luajit-2.1.0-beta3" ``` @@ -47,7 +47,7 @@ include this line on non-Windows platforms, as the action will do nothing in tho ```yaml - uses: ilammy/msvc-dev-cmd@v1 -- uses: leafo/gh-actions-lua@v10 +- uses: luarocks/gh-actions-lua@v10 ``` ## Inputs @@ -90,7 +90,7 @@ Additional flags to pass to `make` when building Lua. Example value: ```yaml -- uses: leafo/gh-actions-lua@master +- uses: luarocks/gh-actions-lua@master with: luaVersion: 5.3 luaCompileFlags: LUA_CFLAGS="-DLUA_INT_TYPE=LUA_INT_INT" @@ -117,11 +117,11 @@ jobs: steps: - uses: actions/checkout@master - - uses: leafo/gh-actions-lua@v10 + - uses: luarocks/gh-actions-lua@v10 with: luaVersion: "5.1.5" - - uses: leafo/gh-actions-luarocks@v4 + - uses: luarocks/gh-actions-luarocks@v4 - name: build run: | @@ -154,7 +154,7 @@ jobs: steps: - uses: actions/checkout@master - - uses: leafo/gh-actions-lua@v10 + - uses: luarocks/gh-actions-lua@v10 with: luaVersion: ${{ matrix.luaVersion }}