|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + LUA_VERSION: "5.4.7" |
| 12 | + |
| 13 | +jobs: |
| 14 | + stylua: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Format lua code |
| 22 | + uses: JohnnyMorganz/stylua-action@v4 |
| 23 | + with: |
| 24 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + version: 2.3.0 |
| 26 | + args: --check . |
| 27 | + |
| 28 | + luacheck: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Luacheck |
| 36 | + uses: lunarmodules/[email protected] |
| 37 | + |
| 38 | + luals: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout repository |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + submodules: true |
| 46 | + |
| 47 | + - name: Install lua-language-server |
| 48 | + run: | |
| 49 | + wget https://github.com/LuaLS/lua-language-server/releases/download/3.15.0/lua-language-server-3.15.0-linux-x64.tar.gz |
| 50 | + mkdir /tmp/lua-language-server |
| 51 | + tar xf lua-language-server-* -C /tmp/lua-language-server |
| 52 | + rm lua-language-server-* |
| 53 | +
|
| 54 | + - name: Run lua-language-server in command line |
| 55 | + run: | |
| 56 | + /tmp/lua-language-server/bin/lua-language-server --check=. --checklevel=Information |
| 57 | +
|
| 58 | + tests: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + container: |
| 61 | + image: pandoc/core:3.7.0.2 |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Checkout repository |
| 65 | + uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Verify pandoc installation |
| 68 | + run: | |
| 69 | + pandoc --version |
| 70 | +
|
| 71 | + - name: Ensure pandoc supports dynamic loading of C libraries |
| 72 | + run: | |
| 73 | + ldd $(which pandoc) |
| 74 | +
|
| 75 | + - name: Install build tools |
| 76 | + run: | |
| 77 | + apk update |
| 78 | + apk add git make gcc musl-dev |
| 79 | +
|
| 80 | + - name: Install lua |
| 81 | + run: | |
| 82 | + cd /tmp |
| 83 | + wget https://www.lua.org/ftp/lua-${{ env.LUA_VERSION }}.tar.gz |
| 84 | + tar zxf lua-${{ env.LUA_VERSION }}.tar.gz |
| 85 | + cd lua-${{ env.LUA_VERSION }} |
| 86 | + make linux |
| 87 | + make install |
| 88 | +
|
| 89 | + - name: Install luarocks |
| 90 | + run: | |
| 91 | + cd /tmp |
| 92 | + git clone https://github.com/luarocks/luarocks.git |
| 93 | + cd luarocks |
| 94 | + ./configure --lua-version=5.4 \ |
| 95 | + --with-lua=/usr/local \ |
| 96 | + --prefix=/usr/local |
| 97 | + make |
| 98 | + make install |
| 99 | +
|
| 100 | + - name: Install proper wget so luarocks doesn't error out |
| 101 | + run: | |
| 102 | + apk add wget |
| 103 | +
|
| 104 | + - name: Install luarocks modules |
| 105 | + run: | |
| 106 | + luarocks install busted |
| 107 | + luarocks install luacov |
| 108 | + luarocks install cluacov |
| 109 | + luarocks install ansicolors |
| 110 | +
|
| 111 | + - name: Run tests |
| 112 | + run: | |
| 113 | + pandoc lua test.lua |
| 114 | +
|
| 115 | + - name: Check test coverage |
| 116 | + run: | |
| 117 | + pandoc lua ci-coverage.lua |
0 commit comments