63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: lint
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- '**.lua'
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
LUA_VERSION: 5.1.5
|
|
LUAROCKS_VERSION: 3.11.1
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache Lua
|
|
uses: actions/cache@v3
|
|
id: luacache
|
|
with:
|
|
path: .lua
|
|
key: ${{ runner.os }}-lua-${{ env.LUA_VERSION }}
|
|
restore-keys: |
|
|
${{ runner.os }}-lua-${{ env.LUA_VERSION }}
|
|
|
|
- name: Cache LuaRocks
|
|
uses: actions/cache@v3
|
|
id: luarockscache
|
|
with:
|
|
path: .luarocks
|
|
key: ${{ runner.os }}-luarocks-${{ env.LUAROCKS_VERSION }}
|
|
restore-keys: |
|
|
${{ runner.os }}-luarocks-${{ env.LUAROCKS_VERSION }}
|
|
|
|
- name: Install Lua
|
|
if: steps.luacache.outputs.cache-hit != 'true'
|
|
run: |
|
|
sudo apt-get install libreadline-dev libncurses-dev
|
|
wget https://www.lua.org/ftp/lua-${{ env.LUA_VERSION }}.tar.gz -O - | tar -xzf -
|
|
cd lua-${{ env.LUA_VERSION }}
|
|
make linux
|
|
make -j INSTALL_TOP=$GITHUB_WORKSPACE/.lua install
|
|
rm -rf $GITHUB_WORKSPACE/lua-${{ env.LUA_VERSION }}
|
|
|
|
- name: Install LuaRocks and Luacheck
|
|
if: steps.luarockscache.outputs.cache-hit != 'true'
|
|
run: |
|
|
wget https://luarocks.org/releases/luarocks-${{ env.LUAROCKS_VERSION }}.tar.gz -O - | tar -xzf -
|
|
cd luarocks-${{ env.LUAROCKS_VERSION }}
|
|
./configure --with-lua-bin=$GITHUB_WORKSPACE/.lua/bin --prefix=$GITHUB_WORKSPACE/.luarocks
|
|
make build
|
|
make install
|
|
PATH=$PATH:$GITHUB_WORKSPACE/.luarocks/bin
|
|
luarocks install luacheck
|
|
luarocks install lanes
|
|
rm -rf $GITHUB_WORKSPACE/luarocks-${{ env.LUAROCKS_VERSION }}
|
|
|
|
- name: Luacheck
|
|
run: .luarocks/bin/luacheck . -q
|