Skip to content

Commit

Permalink
Measure test coverage
Browse files Browse the repository at this point in the history
Add Makefile for convenient local run. Use Makefile in test CI.
Add luacov dependency and run luatest with coverage.
Keep /tmp for luacov reports.

Based on PR #18 by @no1seman
  • Loading branch information
DifferentialOrange committed Nov 15, 2021
1 parent 3bd94b4 commit b68ef16
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ jobs:
tarantool-version: ${{ matrix.tarantool-version }}

- name: Install dependencies
run: |
tarantoolctl rocks install luatest 0.5.5
tarantoolctl rocks install luacheck 0.26.0
tarantoolctl rocks make
run: make .rocks

- name: Run linter
run: .rocks/bin/luacheck .
run: make lint

- name: Run tests
run: .rocks/bin/luatest -v
run: make test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
.doctrees
__pycache__
/dev
/tmp
/tmp/*
!/tmp/.keep
doc
release
release-doc
Expand All @@ -28,3 +29,4 @@ luacov.*.out*
*.mo
.history
.vscode
*.rock
6 changes: 6 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
statsfile = 'tmp/luacov.stats.out'
reportfile = 'tmp/luacov.report.out'
exclude = {
'/test/',
'/tmp/',
}
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
SHELL := /bin/bash

.PHONY: .rocks
.rocks: graphql-scm-1.rockspec Makefile
tarantoolctl rocks make
tarantoolctl rocks install luatest 0.5.5
tarantoolctl rocks install luacov 0.13.0
tarantoolctl rocks install luacheck 0.26.0

.PHONY: lint
lint:
if [ ! -d ".rocks" ]; then make .rocks; fi
.rocks/bin/luacheck .

.PHONY: test
test:
if [ ! -d ".rocks" ]; then make .rocks; fi
rm -f tmp/luacov*
.rocks/bin/luatest --verbose --coverage --shuffle group
.rocks/bin/luacov . && grep -A999 '^Summary' tmp/luacov.report.out

.PHONY: clean
clean:
rm -rf .rocks

.PHONY: build
build:
if [ ! -d ".rocks" ]; then make .rocks; fi
tarantoolctl rocks make
tarantoolctl rocks pack graphql scm-1
Empty file added tmp/.keep
Empty file.

0 comments on commit b68ef16

Please sign in to comment.