Skip to content

Commit 84f642e

Browse files
alexjgriffithxpol
authored andcommitted
Added support for passing a platform argument to cmake and rebuilt node 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
1 parent bb5a81c commit 84f642e

File tree

176 files changed

+3098
-6806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+3098
-6806
lines changed

.github/workflows/test.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
luaVersion: ["5.1.5", "5.2.4", "5.3.5"]
10-
os: [macOs-latest, ubuntu-latest, windows-latest]
10+
os: [macOs-latest, ubuntu-latest]
1111

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

@@ -21,3 +21,19 @@ jobs:
2121
run: |
2222
which lua
2323
lua -e "print(_VERSION)"
24+
windows:
25+
runs-on: windows-latest
26+
strategy:
27+
matrix:
28+
luaVersion: ["5.1.5", "5.2.4", "5.3.5"]
29+
platform: [Win32, x64]
30+
steps:
31+
- uses: actions/checkout@master
32+
- uses: ./
33+
with:
34+
lua-version: ${{ matrix.luaVersion }}
35+
platform: ${{ matrix.platform }}
36+
- name: test lua
37+
run: |
38+
which lua
39+
lua -e "print(_VERSION)"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
!node_modules
2+
.env

action.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: "Setup Lua/LuaJIT"
32
description: "Download, build, and install Lua or LuaJIT."
43

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

1415
runs:
1516
using: 'node12'

main.js

+27-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const core = require("@actions/core")
32
const exec = require("@actions/exec")
43
const io = require("@actions/io")
@@ -22,7 +21,9 @@ const VERSION_ALIASES = {
2221
}
2322

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

102103
function getLuaVersion() {
103-
const luaVersion = core.getInput('lua-version', { required: true })
104-
return VERSION_ALIASES[luaVersion] || luaVersion
104+
const luaVersion = core.getInput('lua-version', { required: false })
105+
return VERSION_ALIASES[luaVersion] || luaVersion || "5.1.5"
106+
}
107+
108+
function getPlatform() {
109+
const platform = core.getInput('platfrom', { required: false });
110+
return platform || false;
105111
}
106112

107113
async function download(url, hash) {
@@ -126,7 +132,6 @@ async function extractTarball(tarball, version) {
126132
cwd: SOURCE_DIRECTORY
127133
})
128134
showDirectory(SOURCE_DIRECTORY)
129-
130135
const dir = tarballContentDirectory(version)
131136
return path.join(SOURCE_DIRECTORY, dir)
132137
}
@@ -162,13 +167,23 @@ async function addCMakeBuildScripts(sourcePath, luaVersion) {
162167
mergeDirectory(path.join(__dirname, "patch", "shared"), sourcePath)
163168
const v = luaVersion.replace(/\.\d*$/,'')
164169
mergeDirectory(path.join(__dirname, "patch", "lua", v), sourcePath)
170+
console.log("VERSION: " + v)
165171
showDirectory(sourcePath)
166172
}
167173

168-
async function buildAndInstall(sourcePath) {
169-
await exec.exec(`cmake -H"${sourcePath}" -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}`, undefined, {
170-
cwd: sourcePath
171-
})
174+
async function buildAndInstall(sourcePath, platform) {
175+
176+
if(platform){
177+
await exec.exec(`cmake -H"${sourcePath}" -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -A${platform}`, undefined, {
178+
cwd: sourcePath
179+
})
180+
}
181+
else{
182+
await exec.exec(`cmake -H"${sourcePath}" -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}`, undefined, {
183+
cwd: sourcePath
184+
})
185+
}
186+
172187
await exec.exec(`cmake --build build --config Release --target install`, undefined, {
173188
cwd: sourcePath
174189
})
@@ -179,9 +194,10 @@ async function buildAndInstall(sourcePath) {
179194
async function main() {
180195
await installSystemDependencies()
181196
const luaVersion = getLuaVersion()
182-
const sourcePath = await downloadSource(luaVersion)
197+
const platform = getPlatform();
198+
const sourcePath = await downloadSource(luaVersion)
183199
await addCMakeBuildScripts(sourcePath, luaVersion)
184-
await buildAndInstall(sourcePath)
200+
await buildAndInstall(sourcePath, platform)
185201
}
186202

187203
main().catch(err => {

node_modules/.bin/md5-file

-1
This file was deleted.

node_modules/.bin/md5-file

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/semver

-1
This file was deleted.

node_modules/.bin/semver

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/uuid

-1
This file was deleted.

node_modules/.bin/uuid

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.yarn-integrity

-29
This file was deleted.

node_modules/@actions/exec/LICENSE.md node_modules/@actions/core/LICENSE.md

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/README.md

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/command.d.ts

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/command.js

+30-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/command.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/core.d.ts

+21-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)