Skip to content

Commit d32a5ba

Browse files
committed
First working version.
1 parent 31067de commit d32a5ba

File tree

219 files changed

+20735
-2
lines changed

Some content is hidden

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

219 files changed

+20735
-2
lines changed

.github/workflows/publish.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
luaVersion: ["5.1.5", "5.2.4", "5.3.5", "luajit-2.0.5", "luajit-2.1.0-beta3"]
14+
os: [ubuntu-latest, macOs-latest, windows-latest]
15+
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- uses: actions/checkout@master
20+
- uses: xpol/setup-lua@master
21+
with:
22+
luaVersion: ${{ matrix.luaVersion }}
23+
24+
- name: bundle binaries
25+
run: tar czf '${{matrix.luaVersion}}.tar.gz' .lua
26+
27+
- name: upload to release
28+
uses: svenstaro/upload-release-action@v1-release
29+
with:
30+
repo_token: ${{ secrets.GITHUB_TOKEN }}
31+
file: ${{ matrix.luaVersion }}.tar.gz
32+
asset_name: ${{ matrix.luaVersion }}.tar.gz
33+
tag: ${{ github.ref }}
34+
overwrite: true

.github/workflows/test.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: test
2+
3+
on: [push]
4+
5+
jobs:
6+
test:
7+
strategy:
8+
matrix:
9+
luaVersion: ["5.1.5", "5.2.4", "5.3.5"]
10+
os: [macOs-latest, ubuntu-latest, windows-latest]
11+
12+
runs-on: ${{ matrix.os }}
13+
14+
steps:
15+
- uses: actions/checkout@master
16+
- uses: ./
17+
with:
18+
luaVersion: ${{ matrix.luaVersion }}
19+
20+
- name: test lua
21+
run: |
22+
which lua
23+
lua -e "print(_VERSION)"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!node_modules

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
vendor::
3+
-rm -r node_modules
4+
yarn install --production

README.md

+148-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,148 @@
1-
# setup-lua
2-
GitHub action to setup Lua.
1+
# xpol/setup-lua
2+
3+
[![Actions Status](https://github.com/xpol/setup-lua/workflows/test/badge.svg)](https://github.com/xpol/setup-lua/actions)
4+
5+
Github Action to install Lua/LuaJIT on Unbutu/macOS/Windows.
6+
7+
Builds and installs Lua into the `.lua/` directory in the working directory using [CMake](https://cmake.org/).
8+
Adds the `.lua/bin` to the `PATH` environment variable so `lua` can be called
9+
directly in workflows.
10+
11+
This project is hightlly inspired by (and this README is initially copied from) [leafo/gh-actions-lua](https://github.com/leafo/gh-actions-lua). The difference is this project use CMake to support Unbutu/macOS/Windows.
12+
13+
Many thanks to [leafo](https://github.com/leafo)!
14+
15+
## Usage
16+
17+
Install Lua:
18+
19+
*Will install the latest stable release of PUC-Rio Lua.*
20+
21+
```yaml
22+
- uses: xpol/setup-lua@v1
23+
```
24+
25+
Install specific version of Lua:
26+
27+
```yaml
28+
- uses: xpol/setup-lua@v1
29+
with:
30+
luaVersion: "5.1.5"
31+
```
32+
33+
Install specific version of LuaJIT:
34+
35+
```yaml
36+
- uses: xpol/setup-lua@v1
37+
with:
38+
luaVersion: "luajit-2.0.5"
39+
```
40+
41+
## Inputs
42+
43+
### `luaVersion`
44+
45+
**Default**: `"5.3.5"`
46+
47+
Specifies the version of Lua to install. The version name instructs the action
48+
where to download the source from.
49+
50+
All supported of versions:
51+
52+
* `"5.3.5"`
53+
* `"5.3.4"`
54+
* `"5.3.3"`
55+
* `"5.3.2"`
56+
* `"5.3.1"`
57+
* `"5.3.0"`
58+
* `"5.2.4"`
59+
* `"5.2.3"`
60+
* `"5.2.2"`
61+
* `"5.2.1"`
62+
* `"5.2.0"`
63+
* `"5.1.5"`
64+
* `"5.1.4"`
65+
* `"5.1.3"`
66+
* `"5.1.2"`
67+
* `"5.1.1"`
68+
* `"5.1.0"`
69+
* `"luajit-2.0.5"`
70+
* `"luajit-2.1.0-beta3"`
71+
* `"luajit-2.1.0-beta2"`
72+
* `"luajit-2.1.0-beta1"`
73+
* `"luajit-2.0.4"`
74+
* `"luajit-2.0.3"`
75+
* `"luajit-2.0.2"`
76+
* `"luajit-2.0.1"`
77+
* `"luajit-2.0.0"`
78+
79+
*Note: Beta versions will removed when the stable version is released.*
80+
81+
## Also want LuaRocks
82+
83+
You may also need an action to install luarocks:
84+
85+
* [`leafo/gh-actions-luarocks`](https://github.com/leafo/gh-actions-luarocks)
86+
* inputs: `luarocksVersion`
87+
88+
## Full Example
89+
90+
This example is for running tests on a Lua module that uses LuaRocks for
91+
dependencies and [busted](https://olivinelabs.com/busted/) for a test suite.
92+
93+
Create `.github/workflows/test.yml` in your repository:
94+
95+
```yaml
96+
name: test
97+
98+
on: [push]
99+
100+
jobs:
101+
test:
102+
runs-on: ubuntu-latest
103+
104+
steps:
105+
- uses: actions/checkout@master
106+
107+
- uses: xpol/setup-lua@v1
108+
with:
109+
luaVersion: "5.1.5"
110+
111+
- uses: leafo/gh-actions-luarocks@v2
112+
113+
- name: build
114+
run: |
115+
luarocks install busted
116+
luarocks make
117+
118+
- name: test
119+
run: |
120+
busted -o utfTerminal
121+
```
122+
123+
This example:
124+
125+
* Uses Lua 5.1.5 — You can use another version by chaning the `luaVersion` varible. LuaJIT versions can be used by prefixing the version with `luajit-`, i.e. `luajit-2.1.0-beta3`
126+
* Uses a `.rockspec` file the root directory of your repository to install dependencies and test packaging the module via `luarocks make`
127+
128+
View the documentation for the individual actions (linked above) to learn more about how they work.
129+
130+
### Version build matrix
131+
132+
You can test against multiple versions of Lua using a matrix strategy:
133+
134+
```yaml
135+
jobs:
136+
test:
137+
strategy:
138+
matrix:
139+
luaVersion: ["5.1.5", "5.2.4", "luajit-2.1.0-beta3"]
140+
141+
steps:
142+
- uses: actions/checkout@master
143+
- uses: xpol/setup-lua@v1
144+
with:
145+
luaVersion: ${{ matrix.luaVersion }}
146+
147+
# ...
148+
```

action.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
name: "Setup Lua/LuaJIT"
3+
description: "Download, build, and install Lua or LuaJIT."
4+
5+
branding:
6+
icon: 'moon'
7+
color: 'blue'
8+
9+
inputs:
10+
lua-version:
11+
description: "The version of Lua to install. Supported versions: Lua >= 5.1.0, LuaJIT >= 2.0.0"
12+
default: "5.3.5"
13+
14+
runs:
15+
using: 'node12'
16+
main: 'main.js'

0 commit comments

Comments
 (0)