Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
moon

GitHub Action

Install Lua/LuaJIT

v7

Install Lua/LuaJIT

moon

Install Lua/LuaJIT

Download, build, and install Lua or LuaJIT for use with scripts, tests and more

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Install Lua/LuaJIT

uses: leafo/gh-actions-lua@v7

Learn more about this action in leafo/gh-actions-lua

Choose a version

Github Action for Lua and LuaJIT

leafo/gh-actions-lua

Actions Status

Update July 1 2020 Lua 5.4 works with no chagnes, specify Lua 5.4.0 as the version. A 5.4 alias has been added in the most recent tagged version. The default version has been updated to 5.4 in v6

Builds and installs Lua into the .lua/ directory in the working directory. Adds the .lua/bin to the PATH environment variable so lua can be called directly in workflows.

Other Lua GitHub actions:

Is your build failing when installing Lua? GitHub Action's Ubuntu base image changed default packages, please update to v5 or later

Usage

Install Lua: (Will typically default to the latest release, 5.4.0 as of this readme)

- uses: leafo/gh-actions-lua@v7

Install specific version of Lua:

- uses: leafo/gh-actions-lua@v7
  with:
    luaVersion: "5.1.5"

Install specific version of LuaJIT:

- uses: leafo/gh-actions-lua@v7
  with:
    luaVersion: "luajit-2.1.0-beta3"

Inputs

luaVersion

Default: "5.4"

Specifies the version of Lua to install. The version name instructs the action where to download the source from.

Examples of versions:

  • "5.1.5"
  • "5.2.4"
  • "5.3.5"
  • "5.4.0"
  • "luajit-2.0.5"
  • "luajit-2.1.0-beta3"
  • "luajit-openresty"

The version specifies where the source is downloaded from:

Version aliases

You can use shorthand 5.1, 5.2, 5.3, 5.4, luajit version aliases to point to the latest (or recent) version of Lua for that version.

Full Example

This example is for running tests on a Lua module that uses LuaRocks for dependencies and busted for a test suite.

Create .github/workflows/test.yml in your repository:

name: test

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@master

    - uses: leafo/gh-actions-lua@v7
      with:
        luaVersion: "5.1.5"

    - uses: leafo/gh-actions-luarocks@v3

    - name: build
      run: |
        luarocks install busted
        luarocks make

    - name: test
      run: |
        busted -o utfTerminal

This example:

  • 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
  • Uses a .rockspec file the root directory of your repository to install dependencies and test packaging the module via luarocks make

View the documentation for the individual actions (linked above) to learn more about how they work.

Version build matrix

You can test against multiple versions of Lua using a matrix strategy:

jobs:
  test:
    strategy:
      matrix:
        luaVersion: ["5.1.5", "5.2.4", "luajit-2.1.0-beta3"]

    steps:
    - uses: actions/checkout@master
    - uses: leafo/gh-actions-lua@v5
      with:
        luaVersion: ${{ matrix.luaVersion }}

    # ...