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
  • Loading branch information
ligurio committed Oct 8, 2021
1 parent b969223 commit 1ab290f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 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
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ PROJECT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))

SHELL := $(shell which bash) # Required for brace expansion used in a clean target.

# This way everything works as expected ever for
# `make -C /path/to/project` or
# `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 += *.index
CLEANUP_FILES += *.run
Expand Down Expand Up @@ -39,5 +47,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 1ab290f

Please sign in to comment.