Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/check_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ jobs:
- name: Setup luacheck
run: tarantoolctl rocks install luacheck 0.25.0

- run: cmake -S . -B build

- name: Run luacheck
run: .rocks/bin/luacheck .
run: make -C build luacheck
20 changes: 16 additions & 4 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
include:
- tarantool-version: "2.7"
remove-merger: true
- tarantool-version: "2.7"
coveralls: true
fail-fast: false
runs-on: [ubuntu-latest]
steps:
Expand All @@ -39,8 +41,16 @@ jobs:
- name: Stop Mono server
run: sudo kill -9 $(sudo lsof -t -i tcp:8084) || true

- name: Run tests
run: .rocks/bin/luatest -v
- run: cmake -S . -B build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests and code coverage analysis
run: make -C build coverage

- name: Send code coverage to coveralls.io
run: make -C build coveralls
if: ${{ matrix.coveralls }}

run-tests-ee:
if: github.event_name == 'push'
Expand Down Expand Up @@ -68,5 +78,7 @@ jobs:
- name: Stop Mono server
run: sudo kill -9 $(sudo lsof -t -i tcp:8084) || true

- name: Run tests
run: .rocks/bin/luatest -v
- run: cmake -S . -B build

- name: Run tests and code coverage analysis
run: make -C build coverage
4 changes: 4 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
exclude = {
'/test/',
'/.rocks/',
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

* Added integration with service coveralls.io.
* Added integration with luacov that allows to generate report with code
coverage statistics.
* `crud.len()` function to calculate the number of tuples
in the space for memtx engine and calculate the maximum
approximate number of tuples in the space for vinyl engine.
Expand Down
50 changes: 50 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,59 @@ file(GLOB_RECURSE LUA_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cartridge/roles/*.lua"
)

## Testing ####################################################################
###############################################################################

enable_testing()

find_package(LuaCheck)
add_custom_target(luacheck
COMMAND ${LUACHECK} ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

find_package(LuaTest)
find_package(LuaCov)
find_package(LuaCovCoveralls)

set(CODE_COVERAGE_REPORT "${PROJECT_SOURCE_DIR}/luacov.report.out")
set(CODE_COVERAGE_STATS "${PROJECT_SOURCE_DIR}/luacov.stats.out")

add_custom_target(luatest
COMMAND ${LUATEST} -v --coverage
BYPRODUCTS ${CODE_COVERAGE_STATS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Run regression tests"
)

add_custom_target(coverage
COMMAND ${LUACOV} ${PROJECT_SOURCE_DIR} && grep -A999 '^Summary' ${CODE_COVERAGE_REPORT}
DEPENDS ${CODE_COVERAGE_STATS}
BYPRODUCTS ${CODE_COVERAGE_REPORT}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate code coverage stats"
)

if(DEFINED ENV{GITHUB_TOKEN})
set(COVERALLS_COMMAND ${LUACOVCOVERALLS} -v -r ${PROJECT_SOURCE_DIR} --repo-token $ENV{GITHUB_TOKEN})
else()
set(COVERALLS_COMMAND ${CMAKE_COMMAND} -E echo "Skipped uploading to coveralls.io: no token.")
endif()

add_custom_target(coveralls
COMMAND ${COVERALLS_COMMAND}
DEPENDS ${CODE_COVERAGE_STATS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Send code coverage data to the coveralls.io service"
)

## Install ####################################################################
###############################################################################

if(NOT DEFINED TARANTOOL_INSTALL_LUADIR)
set(TARANTOOL_INSTALL_LUADIR "${PROJECT_SOURCE_DIR}/.rocks/share/tarantool")
endif()

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}
DESTINATION ${TARANTOOL_INSTALL_LUADIR}
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CRUD

[![Run static analysis](https://github.com/tarantool/crud/actions/workflows/check_on_push.yaml/badge.svg)](https://github.com/tarantool/crud/actions/workflows/check_on_push.yaml)
[![Run tests](https://github.com/tarantool/crud/actions/workflows/test_on_push.yaml/badge.svg)](https://github.com/tarantool/crud/actions/workflows/test_on_push.yaml)
[![Coverage Status](https://coveralls.io/repos/github/tarantool/crud/badge.svg?branch=master)](https://coveralls.io/github/tarantool/crud?branch=master)

The `CRUD` module allows to perform CRUD operations on the cluster.
It also provides the `crud-storage` role for
[Tarantool Cartridge](https://github.com/tarantool/cartridge).
Expand Down
12 changes: 12 additions & 0 deletions cmake/FindLuaCheck.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_program(LUACHECK luacheck
HINTS .rocks/
PATH_SUFFIXES bin
DOC "Lua linter"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LuaCheck
REQUIRED_VARS LUACHECK
)

mark_as_advanced(LUACHECK)
12 changes: 12 additions & 0 deletions cmake/FindLuaCov.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_program(LUACOV luacov
HINTS .rocks/
PATH_SUFFIXES bin
DOC "Lua test coverage analysis"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LuaCov
REQUIRED_VARS LUACOV
)

mark_as_advanced(LUACOV)
12 changes: 12 additions & 0 deletions cmake/FindLuaCovCoveralls.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_program(LUACOVCOVERALLS luacov-coveralls
HINTS .rocks/
PATH_SUFFIXES bin
DOC "LuaCov reporter for coveralls.io service"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LuaCovCoveralls
REQUIRED_VARS LUACOVCOVERALLS
)

mark_as_advanced(LUACOVCOVERALLS)
12 changes: 12 additions & 0 deletions cmake/FindLuaTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_program(LUATEST luatest
HINTS .rocks/
PATH_SUFFIXES bin
DOC "Lua testing framework"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LuaTest
REQUIRED_VARS LUATEST
)

mark_as_advanced(LUATEST)
10 changes: 9 additions & 1 deletion deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
set -e

# Test dependencies:
tarantoolctl rocks install luatest 0.5.3
tarantoolctl rocks install luatest 0.5.4
tarantoolctl rocks install luacheck 0.25.0
tarantoolctl rocks install luacov 0.13.0

# cluacov, luacov-coveralls and dependencies
tarantoolctl rocks install https://raw.githubusercontent.com/mpeterv/cluacov/master/cluacov-scm-1.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/LuaDist/dkjson/master/dkjson-2.5-2.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/keplerproject/luafilesystem/master/luafilesystem-scm-1.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/moteus/lua-path/master/rockspecs/lua-path-scm-0.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/moteus/luacov-coveralls/master/rockspecs/luacov-coveralls-scm-0.rockspec

tarantoolctl rocks install cartridge 2.5.1
tarantoolctl rocks make