mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Added scripts for various CI tasks (in progress). (#2356)
* Added initial scripts for CI [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2] * CI: development [#CLICKHOUSE-2]
This commit is contained in:
parent
157e3339b5
commit
589899ac25
130
ci/README.md
Normal file
130
ci/README.md
Normal file
@ -0,0 +1,130 @@
|
||||
### Build and test ClickHouse on various plaforms
|
||||
|
||||
Quick and dirty scripts.
|
||||
|
||||
Usage example:
|
||||
```
|
||||
./run-with-docker.sh ubuntu:bionic jobs/quick-build/run.sh
|
||||
```
|
||||
|
||||
Look at `default_config` and `jobs/quick-build/config`
|
||||
|
||||
Various possible options. We are not going to automate testing all of them.
|
||||
|
||||
##### CPU architectures:
|
||||
- x86_64;
|
||||
- AArch64.
|
||||
|
||||
x86_64 is the main CPU architecture. We also have minimal support for AArch64.
|
||||
|
||||
##### Operating systems:
|
||||
- Linux;
|
||||
- FreeBSD.
|
||||
|
||||
We also target Mac OS X, but it's more difficult to test.
|
||||
Linux is the main. FreeBSD is also supported as production OS.
|
||||
Mac OS is intended only for development and have minimal support: client should work, server should just start.
|
||||
|
||||
##### Linux distributions:
|
||||
For build:
|
||||
- Ubuntu Bionic;
|
||||
- Ubuntu Trusty.
|
||||
|
||||
For run:
|
||||
- Ubuntu Hardy;
|
||||
- CentOS 5
|
||||
|
||||
We should support almost any Linux to run ClickHouse. That's why we test also on old distributions.
|
||||
|
||||
##### How to obtain sources:
|
||||
- use sources from local working copy;
|
||||
- clone sources from github;
|
||||
- download source tarball.
|
||||
|
||||
##### Compilers:
|
||||
- gcc-7;
|
||||
- gcc-8;
|
||||
- clang-6;
|
||||
- clang-svn.
|
||||
|
||||
##### Compiler installation:
|
||||
- from OS packages;
|
||||
- build from sources.
|
||||
|
||||
##### C++ standard library implementation:
|
||||
- libc++;
|
||||
- libstdc++ with C++11 ABI;
|
||||
- libstdc++ with old ABI.
|
||||
|
||||
When building with clang, libc++ is used. When building with gcc, we choose libstdc++ with C++11 ABI.
|
||||
|
||||
##### Linkers:
|
||||
- ldd;
|
||||
- gold;
|
||||
|
||||
When building with clang on x86_64, ldd is used. Otherwise we use gold.
|
||||
|
||||
##### Build types:
|
||||
- RelWithDebInfo;
|
||||
- Debug;
|
||||
- ASan;
|
||||
- TSan.
|
||||
|
||||
##### Build types, extra:
|
||||
- -g0 for quick build;
|
||||
- enable test coverage;
|
||||
- debug tcmalloc.
|
||||
|
||||
##### What to build:
|
||||
- only `clickhouse` target;
|
||||
- all targets;
|
||||
- debian packages;
|
||||
|
||||
We also have intent to build RPM and simple tgz packages.
|
||||
|
||||
##### Where to get third-party libraries:
|
||||
- from contrib directory (submodules);
|
||||
- from OS packages.
|
||||
|
||||
The only production option is to use libraries from contrib directory.
|
||||
Using libraries from OS packages is discouraged, but we also support this option.
|
||||
|
||||
##### Linkage types:
|
||||
- static;
|
||||
- shared;
|
||||
|
||||
Static linking is the only option for production usage.
|
||||
We also have support for shared linking, but it is indended only for developers.
|
||||
|
||||
##### Make tools:
|
||||
- make;
|
||||
- ninja.
|
||||
|
||||
##### Installation options:
|
||||
- run built `clickhouse` binary directly;
|
||||
- install from packages.
|
||||
|
||||
##### How to obtain packages:
|
||||
- build them;
|
||||
- download from repository.
|
||||
|
||||
##### Sanity checks:
|
||||
- check that clickhouse binary has no dependencies on unexpected shared libraries;
|
||||
- check that source code have no style violations.
|
||||
|
||||
##### Tests:
|
||||
- Functional tests;
|
||||
- Integration tests;
|
||||
- Unit tests;
|
||||
- Simple sh/reference tests;
|
||||
- Performance tests (note that they require predictable computing power);
|
||||
- Tests for external dictionaries (should be moved to integration tests);
|
||||
- Jepsen like tests for quorum inserts (not yet available in opensource).
|
||||
|
||||
##### Tests extra:
|
||||
- Run functional tests with Valgrind.
|
||||
|
||||
##### Static analyzers:
|
||||
- CppCheck;
|
||||
- clang-tidy;
|
||||
- Coverity.
|
37
ci/build-clang-from-sources.sh
Executable file
37
ci/build-clang-from-sources.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
$SUDO apt-get install -y subversion
|
||||
apt-cache search cmake3 | grep -P '^cmake3 ' && $SUDO apt-get -y install cmake3 || $SUDO apt-get -y install cmake
|
||||
|
||||
mkdir "${WORKSPACE}/llvm"
|
||||
|
||||
svn co "http://llvm.org/svn/llvm-project/llvm/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm"
|
||||
svn co "http://llvm.org/svn/llvm-project/cfe/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm/tools/clang"
|
||||
svn co "http://llvm.org/svn/llvm-project/lld/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm/tools/lld"
|
||||
svn co "http://llvm.org/svn/llvm-project/polly/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm/tools/polly"
|
||||
svn co "http://llvm.org/svn/llvm-project/clang-tools-extra/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm/tools/clang/tools/extra"
|
||||
svn co "http://llvm.org/svn/llvm-project/compiler-rt/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm/projects/compiler-rt"
|
||||
svn co "http://llvm.org/svn/llvm-project/libcxx/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm/projects/libcxx"
|
||||
svn co "http://llvm.org/svn/llvm-project/libcxxabi/${CLANG_SOURCES_BRANCH}" "${WORKSPACE}/llvm/llvm/projects/libcxxabi"
|
||||
|
||||
mkdir "${WORKSPACE}/llvm/build"
|
||||
cd "${WORKSPACE}/llvm/build"
|
||||
|
||||
# NOTE You must build LLVM with the same ABI as ClickHouse.
|
||||
# For example, if you compile ClickHouse with libc++, you must add
|
||||
# -D LLVM_ENABLE_LIBCXX=1
|
||||
# to the line below.
|
||||
|
||||
cmake -D CMAKE_BUILD_TYPE:STRING=Release ../llvm
|
||||
|
||||
make -j $THREADS
|
||||
$SUDO make install
|
||||
hash clang
|
||||
|
||||
cd ../../..
|
||||
|
||||
export CC=clang
|
||||
export CXX=clang++
|
8
ci/build-debian-packages.sh
Executable file
8
ci/build-debian-packages.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
[[ -d "${WORKSPACE}/sources" ]] || die "Run get-sources.sh first"
|
||||
|
||||
./sources/release
|
47
ci/build-gcc-from-sources.sh
Executable file
47
ci/build-gcc-from-sources.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
$SUDO apt-get install -y curl
|
||||
|
||||
if [[ "${GCC_SOURCES_VERSION}" == "latest" ]]; then
|
||||
GCC_SOURCES_VERSION=$(curl -sSL https://ftpmirror.gnu.org/gcc/ | grep -oE 'gcc-[0-9]+(\.[0-9]+)+' | sort -Vr | head -n1)
|
||||
fi
|
||||
|
||||
GCC_VERSION_SHORT=$(echo "$GCC_SOURCES_VERSION" | grep -oE '[0-9]' | head -n1)
|
||||
|
||||
echo "Will download ${GCC_SOURCES_VERSION} (short version: $GCC_VERSION_SHORT)."
|
||||
|
||||
THREADS=$(grep -c ^processor /proc/cpuinfo)
|
||||
|
||||
mkdir "${WORKSPACE}/gcc"
|
||||
pushd "${WORKSPACE}/gcc"
|
||||
|
||||
wget https://ftpmirror.gnu.org/gcc/${GCC_SOURCES_VERSION}/${GCC_SOURCES_VERSION}.tar.xz
|
||||
tar xf ${GCC_SOURCES_VERSION}.tar.xz
|
||||
pushd ${GCC_SOURCES_VERSION}
|
||||
./contrib/download_prerequisites
|
||||
popd
|
||||
mkdir gcc-build
|
||||
pushd gcc-build
|
||||
../${GCC_SOURCES_VERSION}/configure --enable-languages=c,c++ --disable-multilib
|
||||
make -j $THREADS
|
||||
$SUDO make install
|
||||
|
||||
popd
|
||||
popd
|
||||
|
||||
$SUDO ln -sf /usr/local/bin/gcc /usr/local/bin/gcc-${GCC_GCC_SOURCES_VERSION_SHORT}
|
||||
$SUDO ln -sf /usr/local/bin/g++ /usr/local/bin/g++-${GCC_GCC_SOURCES_VERSION_SHORT}
|
||||
$SUDO ln -sf /usr/local/bin/gcc /usr/local/bin/cc
|
||||
$SUDO ln -sf /usr/local/bin/g++ /usr/local/bin/c++
|
||||
|
||||
echo '/usr/local/lib64' | $SUDO tee /etc/ld.so.conf.d/10_local-lib64.conf
|
||||
$SUDO ldconfig
|
||||
|
||||
hash gcc g++
|
||||
gcc --version
|
||||
|
||||
export CC=gcc
|
||||
export CXX=g++
|
22
ci/build-normal.sh
Executable file
22
ci/build-normal.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
[[ -d "${WORKSPACE}/sources" ]] || die "Run get-sources.sh first"
|
||||
|
||||
mkdir -p "${WORKSPACE}/build"
|
||||
pushd "${WORKSPACE}/build"
|
||||
|
||||
if [[ "${ENABLE_EMBEDDED_COMPILER}" == 1 ]]; then
|
||||
[[ "$USE_LLVM_LIBRARIES_FROM_SYSTEM" == 0 ]] && CMAKE_FLAGS="$CMAKE_FLAGS -D USE_INTERNAL_LLVM_LIBRARY=1"
|
||||
[[ "$USE_LLVM_LIBRARIES_FROM_SYSTEM" != 0 ]] && CMAKE_FLAGS="$CMAKE_FLAGS -D USE_INTERNAL_LLVM_LIBRARY=0"
|
||||
fi
|
||||
|
||||
cmake -D CMAKE_BUILD_TYPE=${BUILD_TYPE} -D ENABLE_EMBEDDED_COMPILER=${ENABLE_EMBEDDED_COMPILER} $CMAKE_FLAGS ../sources
|
||||
|
||||
[[ "$BUILD_TARGETS" != 'all' ]] && BUILD_TARGETS_STRING="--target $BUILD_TARGETS"
|
||||
|
||||
cmake --build . $BUILD_TARGETS_STRING -- -j $THREADS
|
||||
|
||||
popd
|
7
ci/check-docker.sh
Executable file
7
ci/check-docker.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
command -v docker > /dev/null || die "You need to install Docker"
|
||||
docker ps > /dev/null || die "You need to have access to Docker: run '$SUDO usermod -aG docker $USER' and relogin"
|
21
ci/check-syntax.sh
Executable file
21
ci/check-syntax.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
# NOTE: It will argue about
|
||||
# fatal error: re2_st/re2.h: No such file or directory
|
||||
# due to generated headers.
|
||||
|
||||
$SUDO apt-get install -y jq
|
||||
|
||||
[[ -d "${WORKSPACE}/sources" ]] || die "Run get-sources.sh first"
|
||||
|
||||
mkdir -p "${WORKSPACE}/build"
|
||||
pushd "${WORKSPACE}/build"
|
||||
|
||||
cmake -D CMAKE_BUILD_TYPE=Debug $CMAKE_FLAGS ../sources
|
||||
jq --raw-output '.[] | .command' compile_commands.json | grep -v -P -- '-c .+/contrib/' | sed -r -e 's/-o\s+\S+/-fsyntax-only/' > syntax-commands
|
||||
xargs --arg-file=syntax-commands --max-procs=$THREADS --replace /bin/sh -c "{}"
|
||||
|
||||
popd
|
10
ci/create-sources-tarball.sh
Executable file
10
ci/create-sources-tarball.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
if [[ -d "${WORKSPACE}/sources" ]]; then
|
||||
tar -c -z -f "${WORKSPACE}/sources.tar.gz" --directory "${WORKSPACE}/sources" .
|
||||
else
|
||||
die "Run get-sources first"
|
||||
fi
|
65
ci/default-config
Normal file
65
ci/default-config
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
if [[ -z "$INITIALIZED" ]]; then
|
||||
|
||||
INITIALIZED=1
|
||||
|
||||
SCRIPTPATH=$(pwd)
|
||||
WORKSPACE=${SCRIPTPATH}/workspace
|
||||
PROJECT_ROOT=$(cd $SCRIPTPATH/.. && pwd)
|
||||
|
||||
# All scripts take no arguments. All arguments must be in config.
|
||||
|
||||
# get-sources
|
||||
SOURCES_METHOD=local # clone, local, tarball
|
||||
SOURCES_CLONE_URL="https://github.com/yandex/ClickHouse.git"
|
||||
SOURCES_BRANCH="master"
|
||||
SOURCES_COMMIT=HEAD # do checkout of this commit after clone
|
||||
|
||||
# prepare-toolchain
|
||||
COMPILER=gcc # gcc, clang
|
||||
COMPILER_INSTALL_METHOD=packages # packages, sources
|
||||
COMPILER_PACKAGE_VERSION=7 # or 6.0 for clang
|
||||
|
||||
# install-compiler-from-sources
|
||||
CLANG_SOURCES_BRANCH=trunk # or tags/RELEASE_600/final
|
||||
GCC_SOURCES_VERSION=latest # or gcc-7.1.0
|
||||
|
||||
# install-libraries
|
||||
USE_LLVM_LIBRARIES_FROM_SYSTEM=0 # 0 or 1
|
||||
ENABLE_EMBEDDED_COMPILER=1
|
||||
|
||||
# build
|
||||
BUILD_METHOD=normal # normal, debian
|
||||
BUILD_TARGETS=clickhouse # tagtet name, all; only for "normal"
|
||||
BUILD_TYPE=RelWithDebInfo # RelWithDebInfo, Debug, ASan, TSan
|
||||
CMAKE_FLAGS=""
|
||||
|
||||
# prepare-docker-image-ubuntu
|
||||
DOCKER_UBUNTU_VERSION=bionic
|
||||
DOCKER_UBUNTU_ARCH=arm64 # How the architecture is named in a tarball at https://partner-images.canonical.com/core/
|
||||
DOCKER_UBUNTU_QUEMU_ARCH=aarch64 # How the architecture is named in QEMU
|
||||
DOCKER_UBUNTU_TAG_ARCH=arm64 # How the architecture is named in Docker
|
||||
DOCKER_UBUNTU_QEMU_VER=v2.9.1
|
||||
DOCKER_UBUNTU_REPO=multiarch/ubuntu-core
|
||||
|
||||
THREADS=$(grep -c ^processor /proc/cpuinfo || nproc || sysctl -a | grep -F 'hw.ncpu')
|
||||
|
||||
# All scripts should return 0 in case of success, 1 in case of permanent error,
|
||||
# 2 in case of temporary error, any other code in case of permanent error.
|
||||
function die {
|
||||
echo ${1:-Error}
|
||||
exit ${2:1}
|
||||
}
|
||||
|
||||
[[ $EUID -ne 0 ]] && SUDO=sudo
|
||||
|
||||
command -v apt-get && $SUDO apt-get update
|
||||
|
||||
# Configuration parameters may be overriden with CONFIG environment variable pointing to config file.
|
||||
[[ -n "$CONFIG" ]] && source $CONFIG
|
||||
|
||||
mkdir -p $WORKSPACE
|
||||
|
||||
fi
|
21
ci/docker-multiarch/LICENSE
Normal file
21
ci/docker-multiarch/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Multiarch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
53
ci/docker-multiarch/README.md
Normal file
53
ci/docker-multiarch/README.md
Normal file
@ -0,0 +1,53 @@
|
||||
Source: https://github.com/multiarch/ubuntu-core
|
||||
Commit: 3972a7794b40a965615abd710759d3ed439c9a55
|
||||
|
||||
# :earth_africa: ubuntu-core
|
||||
|
||||
![](https://raw.githubusercontent.com/multiarch/dockerfile/master/logo.jpg)
|
||||
|
||||
Multiarch Ubuntu images for Docker.
|
||||
|
||||
Based on https://github.com/tianon/docker-brew-ubuntu-core/
|
||||
|
||||
* `multiarch/ubuntu-core` on [Docker Hub](https://hub.docker.com/r/multiarch/ubuntu-core/)
|
||||
* [Available tags](https://hub.docker.com/r/multiarch/ubuntu-core/tags/)
|
||||
|
||||
## Usage
|
||||
|
||||
Once you need to configure binfmt-support on your Docker host.
|
||||
This works locally or remotely (i.e using boot2docker or swarm).
|
||||
|
||||
```console
|
||||
# configure binfmt-support on the Docker host (works locally or remotely, i.e: using boot2docker)
|
||||
$ docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||
```
|
||||
|
||||
Then you can run an `armhf` image from your `x86_64` Docker host.
|
||||
|
||||
```console
|
||||
$ docker run -it --rm multiarch/ubuntu-core:armhf-wily
|
||||
root@a0818570f614:/# uname -a
|
||||
Linux a0818570f614 4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015 armv7l armv7l armv7l GNU/Linux
|
||||
root@a0818570f614:/# exit
|
||||
```
|
||||
|
||||
Or an `x86_64` image from your `x86_64` Docker host, directly, without qemu emulation.
|
||||
|
||||
```console
|
||||
$ docker run -it --rm multiarch/ubuntu-core:amd64-wily
|
||||
root@27fe384370c9:/# uname -a
|
||||
Linux 27fe384370c9 4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
|
||||
root@27fe384370c9:/#
|
||||
```
|
||||
|
||||
It also works for `arm64`
|
||||
|
||||
```console
|
||||
$ docker run -it --rm multiarch/ubuntu-core:arm64-wily
|
||||
root@723fb9f184fa:/# uname -a
|
||||
Linux 723fb9f184fa 4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015 aarch64 aarch64 aarch64 GNU/Linux
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
96
ci/docker-multiarch/update.sh
Executable file
96
ci/docker-multiarch/update.sh
Executable file
@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
# A POSIX variable
|
||||
OPTIND=1 # Reset in case getopts has been used previously in the shell.
|
||||
|
||||
while getopts "a:v:q:u:d:t:" opt; do
|
||||
case "$opt" in
|
||||
a) ARCH=$OPTARG
|
||||
;;
|
||||
v) VERSION=$OPTARG
|
||||
;;
|
||||
q) QEMU_ARCH=$OPTARG
|
||||
;;
|
||||
u) QEMU_VER=$OPTARG
|
||||
;;
|
||||
d) DOCKER_REPO=$OPTARG
|
||||
;;
|
||||
t) TAG_ARCH=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
thisTarBase="ubuntu-$VERSION-core-cloudimg-$ARCH"
|
||||
thisTar="$thisTarBase-root.tar.gz"
|
||||
baseUrl="https://partner-images.canonical.com/core/$VERSION"
|
||||
|
||||
|
||||
# install qemu-user-static
|
||||
if [ -n "${QEMU_ARCH}" ]; then
|
||||
if [ ! -f x86_64_qemu-${QEMU_ARCH}-static.tar.gz ]; then
|
||||
wget -N https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VER}/x86_64_qemu-${QEMU_ARCH}-static.tar.gz
|
||||
fi
|
||||
tar -xvf x86_64_qemu-${QEMU_ARCH}-static.tar.gz -C $ROOTFS/usr/bin/
|
||||
fi
|
||||
|
||||
|
||||
# get the image
|
||||
if \
|
||||
wget -q --spider "$baseUrl/current" \
|
||||
&& wget -q --spider "$baseUrl/current/$thisTar" \
|
||||
; then
|
||||
baseUrl+='/current'
|
||||
fi
|
||||
wget -qN "$baseUrl/"{{MD5,SHA{1,256}}SUMS{,.gpg},"$thisTarBase.manifest",'unpacked/build-info.txt'} || true
|
||||
wget -N "$baseUrl/$thisTar"
|
||||
|
||||
# check checksum
|
||||
if [ -f SHA256SUMS ]; then
|
||||
sha256sum="$(sha256sum "$thisTar" | cut -d' ' -f1)"
|
||||
if ! grep -q "$sha256sum" SHA256SUMS; then
|
||||
echo >&2 "error: '$thisTar' has invalid SHA256"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cat > Dockerfile <<-EOF
|
||||
FROM scratch
|
||||
ADD $thisTar /
|
||||
ENV ARCH=${ARCH} UBUNTU_SUITE=${VERSION} DOCKER_REPO=${DOCKER_REPO}
|
||||
EOF
|
||||
|
||||
# add qemu-user-static binary
|
||||
if [ -n "${QEMU_ARCH}" ]; then
|
||||
cat >> Dockerfile <<EOF
|
||||
|
||||
# Add qemu-user-static binary for amd64 builders
|
||||
ADD x86_64_qemu-${QEMU_ARCH}-static.tar.gz /usr/bin
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >> Dockerfile <<-EOF
|
||||
# a few minor docker-specific tweaks
|
||||
# see https://github.com/docker/docker/blob/master/contrib/mkimage/debootstrap
|
||||
RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \\
|
||||
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \\
|
||||
&& chmod +x /usr/sbin/policy-rc.d \\
|
||||
&& dpkg-divert --local --rename --add /sbin/initctl \\
|
||||
&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \\
|
||||
&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \\
|
||||
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \\
|
||||
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean \\
|
||||
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \\
|
||||
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \\
|
||||
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages \\
|
||||
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes
|
||||
|
||||
# enable the universe
|
||||
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
|
||||
|
||||
# overwrite this with 'CMD []' in a dependent Dockerfile
|
||||
CMD ["/bin/bash"]
|
||||
EOF
|
||||
|
||||
docker build -t "${DOCKER_REPO}:${TAG_ARCH}-${VERSION}" .
|
||||
docker run --rm "${DOCKER_REPO}:${TAG_ARCH}-${VERSION}" /bin/bash -ec "echo Hello from Ubuntu!"
|
18
ci/get-sources.sh
Executable file
18
ci/get-sources.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
if [[ "$SOURCES_METHOD" == "clone" ]]; then
|
||||
$SUDO apt-get install -y git
|
||||
SOURCES_DIR="${WORKSPACE}/sources"
|
||||
mkdir -p "${SOURCES_DIR}"
|
||||
git clone --recursive --branch "$SOURCES_BRANCH" "$SOURCES_CLONE_URL" "${SOURCES_DIR}"
|
||||
pushd "${SOURCES_DIR}"
|
||||
git checkout "$SOURCES_COMMIT"
|
||||
popd
|
||||
elif [[ "$SOURCES_METHOD" == "local" ]]; then
|
||||
ln -f -s "${PROJECT_ROOT}" "${WORKSPACE}/sources"
|
||||
else
|
||||
die "Unknown SOURCES_METHOD"
|
||||
fi
|
29
ci/install-compiler-from-packages.sh
Executable file
29
ci/install-compiler-from-packages.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
# TODO Non debian systems
|
||||
# TODO Install from PPA on older Ubuntu
|
||||
|
||||
if [ -f '/etc/lsb-release' ]; then
|
||||
source /etc/lsb-release
|
||||
if [[ "$DISTRIB_ID" == "Ubuntu" ]]; then
|
||||
if [[ "$COMPILER" == "gcc" ]]; then
|
||||
$SUDO apt-get -y install gcc-${COMPILER_PACKAGE_VERSION} g++-${COMPILER_PACKAGE_VERSION}
|
||||
export CC=gcc-${COMPILER_PACKAGE_VERSION}
|
||||
export CXX=g++-${COMPILER_PACKAGE_VERSION}
|
||||
elif [[ "$COMPILER" == "clang" ]]; then
|
||||
[[ $(uname -m) == "x86_64" ]] && LLD="lld-${COMPILER_PACKAGE_VERSION}"
|
||||
$SUDO apt-get -y install clang-${COMPILER_PACKAGE_VERSION} "$LLD" libc++-dev libc++abi-dev
|
||||
export CC=clang-${COMPILER_PACKAGE_VERSION}
|
||||
export CXX=clang++-${COMPILER_PACKAGE_VERSION}
|
||||
else
|
||||
die "Unknown compiler specified"
|
||||
fi
|
||||
else
|
||||
die "Unknown Linux variant"
|
||||
fi
|
||||
else
|
||||
die "Unknown OS"
|
||||
fi
|
12
ci/install-compiler-from-sources.sh
Executable file
12
ci/install-compiler-from-sources.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
if [[ "$COMPILER" == "gcc" ]]; then
|
||||
. build-gcc-from-sources.sh
|
||||
elif [[ "$COMPILER" == "clang" ]]; then
|
||||
. build-clang-from-sources.sh
|
||||
else
|
||||
die "Unknown COMPILER"
|
||||
fi
|
12
ci/install-libraries.sh
Executable file
12
ci/install-libraries.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
# TODO Non-debian systems
|
||||
|
||||
$SUDO apt-get -y install libssl-dev libicu-dev libreadline-dev libmysqlclient-dev unixodbc-dev
|
||||
|
||||
if [[ "$ENABLE_EMBEDDED_COMPILER" == 1 && "$USE_LLVM_LIBRARIES_FROM_SYSTEM" == 1 ]]; then
|
||||
$SUDO apt-get -y install liblld-5.0-dev libclang-5.0-dev
|
||||
fi
|
12
ci/jobs/quick-build/config
Normal file
12
ci/jobs/quick-build/config
Normal file
@ -0,0 +1,12 @@
|
||||
SOURCES_METHOD=local
|
||||
COMPILER=clang
|
||||
COMPILER_INSTALL_METHOD=packages
|
||||
COMPILER_PACKAGE_VERSION=6.0
|
||||
USE_LLVM_LIBRARIES_FROM_SYSTEM=0
|
||||
BUILD_METHOD=normal
|
||||
BUILD_TARGETS=clickhouse
|
||||
BUILD_TYPE=Debug
|
||||
ENABLE_EMBEDDED_COMPILER=0
|
||||
CMAKE_FLAGS="-D CMAKE_C_FLAGS_ADD=-g0 -D CMAKE_CXX_FLAGS_ADD=-g0 -D ENABLE_TCMALLOC=0 -D ENABLE_CAPNP=0 -D ENABLE_RDKAFKA=0 -D ENABLE_UNWIND=0 -D ENABLE_ICU=0"
|
||||
|
||||
# TODO it doesn't build with -D ENABLE_NETSSL=0 -D ENABLE_MONGODB=0 -D ENABLE_MYSQL=0 -D ENABLE_DATA_ODBC=0
|
18
ci/jobs/quick-build/run.sh
Executable file
18
ci/jobs/quick-build/run.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
# How to run:
|
||||
# From "ci" directory:
|
||||
# jobs/quick-build/run.sh
|
||||
# or:
|
||||
# ./run-with-docker.sh ubuntu:bionic jobs/quick-build/run.sh
|
||||
|
||||
CONFIG="$(dirname $0)"/config
|
||||
cd "$(dirname $0)"/../..
|
||||
|
||||
. default-config
|
||||
|
||||
. get-sources.sh
|
||||
. prepare-toolchain.sh
|
||||
. install-libraries.sh
|
||||
. build-normal.sh
|
23
ci/prepare-docker-image-ubuntu.sh
Executable file
23
ci/prepare-docker-image-ubuntu.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
./check-docker.sh
|
||||
|
||||
# http://fl47l1n3.net/2015/12/24/binfmt/
|
||||
$SUDO apt-get -y install qemu-user-static
|
||||
|
||||
pushd docker-multiarch
|
||||
|
||||
$SUDO ./update.sh \
|
||||
-a "$DOCKER_UBUNTU_ARCH" \
|
||||
-v "$DOCKER_UBUNTU_VERSION" \
|
||||
-q "$DOCKER_UBUNTU_QUEMU_ARCH" \
|
||||
-u "$DOCKER_UBUNTU_QEMU_VER" \
|
||||
-d "$DOCKER_UBUNTU_REPO" \
|
||||
-t "$DOCKER_UBUNTU_TAG_ARCH"
|
||||
|
||||
docker run --rm --privileged multiarch/qemu-user-static:register
|
||||
|
||||
popd
|
14
ci/prepare-toolchain.sh
Executable file
14
ci/prepare-toolchain.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
apt-cache search cmake3 | grep -P '^cmake3 ' && $SUDO apt-get -y install cmake3 || $SUDO apt-get -y install cmake
|
||||
|
||||
if [[ "$COMPILER_INSTALL_METHOD" == "packages" ]]; then
|
||||
. install-compiler-from-packages.sh;
|
||||
elif [[ "$COMPILER_INSTALL_METHOD" == "sources" ]]; then
|
||||
. install-compiler-from-sources.sh
|
||||
else
|
||||
die "Unknown COMPILER_INSTALL_METHOD"
|
||||
fi
|
13
ci/prepare-vagrant-image-freebsd.sh
Executable file
13
ci/prepare-vagrant-image-freebsd.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
source default-config
|
||||
|
||||
$SUDO apt-get -y install vagrant virtualbox
|
||||
|
||||
pushd "vagrant-freebsd"
|
||||
vagrant up
|
||||
vagrant ssh-config > vagrant-ssh
|
||||
ssh -F vagrant-ssh default 'uname -a'
|
||||
scp -F vagrant-ssh -r ../../ci default:~
|
||||
popd
|
18
ci/run-clickhouse-from-binaries.sh
Executable file
18
ci/run-clickhouse-from-binaries.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
# Usage example:
|
||||
# ./run-with-docker.sh centos:centos6 ./run-clickhouse-from-binaries.sh
|
||||
|
||||
source default-config
|
||||
|
||||
SERVER_BIN="${WORKSPACE}/build/dbms/src/Server/clickhouse"
|
||||
SERVER_CONF="${WORKSPACE}/sources/dbms/src/Server/config.xml"
|
||||
SERVER_DATADIR="${WORKSPACE}/clickhouse"
|
||||
|
||||
[[ -x "$SERVER_BIN" ]] || die "Run build-normal.sh first"
|
||||
[[ -r "$SERVER_CONF" ]] || die "Run get-sources.sh first"
|
||||
|
||||
mkdir -p "${SERVER_DATADIR}"
|
||||
|
||||
$SERVER_BIN server --config-file "$SERVER_CONF" --pid-file="${WORKSPACE}/clickhouse.pid" -- --path "$SERVER_DATADIR"
|
6
ci/run-with-docker.sh
Executable file
6
ci/run-with-docker.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -x
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "$0")/.."; pwd -P)"
|
||||
[[ -n "$CONFIG" ]] && DOCKER_ENV="--env=CONFIG"
|
||||
docker run -t --network=host --mount=type=bind,source=${PROJECT_ROOT},destination=/ClickHouse --workdir=/ClickHouse/ci $DOCKER_ENV "$1" "$2"
|
1
ci/vagrant-freebsd/.gitignore
vendored
Normal file
1
ci/vagrant-freebsd/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.vagrant
|
3
ci/vagrant-freebsd/Vagrantfile
vendored
Normal file
3
ci/vagrant-freebsd/Vagrantfile
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "generic/freebsd11"
|
||||
end
|
@ -3,7 +3,7 @@ FROM ubuntu:17.10
|
||||
RUN apt-get update -y && \
|
||||
apt-get install -y \
|
||||
cmake pkg-config gcc-7 g++-7 \
|
||||
liblld-5.0-dev libclang-5.0-dev liblld-5.0 \
|
||||
liblld-5.0-dev libclang-5.0-dev \
|
||||
libssl-dev libicu-dev libreadline-dev libmysqlclient-dev unixodbc-dev
|
||||
# For tests: bash expect python python-lxml python-termcolor curl perl sudo tzdata
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
BRANCH=trunk
|
||||
#BRANCH=tags/RELEASE_500/final
|
||||
|
||||
THREADS=$(grep -c ^processor /proc/cpuinfo)
|
||||
|
||||
cd ~
|
||||
sudo apt-get install -y subversion cmake
|
||||
|
||||
mkdir llvm
|
||||
cd llvm
|
||||
svn co "http://llvm.org/svn/llvm-project/llvm/${BRANCH}" llvm
|
||||
|
||||
cd llvm/tools
|
||||
svn co "http://llvm.org/svn/llvm-project/cfe/${BRANCH}" clang
|
||||
svn co "http://llvm.org/svn/llvm-project/lld/${BRANCH}" lld
|
||||
svn co "http://llvm.org/svn/llvm-project/polly/${BRANCH}" polly
|
||||
|
||||
cd clang/tools
|
||||
svn co "http://llvm.org/svn/llvm-project/clang-tools-extra/${BRANCH}" extra
|
||||
|
||||
git clone https://github.com/include-what-you-use/include-what-you-use.git
|
||||
echo 'add_subdirectory(include-what-you-use)' >> CMakeLists.txt
|
||||
sudo apt-get install libncurses5-dev
|
||||
|
||||
cd ../../../..
|
||||
cd llvm/projects/
|
||||
svn co "http://llvm.org/svn/llvm-project/compiler-rt/${BRANCH}" compiler-rt
|
||||
svn co "http://llvm.org/svn/llvm-project/libcxx/${BRANCH}" libcxx
|
||||
svn co "http://llvm.org/svn/llvm-project/libcxxabi/${BRANCH}" libcxxabi
|
||||
|
||||
cd ../..
|
||||
mkdir build
|
||||
cd build/
|
||||
|
||||
# NOTE You must build LLVM with the same ABI as ClickHouse.
|
||||
# For example, if you compile ClickHouse with libc++, you must add
|
||||
# -D LLVM_ENABLE_LIBCXX=1
|
||||
# to the line below.
|
||||
|
||||
cmake -D CMAKE_BUILD_TYPE:STRING=Release ../llvm
|
||||
|
||||
make -j $THREADS
|
||||
sudo make install
|
||||
hash clang
|
@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
sudo apt-get install -y curl
|
||||
|
||||
VERSION=$(curl -sSL https://ftpmirror.gnu.org/gcc/ | grep -oE 'gcc-[0-9]+(\.[0-9]+)+' | sort -Vr | head -n1) #'
|
||||
#VERSION=gcc-7.1.0
|
||||
|
||||
VERSION_SHORT=$(echo "$VERSION" | grep -oE '[0-9]' | head -n1)
|
||||
|
||||
echo "Will download ${VERSION} (short version: $VERSION_SHORT)."
|
||||
|
||||
THREADS=$(grep -c ^processor /proc/cpuinfo)
|
||||
|
||||
cd ~
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
|
||||
wget https://ftpmirror.gnu.org/gcc/${VERSION}/${VERSION}.tar.xz
|
||||
tar xf ${VERSION}.tar.xz
|
||||
cd ${VERSION}
|
||||
./contrib/download_prerequisites
|
||||
cd ..
|
||||
mkdir gcc-build
|
||||
cd gcc-build
|
||||
../${VERSION}/configure --enable-languages=c,c++ --disable-multilib
|
||||
make -j $THREADS
|
||||
sudo make install
|
||||
|
||||
sudo ln -sf /usr/local/bin/gcc /usr/local/bin/gcc-${VERSION_SHORT}
|
||||
sudo ln -sf /usr/local/bin/g++ /usr/local/bin/g++-${VERSION_SHORT}
|
||||
sudo ln -sf /usr/local/bin/gcc /usr/local/bin/cc
|
||||
sudo ln -sf /usr/local/bin/g++ /usr/local/bin/c++
|
||||
|
||||
echo "/usr/local/lib64" | sudo tee /etc/ld.so.conf.d/10_local-lib64.conf
|
||||
sudo ldconfig
|
||||
|
||||
hash gcc g++
|
||||
gcc --version
|
Loading…
Reference in New Issue
Block a user