Skip to content

Commit

Permalink
Added support for passing a platform argument to cmake and rebuilt no…
Browse files Browse the repository at this point in the history
…de modules.

- Added the optional environment variable "platform" to action.yaml
- If a platform is passed in, it gets inserted into cmake as "-A ${PLATFROM}"
- Updated test.yaml to test windows x64 and Win32 platforms
- Updated node_modules to account for the recent path deprecations (I was having odd macos race conditions)
- Inserted the links and md5 hashs for lua5.4.0 and lua5.4.1.
- They are commented out until we build a patch for 5.4
  • Loading branch information
alexjgriffith authored and xpol committed Oct 27, 2020
1 parent bb5a81c commit 84f642e
Show file tree
Hide file tree
Showing 176 changed files with 3,098 additions and 6,806 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
luaVersion: ["5.1.5", "5.2.4", "5.3.5"]
os: [macOs-latest, ubuntu-latest, windows-latest]
os: [macOs-latest, ubuntu-latest]

runs-on: ${{ matrix.os }}

Expand All @@ -21,3 +21,19 @@ jobs:
run: |
which lua
lua -e "print(_VERSION)"
windows:
runs-on: windows-latest
strategy:
matrix:
luaVersion: ["5.1.5", "5.2.4", "5.3.5"]
platform: [Win32, x64]
steps:
- uses: actions/checkout@master
- uses: ./
with:
lua-version: ${{ matrix.luaVersion }}
platform: ${{ matrix.platform }}
- name: test lua
run: |
which lua
lua -e "print(_VERSION)"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
!node_modules
.env
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: "Setup Lua/LuaJIT"
description: "Download, build, and install Lua or LuaJIT."

Expand All @@ -10,6 +9,8 @@ inputs:
lua-version:
description: "The version of Lua to install. Supported versions: Lua >= 5.1.0, LuaJIT >= 2.0.0"
default: "5.3.5"
platform:
description: "Optional: The target platform (e.g. -A Win32 | x64)."

runs:
using: 'node12'
Expand Down
38 changes: 27 additions & 11 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const core = require("@actions/core")
const exec = require("@actions/exec")
const io = require("@actions/io")
Expand All @@ -22,7 +21,9 @@ const VERSION_ALIASES = {
}

const TARBALLS = {
"5.4.0-beta1": ["961e2692a10a4a3c6fe80086e4cbefd5", "https://www.lua.org/work/lua-5.4.0-beta.tar.gz"],
// need patch for 5.4
// "5.4.1": ["1d575faef1c907292edd79e7a2784d30", "https://www.lua.org/ftp/lua-5.4.1.tar.gz"],
// "5.4.0": ["dbf155764e5d433fc55ae80ea7060b60", "https://www.lua.org/ftp/lua-5.4.0.tar.gz"],
"5.3.5": ["4f4b4f323fd3514a68e0ab3da8ce3455", "https://www.lua.org/ftp/lua-5.3.5.tar.gz"],
"5.3.4": ["53a9c68bcc0eda58bdc2095ad5cdfc63", "https://www.lua.org/ftp/lua-5.3.4.tar.gz"],
"5.3.3": ["703f75caa4fdf4a911c1a72e67a27498", "https://www.lua.org/ftp/lua-5.3.3.tar.gz"],
Expand Down Expand Up @@ -100,8 +101,13 @@ function getTarball(version) {
}

function getLuaVersion() {
const luaVersion = core.getInput('lua-version', { required: true })
return VERSION_ALIASES[luaVersion] || luaVersion
const luaVersion = core.getInput('lua-version', { required: false })
return VERSION_ALIASES[luaVersion] || luaVersion || "5.1.5"
}

function getPlatform() {
const platform = core.getInput('platfrom', { required: false });
return platform || false;
}

async function download(url, hash) {
Expand All @@ -126,7 +132,6 @@ async function extractTarball(tarball, version) {
cwd: SOURCE_DIRECTORY
})
showDirectory(SOURCE_DIRECTORY)

const dir = tarballContentDirectory(version)
return path.join(SOURCE_DIRECTORY, dir)
}
Expand Down Expand Up @@ -162,13 +167,23 @@ async function addCMakeBuildScripts(sourcePath, luaVersion) {
mergeDirectory(path.join(__dirname, "patch", "shared"), sourcePath)
const v = luaVersion.replace(/\.\d*$/,'')
mergeDirectory(path.join(__dirname, "patch", "lua", v), sourcePath)
console.log("VERSION: " + v)
showDirectory(sourcePath)
}

async function buildAndInstall(sourcePath) {
await exec.exec(`cmake -H"${sourcePath}" -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}`, undefined, {
cwd: sourcePath
})
async function buildAndInstall(sourcePath, platform) {

if(platform){
await exec.exec(`cmake -H"${sourcePath}" -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -A${platform}`, undefined, {
cwd: sourcePath
})
}
else{
await exec.exec(`cmake -H"${sourcePath}" -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}`, undefined, {
cwd: sourcePath
})
}

await exec.exec(`cmake --build build --config Release --target install`, undefined, {
cwd: sourcePath
})
Expand All @@ -179,9 +194,10 @@ async function buildAndInstall(sourcePath) {
async function main() {
await installSystemDependencies()
const luaVersion = getLuaVersion()
const sourcePath = await downloadSource(luaVersion)
const platform = getPlatform();
const sourcePath = await downloadSource(luaVersion)
await addCMakeBuildScripts(sourcePath, luaVersion)
await buildAndInstall(sourcePath)
await buildAndInstall(sourcePath, platform)
}

main().catch(err => {
Expand Down
1 change: 0 additions & 1 deletion node_modules/.bin/md5-file

This file was deleted.

1 change: 1 addition & 0 deletions node_modules/.bin/md5-file

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion node_modules/.bin/semver

This file was deleted.

1 change: 1 addition & 0 deletions node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion node_modules/.bin/uuid

This file was deleted.

1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions node_modules/.yarn-integrity

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions node_modules/@actions/core/lib/command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 30 additions & 17 deletions node_modules/@actions/core/lib/command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/command.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 21 additions & 11 deletions node_modules/@actions/core/lib/core.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 84f642e

Please sign in to comment.