Skip to content

Commit

Permalink
make: gather code coverage and send report to coveralls
Browse files Browse the repository at this point in the history
Patch adds collecting code coverage statistics and sending it to
Coveralls [1] for future analysis. Code coverage collected with luatest
and it means that TAP tests doesn't contribute to coverage. No sense to
support them as we plan to rewrite TAP tests to luatest.

1. https://coveralls.io/github/tarantool/expirationd

See also #61
Closes #85
  • Loading branch information
ligurio committed Oct 12, 2021
1 parent da0e4d6 commit b22741e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/fast_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
- '2.6'
- '2.7'
- '2.8'
coveralls: [false]
include:
- tarantool: '2.8'
coveralls: true

runs-on: ubuntu-latest
steps:
Expand All @@ -40,17 +44,25 @@ jobs:
id: cache-rocks
with:
path: .rocks/
key: cache-rocks-${{ matrix.tarantool }}-04
key: cache-rocks-${{ matrix.tarantool }}-06

- name: Install requirements
run: |
tarantoolctl rocks install luatest 0.5.0
tarantoolctl rocks install luacheck 0.26.0
tarantoolctl rocks install luacov 0.13.0-1
tarantoolctl rocks install luacov-coveralls 0.2.3-1 --server=http://luarocks.org
tarantoolctl rocks make
if: steps.cache-rocks.outputs.cache-hit != 'true'

- run: echo $PWD/.rocks/bin >> $GITHUB_PATH

- run: make check

- run: make test
- run: make coverage

- name: Send code coverage to coveralls.io
run: make coveralls
if: ${{ matrix.coveralls }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
*.xlog
*.log
VERSION
luacov.stats.out
luacov.report.out
tags
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# `make -f /path/to/project/Makefile`.
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))
LUACOV_REPORT := $(PROJECT_DIR)/luacov.report.out
LUACOV_STATS := $(PROJECT_DIR)/luacov.stats.out

CLEANUP_FILES = tarantool.log
CLEANUP_FILES += *.xlog*
Expand All @@ -25,7 +27,7 @@ luacheck:

.PHONY: test
test:
luatest -v
luatest -v --coverage
rm -rf ${CLEANUP_FILES}
INDEX_TYPE='TREE' SPACE_TYPE='vinyl' ./test.lua
rm -rf ${CLEANUP_FILES}
Expand All @@ -34,5 +36,16 @@ test:
INDEX_TYPE='TREE' ./test.lua
rm -rf ${CLEANUP_FILES}

$(LUACOV_STATS): test

coverage: $(LUACOV_STATS)
sed -i -e 's@'"$$(realpath .)"'/@@' $(LUACOV_STATS)
cd $(PROJECT_DIR) && luacov expirationd.lua
grep -A999 '^Summary' $(LUACOV_REPORT)

coveralls: $(LUACOV_STATS)
echo "Send code coverage data to the coveralls.io service"
luacov-coveralls --include ^expirationd --verbose --repo-token ${GITHUB_TOKEN}

clean:
rm -rf ${CLEANUP_FILES}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![Run tests](https://github.com/tarantool/expirationd/actions/workflows/test_on_push.yaml/badge.svg)](https://github.com/tarantool/expirationd/actions/workflows/test_on_push.yaml)
<a href='https://coveralls.io/github/tarantool/expirationd?branch=master'>
<img src='https://coveralls.io/repos/github/tarantool/expirationd/badge.svg?branch=master' alt='Coverage Status' />
</a>

# expirationd - data expiration with custom quirks.

This package can turn Tarantool into a persistent memcache replacement,
Expand Down

0 comments on commit b22741e

Please sign in to comment.