Skip to content

Commit

Permalink
install luajit from luajit.org
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Sep 6, 2019
1 parent 32765ce commit 596c2b8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
luaVersion: ["5.1.5", "5.2.4", "5.3.5", "luajit-openresty"]
luaVersion: ["5.1.5", "5.2.4", "5.3.5", "luajit-2.0.5", "luajit-2.1.0-beta3", "luajit-openresty"]

runs-on: ubuntu-latest

Expand Down
29 changes: 29 additions & 0 deletions install-lua/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,42 @@ async function install_luajit_openresty() {
})
}

async function install_luajit(luajitVersion) {
const luaExtractPath = path.join(process.cwd(), INSTALL_PREFIX, `LuaJIT-${luajitVersion}`)
const luaInstallPath = path.join(process.cwd(), LUA_PREFIX)

const luaSourceTar = await tc.downloadTool(`http://luajit.org/download/LuaJIT-${luajitVersion}.tar.gz`)
await io.mkdirP(luaExtractPath)
await tc.extractTar(luaSourceTar, INSTALL_PREFIX)

await exec.exec("make -j", undefined, {
cwd: luaExtractPath
})

await exec.exec(`make -j install PREFIX="${luaInstallPath}"`, undefined, {
cwd: luaExtractPath
})

core.addPath(path.join(luaInstallPath, "bin"));

await exec.exec("ln -s luajit lua", undefined, {
cwd: path.join(luaInstallPath, "bin")
})

}

async function main() {
const luaVersion = core.getInput('luaVersion', { required: true })

if (luaVersion == "luajit-openresty") {
return await install_luajit_openresty()
}

if (luaVersion.startsWith("luajit-")) {
const luajitVersion = luaVersion.substr("luajit-".length)
return await install_luajit(luajitVersion)
}

const luaExtractPath = path.join(process.cwd(), INSTALL_PREFIX, `lua-${luaVersion}`)
const luaInstallPath = path.join(process.cwd(), LUA_PREFIX)

Expand Down

0 comments on commit 596c2b8

Please sign in to comment.