Skip to content

Commit

Permalink
gitlab-ci: add out-of-source build
Browse files Browse the repository at this point in the history
Implemented out-of-source build at cmake files.
Added out of source build make targets and added
test job to gitlab-ci.

Closes #4874
  • Loading branch information
avtikhon committed May 22, 2020
1 parent f5757d8 commit 376fc70
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .gitlab-ci.yml
Expand Up @@ -105,6 +105,13 @@ variables:

# Tests

out_of_source:
stage: test
tags:
- deploy_test
script:
- ${GITLAB_MAKE} test_oos_build

release:
<<: *docker_test_definition
script:
Expand Down
26 changes: 26 additions & 0 deletions .travis.mk
Expand Up @@ -3,9 +3,13 @@
#

DOCKER_IMAGE?=packpack/packpack:debian-stretch
DOCKER_TEST_IMAGE?=registry.gitlab.com/tarantool/tarantool/testing/debian-stretch:latest
TEST_RUN_EXTRA_PARAMS?=
MAX_FILES?=65534
MAX_PROC?=2500
OOS_SRC_PATH?=/source
OOS_BUILD_PATH?=/rw_bins
OOS_BUILD_RULE?=test_oos_no_deps

all: package

Expand Down Expand Up @@ -146,6 +150,28 @@ test_static_build: deps_debian_static
test_static_docker_build:
docker build --no-cache --network=host --build-arg RUN_TESTS=ON -f Dockerfile.staticbuild .

# Out-Of-Source build

build_oos:
mkdir ${OOS_BUILD_PATH} 2>/dev/null || : ; \
cd ${OOS_BUILD_PATH} && \
cmake ${OOS_SRC_PATH} ${CMAKE_EXTRA_PARAMS} && \
make -j

test_oos_no_deps: build_oos
cd ${OOS_BUILD_PATH}/test && \
OUTOFSRC_BUILD=ON ${OOS_SRC_PATH}/test/test-run.py \
--builddir ${OOS_BUILD_PATH} \
--vardir ${OOS_BUILD_PATH}/test/var --force

test_oos: deps_debian test_oos_no_deps

test_oos_build:
docker run --network=host -w ${OOS_SRC_PATH} \
--mount type=bind,source="${PWD}",target=${OOS_SRC_PATH},readonly,bind-propagation=rslave \
-i ${DOCKER_TEST_IMAGE} \
make -f .travis.mk ${OOS_BUILD_RULE}

#######
# OSX #
#######
Expand Down
4 changes: 2 additions & 2 deletions cmake/utils.cmake
Expand Up @@ -70,9 +70,9 @@ endfunction()

function(bin_source varname srcfile dstfile)
set(var ${${varname}})
set(${varname} ${var} ${dstfile} PARENT_SCOPE)
set (srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
set (dstfile "${CMAKE_CURRENT_SOURCE_DIR}/${dstfile}")
set (dstfile "${CMAKE_CURRENT_BINARY_DIR}/${dstfile}")
set(${varname} ${var} "${dstfile}" PARENT_SCOPE)
set (tmpfile "${dstfile}.tmp")
get_filename_component(module ${dstfile} NAME_WE)

Expand Down
1 change: 1 addition & 0 deletions src/box/CMakeLists.txt
Expand Up @@ -32,6 +32,7 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})

include_directories(${ZSTD_INCLUDE_DIRS})
include_directories(${CMAKE_BINARY_DIR}/src/box/sql)
include_directories(${CMAKE_BINARY_DIR}/src/box)

add_library(vclock STATIC vclock.c)
target_link_libraries(vclock core)
Expand Down

0 comments on commit 376fc70

Please sign in to comment.