|
| 1 | +name: Testing with unit tests |
| 2 | + |
| 3 | +on: |
| 4 | + - push |
| 5 | + |
| 6 | +jobs: |
| 7 | + run-unit-tests: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + version: ["1.10.15", "2.10.6", "2.11.0", "2.11.2"] |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - uses: tarantool/setup-tarantool@v3 |
| 15 | + with: |
| 16 | + tarantool-version: '${{matrix.version}}' |
| 17 | + - name: install luacov-console |
| 18 | + run: tarantoolctl rocks install luacov-console |
| 19 | + - name: install luatest |
| 20 | + run: tarantoolctl rocks install luatest |
| 21 | + - name: run tests |
| 22 | + env: |
| 23 | + LUACOV_ENABLE: true |
| 24 | + run: | |
| 25 | + .rocks/bin/luatest --coverage -b -c -v test/ |
| 26 | + - name: print luacov-console report |
| 27 | + run: .rocks/bin/luacov-console "$(pwd)" && .rocks/bin/luacov-console -s |
| 28 | + - name: rename luacov.stats.out |
| 29 | + run: mv luacov.stats.out luacov.stats.out-${{matrix.version}} |
| 30 | + - uses: actions/upload-artifact@master |
| 31 | + with: |
| 32 | + name: luacov.stats.out-${{matrix.version}} |
| 33 | + path: luacov.stats.out-${{matrix.version}} |
| 34 | + run-coverage-report: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + needs: ["run-unit-tests"] |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@master |
| 39 | + - uses: tarantool/setup-tarantool@v3 |
| 40 | + with: |
| 41 | + tarantool-version: '2.10.7' |
| 42 | + - name: install luacov-coveralls 0.2.3 |
| 43 | + run: tarantoolctl rocks install --server=https://luarocks.org luacov-coveralls 0.2.3 |
| 44 | + - name: install luacov-console 1.2.0 |
| 45 | + run: tarantoolctl rocks --server http://moonlibs.github.io/rocks install luacov-console 1.2.0 |
| 46 | + - name: Download run artifacts |
| 47 | + uses: actions/download-artifact@v4 |
| 48 | + with: |
| 49 | + pattern: luacov.stats.out-* |
| 50 | + merge-multiple: true |
| 51 | + - name: debug |
| 52 | + run: ls -la . |
| 53 | + - name: merge luacov.stats.out |
| 54 | + run: cat luacov.stats.out-* | >luacov.stats.out tarantool -e 'm={} for k in io.lines() do local vs=io.read():split(" ") vs[#vs]=nil local r = m[k] if r then for i, v in pairs(vs) do r[i]=r[i]+v end else m[k]=vs end end; for k, v in pairs(m) do print(k) print(table.concat(v, " ")) end' |
| 55 | + - name: prepare coverage report |
| 56 | + run: .rocks/bin/luacov-console . && .rocks/bin/luacov-console -s |
| 57 | + - name: publish coveralls report |
| 58 | + env: |
| 59 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 60 | + run: .rocks/bin/luacov-coveralls -v |
0 commit comments