aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: 5567f6370239776f382d18c99ed2cba249abf68b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: test

on: [push, pull_request]

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        cc: ["gcc", "clang"]
        luaVersion: ["5.1", "5.2", "5.3", "5.4", "luajit", "luajit-openresty"]
        include:
          - luaVersion: "luajit"
            runtestArgs: "LUA_INCLUDE_DIR=.lua/include/luajit-2.1"
            runtestEnv: "SKIP_CMAKE=1"
          - luaVersion: "luajit-openresty"
            runtestArgs: "LUA_INCLUDE_DIR=.lua/include/luajit-2.1"
            runtestEnv: "SKIP_CMAKE=1"

    runs-on: ubuntu-24.04

    steps:
    - uses: actions/checkout@master

    - uses: leafo/gh-actions-lua@master
      env:
        CC: ${{ matrix.cc }}
      with:
        luaVersion: ${{ matrix.luaVersion }}
        luaCompileFlags: CC=${{ matrix.cc }}

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

    - name: runtests.sh
      env:
        CC: ${{ matrix.cc }}
      run: |
        LUA_DIR=.lua ${{ matrix.runtestEnv }} ./runtests.sh PREFIX=.lua ${{ matrix.runtestArgs }}

    - name: setup prove
      env:
        CC: ${{ matrix.cc }}
      run: |
        make PREFIX=.lua ${{ matrix.runtestArgs }}
        sudo apt-get update
        sudo apt-get install -q valgrind libipc-run3-perl cppcheck cpanminus
        sudo cpanm --notest Test::Base Test::LongString

    - name: cppcheck
      run: cppcheck -i .lua/ -i .install/ -i dtoa.c --force --error-exitcode=1 --enable=warning --inline-suppr .

    - name: prove
      run: LUA_BIN=lua prove -Itests tests

    - name: prove (valgrind)
      run: LUA_BIN=lua TEST_LUA_USE_VALGRIND=1 prove -Itests tests

    - name: build
      run: |
        luarocks make