name: lint on: push: paths: - '.github/workflows/**.yml' - '**.lua' jobs: lint: runs-on: ubuntu-latest env: LUA_VERSION: 5.1.5 LUAROCKS_VERSION: 3.9.2 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 update sudo apt-get install -y lua5.1 liblua5.1-0-dev mkdir -p ~/.lua/bin ln -s /usr/bin/lua5.1 ~/.lua/bin/lua - name: Install LuaRocks and Luacheck if: steps.luarockscache.outputs.cache-hit != 'true' run: | wget https://luarocks.org/releases/luarocks-${{ env.LUAROCKS_VERSION }}.tar.gz tar -xzf luarocks-${{ env.LUAROCKS_VERSION }}.tar.gz cd luarocks-${{ env.LUAROCKS_VERSION }} ./configure --prefix=$HOME/.luarocks --with-lua-include=/usr/include/lua5.1 make make install echo "export PATH=\$HOME/.luarocks/bin:\$PATH" >> ~/.bashrc source ~/.bashrc luarocks install luacheck - name: Run Luacheck run: ~/.luarocks/bin/luacheck . -q