From b68ef16950ad9cbbffda99d7e687309dee7bc6bc Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Mon, 15 Nov 2021 12:23:59 +0300 Subject: [PATCH] Measure test coverage 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 --- .github/workflows/test_on_push.yaml | 9 +++------ .gitignore | 4 +++- .luacov | 6 ++++++ Makefile | 30 +++++++++++++++++++++++++++++ tmp/.keep | 0 5 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 .luacov create mode 100644 Makefile create mode 100644 tmp/.keep diff --git a/.github/workflows/test_on_push.yaml b/.github/workflows/test_on_push.yaml index b2bf54c..9f84f7b 100644 --- a/.github/workflows/test_on_push.yaml +++ b/.github/workflows/test_on_push.yaml @@ -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 diff --git a/.gitignore b/.gitignore index 9d06d94..bc209ed 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,8 @@ .doctrees __pycache__ /dev -/tmp +/tmp/* +!/tmp/.keep doc release release-doc @@ -28,3 +29,4 @@ luacov.*.out* *.mo .history .vscode +*.rock diff --git a/.luacov b/.luacov new file mode 100644 index 0000000..9fa9337 --- /dev/null +++ b/.luacov @@ -0,0 +1,6 @@ +statsfile = 'tmp/luacov.stats.out' +reportfile = 'tmp/luacov.report.out' +exclude = { + '/test/', + '/tmp/', +} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2a5cf64 --- /dev/null +++ b/Makefile @@ -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 diff --git a/tmp/.keep b/tmp/.keep new file mode 100644 index 0000000..e69de29