[tarantool-patches] [PATCH v1] gitlab-ci: add static build
Alexander V. Tikhonov
avtikhon at tarantool.org
Fri Aug 9 07:32:34 MSK 2019
Added static build using Dockerfile on Centos 7 for release
commit criteria only. Also cleaned up the Dockerfile from
duplicating code and added the cleanup for cmake generating
CMakeCache.txt files and CMakeFiles directories to avoid of
cmake localy created setup failing inside the docker after
the whole tarantool path was copied into it. Added testing
into the staic build, running only when RUN_TESTS environment
variable set to non empty value, used in gitlab-ci job to run
the testing after the build.
Closes #3668
---
Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3668-static-build-full-ci
Issue: https://github.com/tarantool/tarantool/issues/3668
.gitlab-ci.yml | 13 ++++++++++
.gitlab.mk | 7 +++++
Dockerfile.staticbuild | 58 ++++++++++++++++++++++++------------------
3 files changed, 53 insertions(+), 25 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a7b2b3804..f160c276b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -326,3 +326,16 @@ debian_10:
DIST: 'buster'
script:
- ${GITLAB_MAKE} package
+
+static_build:
+ only:
+ refs:
+ - master
+ - /^.*-full-ci$/
+ stage: test
+ tags:
+ - deploy
+ variables:
+ RUN_TESTS: 'ON'
+ script:
+ - ${GITLAB_MAKE} static_build
diff --git a/.gitlab.mk b/.gitlab.mk
index 7199adf94..cb66df4c2 100644
--- a/.gitlab.mk
+++ b/.gitlab.mk
@@ -105,3 +105,10 @@ vms_shutdown:
package: git_submodule_update
git clone https://github.com/packpack/packpack.git packpack
PACKPACK_EXTRA_DOCKER_RUN_PARAMS='--network=host' ./packpack/packpack
+
+# ############
+# Static build
+# ############
+
+static_build:
+ docker build --network=host -f Dockerfile.staticbuild .
diff --git a/Dockerfile.staticbuild b/Dockerfile.staticbuild
index 6a784990b..2ceff12ca 100644
--- a/Dockerfile.staticbuild
+++ b/Dockerfile.staticbuild
@@ -3,8 +3,8 @@ FROM centos:7
RUN yum install -y epel-release
RUN yum install -y yum install https://centos7.iuscommunity.org/ius-release.rpm
-RUN set -x \
- && yum -y install \
+RUN set -x && \
+ yum -y install \
libstdc++ \
libstdc++-static \
readline \
@@ -19,8 +19,8 @@ RUN set -x \
zip \
unzip \
libunwind \
- libcurl \
- && yum -y install \
+ libcurl && \
+ yum -y install \
perl \
gcc-c++ \
cmake \
@@ -32,14 +32,20 @@ RUN set -x \
autoconf \
automake \
libtool \
- wget
-
-RUN yum -y install ncurses-static readline-static zlib-static pcre-static glibc-static
+ wget && \
+ yum -y install \
+ ncurses-static \
+ readline-static \
+ zlib-static \
+ pcre-static \
+ glibc-static && \
+ yum -y install \
+ python-devel \
+ python-pip
-RUN yum -y install python-devel python-pip
+WORKDIR /
RUN set -x && \
- cd / && \
curl -O -L https://www.openssl.org/source/openssl-1.1.0h.tar.gz && \
tar -xvf openssl-1.1.0h.tar.gz && \
cd openssl-1.1.0h && \
@@ -47,7 +53,6 @@ RUN set -x && \
make && make install
RUN set -x && \
- cd / && \
git clone https://github.com/curl/curl.git && \
cd curl && \
git checkout curl-7_59_0 && \
@@ -56,7 +61,6 @@ RUN set -x && \
make -j && make install
RUN set -x && \
- cd / && \
wget http://download.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz && \
tar -xvf icu4c-62_1-src.tgz && \
cd icu/source && \
@@ -64,7 +68,6 @@ RUN set -x && \
make && make install
RUN set -x && \
- cd / && \
LD_LIBRARY_PATH=/usr/local/lib64 curl -O -L http://download.savannah.nongnu.org/releases/libunwind/libunwind-1.3-rc1.tar.gz && \
tar -xvf libunwind-1.3-rc1.tar.gz && \
cd libunwind-1.3-rc1 && \
@@ -72,23 +75,28 @@ RUN set -x && \
make && make install
COPY . /tarantool
+WORKDIR /tarantool
RUN set -x && \
- cd tarantool && \
- git submodule init && \
- git submodule update
+ git submodule update --init && \
+ find . -name 'CMakeFiles' -type d -exec rm -rf {} + && \
+ find . -name 'CMakeCache.txt' -type f -delete
-RUN pip install -r /tarantool/test-run/requirements.txt
+RUN pip install -r test-run/requirements.txt
-RUN set -x \
- && (cd /tarantool; \
- cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
- -DENABLE_DIST:BOOL=ON \
- -DBUILD_STATIC=ON \
- -DOPENSSL_USE_STATIC_LIBS=ON \
- .) \
- && make -C /tarantool -j
+RUN set -x && \
+ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DENABLE_DIST:BOOL=ON \
+ -DBUILD_STATIC=ON \
+ -DOPENSSL_USE_STATIC_LIBS=ON \
+ . && \
+ make -j && \
+ make install
-RUN cd /tarantool && make install
+ARG RUN_TESTS
+RUN [ -n ${RUN_TESTS} ] && \
+ set -x && \
+ cd test && \
+ /usr/bin/python test-run.py --force
ENTRYPOINT /bin/bash
--
2.17.1
More information about the Tarantool-patches
mailing list