From 72790354ef082c01c8c86c8fc282f451c7ba3239 Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Wed, 1 Jul 2020 18:08:45 +0300 Subject: [PATCH] lint --- .github/workflows/lint-pr.yml | 62 ++++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 63 +++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 .github/workflows/lint-pr.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml new file mode 100644 index 0000000..4de5cbb --- /dev/null +++ b/.github/workflows/lint-pr.yml @@ -0,0 +1,62 @@ +name: lint + +on: + pull_request: + paths: + - '**.lua' + +jobs: + lint: + runs-on: ubuntu-latest + + env: + LUA_VERSION: 5.1.5 + LUAROCKS_VERSION: 2.4.2 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Cache Lua + uses: actions/cache@v1 + 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@v1 + 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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..7673ae7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,63 @@ +name: lint + +on: + push: + paths: + - '.github/workflows/**.yml' + - '**.lua' + +jobs: + lint: + runs-on: ubuntu-latest + + env: + LUA_VERSION: 5.1.5 + LUAROCKS_VERSION: 2.4.2 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Cache Lua + uses: actions/cache@v1 + 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@v1 + 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