libcryfs/.circleci/config.yml

498 lines
15 KiB
YAML
Raw Normal View History

2017-09-11 15:38:08 +02:00
version: 2.0
references:
container_config: &container_config
machine: true
2017-09-12 22:36:18 +02:00
cache_init: &cache_init
run:
name: Initialize Cache
command: |
2017-10-01 23:14:01 +02:00
echo "${APT_COMPILER_PACKAGE}_${BUILD_TOOLSET}_${CXX}_${CC}_${BUILD_TYPE}_${CXXFLAGS}" > /tmp/_build_env_vars
2017-09-12 22:36:18 +02:00
echo Build env vars used for cache keys:
cat /tmp/_build_env_vars
container_setup_pre: &container_setup_pre
restore_cache:
keys:
# Find the most recent cache from any branch
- v4_container_setup_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
container_setup_post: &container_setup_post
save_cache:
# Add _aptcache_contents to cache key so that it is re-uploaded each time the cache changes.
key: v4_container_setup_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}_{{ checksum "/tmp/_aptcache_contents" }}
2017-09-12 22:36:18 +02:00
paths:
- /tmp/aptcache
2017-09-11 15:38:08 +02:00
container_setup: &container_setup
run:
name: Setup Environment
command: |
2017-09-12 22:36:18 +02:00
if [ -d "/tmp/aptcache" ]; then
echo Using packages from apt cache
sudo cp -R /tmp/aptcache/* /var/cache/apt/archives/
else
echo No apt cache found
fi
2017-09-11 23:40:41 +02:00
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo touch /etc/apt/sources.list.d/clang.list
sudo chmod o+w /etc/apt/sources.list.d/clang.list
cat > /etc/apt/sources.list.d/clang.list << EOF
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main
2017-09-11 23:40:41 +02:00
EOF
sudo chmod o-w /etc/apt/sources.list.d/clang.list
2017-09-11 15:38:08 +02:00
DEBIAN_FRONTEND=noninteractive sudo apt-get update -qq
2018-05-21 00:08:28 +02:00
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y git ccache $APT_COMPILER_PACKAGE cmake3 make libcurl4-openssl-dev libssl-dev libfuse-dev python
2017-09-11 16:25:56 +02:00
# Use /dev/urandom when /dev/random is accessed to use less entropy
sudo cp -a /dev/urandom /dev/random
2017-09-11 23:40:41 +02:00
if [ "${BUILD_TOOLSET}" = "clang" ]; then
# They aren't set automatically unfortunately
sudo ln -s /usr/bin/$CC /usr/bin/clang
sudo ln -s /usr/bin/$CXX /usr/bin/clang++
# Need a c++14 compliant STL for clang
sudo apt-get install g++-5
sudo apt-get remove g++-4.8 gcc-4.8
fi
2017-09-12 22:36:18 +02:00
# Setup ccache
sudo ln -s /usr/bin/ccache /usr/local/bin/$CC
sudo ln -s /usr/bin/ccache /usr/local/bin/$CXX
sudo mkdir /ccache_data
sudo chown circleci:circleci /ccache_data
echo 'export CCACHE_COMPILERCHECK=content' >> $BASH_ENV
echo 'export CCACHE_COMPRESS=1' >> $BASH_ENV
echo 'export CCACHE_DIR=/ccache_data' >> $BASH_ENV
echo 'export CCACHE_SLOPPINESS=include_file_mtime' >> $BASH_ENV
sudo mkdir -p /tmp/aptcache
sudo cp -R /var/cache/apt/archives/* /tmp/aptcache/
ls /tmp/aptcache > /tmp/_aptcache_contents
2017-09-12 22:36:18 +02:00
2017-09-11 23:40:41 +02:00
echo
echo System Info:
cat /etc/issue
uname -a
cmake --version
2017-09-12 22:36:18 +02:00
/usr/local/bin/$CC --version
/usr/local/bin/$CXX --version
upgrade_boost_pre: &upgrade_boost_pre
restore_cache:
keys:
# Find the most recent cache from any branch
- v2_upgrade_boost_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
upgrade_boost_post: &upgrade_boost_post
save_cache:
key: v2_upgrade_boost_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
paths:
- /tmp/boost_1_56_0
2017-09-11 15:38:08 +02:00
upgrade_boost: &upgrade_boost
run:
name: Upgrade Boost
command: |
# Detect number of CPU cores
export NUMCORES=`nproc`
echo Using $NUMCORES cores
2017-09-12 22:36:18 +02:00
# Download and prepare boost (only if not already present from cache)
if [ ! -d "/tmp/boost_1_56_0" ]; then
echo "Didn't find boost in cache. Downloading and building."
wget -O /tmp/boost.tar.bz2 https://sourceforge.net/projects/boost/files/boost/1.56.0/boost_1_56_0.tar.bz2/download
if [ $(sha512sum /tmp/boost.tar.bz2 | awk '{print $1;}') == "1ce9871c3a2519682538a5f1331938b948123432d99aea0ce026958cbebd25d84019a3a28c452724b9693df98a8d1264bb2d93d2fee508453f8b42836e67481e" ]; then
echo Correct sha512sum
else
echo Wrong sha512sum
sha512sum boost.tar.bz2
exit 1
fi
echo Extracting...
tar -xf /tmp/boost.tar.bz2 -C /tmp
rm -rf boost.tar.bz2
cd /tmp/boost_1_56_0
./bootstrap.sh --with-toolset=${BUILD_TOOLSET} --with-libraries=filesystem,thread,chrono,program_options
cd ..
2017-09-11 15:38:08 +02:00
else
2017-09-12 22:36:18 +02:00
echo Found boost in cache. Use cache and build.
2017-09-11 15:38:08 +02:00
fi
2017-09-12 22:36:18 +02:00
# Compile and install boost (if cached, this should be fast)
cd /tmp/boost_1_56_0
2017-09-11 23:40:41 +02:00
sudo ./b2 toolset=${BUILD_TOOLSET} link=static cxxflags=-fPIC -d0 -j$NUMCORES install
2017-09-12 22:36:18 +02:00
build_pre: &build_pre
restore_cache:
keys:
# Find most recent cache from any revision on the same branch (cache keys are prefix matched)
# CIRCLE_PR_NUMBER is only set if this is a pull request.
- v3_build_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}_{{ .Branch }}_{{ .Environment.CIRCLE_PR_NUMBER }}
# Fallback to less specific caches if the one above wasn't found
- v3_build_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}_{{ .Branch }}
- v3_build_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
build_post: &build_post
save_cache:
key: v3_build_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}_{{ .Branch }}_{{ .Environment.CIRCLE_PR_NUMBER }}_{{ .Revision }}
paths:
- /ccache_data
2017-09-11 23:40:41 +02:00
build: &build
run:
name: Build
command: |
export NUMCORES=`nproc` && if [ ! -n "$NUMCORES" ]; then export NUMCORES=`sysctl -n hw.ncpu`; fi
echo Using $NUMCORES cores
2017-09-12 22:36:18 +02:00
# Use ccache
export CXX=/usr/local/bin/$CXX
export CC=/usr/local/bin/$CC
ccache --max-size=512M
ccache --show-stats
2018-05-21 17:09:37 +02:00
# Disable OpenMP if it is clang, because Ubuntu 14.04 doesn't have the libomp-dev package needed to support OpenMP for clang.
if [[ ${APT_COMPILER_PACKAGE} == clang* ]]; then
OPENMP_PARAMS="-DDISABLE_OPENMP=ON"
else
OPENMP_PARAMS=""
fi
2017-09-12 22:36:18 +02:00
# Build
2017-09-11 23:40:41 +02:00
mkdir cmake
cd cmake
2018-09-30 05:41:46 +02:00
cmake .. -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${OPENMP_PARAMS} ${CMAKE_FLAGS}
2017-09-11 23:40:41 +02:00
make -j$NUMCORES
2017-09-12 22:36:18 +02:00
ccache --show-stats
2017-09-11 23:40:41 +02:00
test: &test
run:
name: Test
2018-05-03 09:47:51 +02:00
no_output_timeout: 120m
2017-09-11 23:40:41 +02:00
command: |
2018-09-30 09:33:09 +02:00
if "${RUN_TESTS}"; then
cd cmake
./test/gitversion/gitversion-test
if [ ! "$DISABLE_BROKEN_TSAN_TESTS" = true ] ; then ./test/cpp-utils/cpp-utils-test ; fi
2018-09-30 19:11:46 +02:00
if [ ! "$DISABLE_BROKEN_TSAN_TESTS" = true ] ; then ./test/fspp/fspp-test ; fi
2018-09-30 09:33:09 +02:00
./test/parallelaccessstore/parallelaccessstore-test
./test/blockstore/blockstore-test
./test/blobstore/blobstore-test
if [ ! "$DISABLE_BROKEN_TSAN_TESTS" = true ] ; then ./test/cryfs/cryfs-test ; fi
if [ ! "$DISABLE_BROKEN_TSAN_TESTS" = true ] ; then ./test/cryfs-cli/cryfs-cli-test ; fi
fi
2017-09-11 23:40:41 +02:00
job_definition: &job_definition
2017-09-11 15:38:08 +02:00
<<: *container_config
steps:
2017-09-12 22:36:18 +02:00
- <<: *cache_init
- <<: *container_setup_pre
2017-09-11 23:40:41 +02:00
- <<: *container_setup
2017-09-12 22:36:18 +02:00
- <<: *container_setup_post
- <<: *upgrade_boost_pre
2017-09-11 23:40:41 +02:00
- <<: *upgrade_boost
2017-09-12 22:36:18 +02:00
- <<: *upgrade_boost_post
2017-09-11 23:40:41 +02:00
- checkout
2017-09-12 22:36:18 +02:00
- <<: *build_pre
2017-09-11 23:40:41 +02:00
- <<: *build
2017-09-12 22:36:18 +02:00
- <<: *build_post
2017-09-11 23:40:41 +02:00
- <<: *test
enable_for_tags: &enable_for_tags
filters:
tags:
only: /.*/
jobs:
2017-09-18 21:56:47 +02:00
gcc_5_debug:
<<: *job_definition
environment:
CC: gcc-5
CXX: g++-5
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-5"
CXXFLAGS: ""
2017-09-18 21:56:47 +02:00
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2017-09-18 21:56:47 +02:00
gcc_5_release:
<<: *job_definition
environment:
CC: gcc-5
CXX: g++-5
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-5"
CXXFLAGS: ""
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2017-09-18 21:56:47 +02:00
gcc_6_debug:
<<: *job_definition
environment:
CC: gcc-6
CXX: g++-6
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-6"
CXXFLAGS: ""
2017-09-18 21:56:47 +02:00
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2017-09-18 21:56:47 +02:00
gcc_6_release:
<<: *job_definition
environment:
CC: gcc-6
CXX: g++-6
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-6"
CXXFLAGS: ""
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2017-09-18 21:56:47 +02:00
gcc_7_debug:
<<: *job_definition
environment:
CC: gcc-7
CXX: g++-7
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-7"
CXXFLAGS: ""
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2017-09-18 21:56:47 +02:00
gcc_7_release:
<<: *job_definition
environment:
CC: gcc-7
CXX: g++-7
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-7"
CXXFLAGS: ""
2017-09-18 21:56:47 +02:00
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
gcc_8_debug:
<<: *job_definition
environment:
CC: gcc-8
CXX: g++-8
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-8"
CXXFLAGS: ""
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
gcc_8_release:
<<: *job_definition
environment:
CC: gcc-8
CXX: g++-8
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-8"
CXXFLAGS: ""
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_4_debug:
2017-09-18 21:56:47 +02:00
<<: *job_definition
environment:
CC: clang-4.0
CXX: clang++-4.0
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-4.0
CXXFLAGS: ""
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_4_release:
<<: *job_definition
environment:
CC: clang-4.0
CXX: clang++-4.0
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-4.0
CXXFLAGS: ""
2017-09-18 21:56:47 +02:00
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_5_debug:
<<: *job_definition
environment:
CC: clang-5.0
CXX: clang++-5.0
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-5.0
CXXFLAGS: ""
2017-09-18 21:56:47 +02:00
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_5_release:
2017-09-18 21:56:47 +02:00
<<: *job_definition
environment:
CC: clang-5.0
CXX: clang++-5.0
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-5.0
CXXFLAGS: ""
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_6_debug:
<<: *job_definition
environment:
CC: clang-6.0
CXX: clang++-6.0
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-6.0
CXXFLAGS: ""
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_6_release:
<<: *job_definition
environment:
CC: clang-6.0
CXX: clang++-6.0
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-6.0
CXXFLAGS: ""
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_7_debug:
<<: *job_definition
environment:
CC: clang-7
CXX: clang++-7
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-7
CXXFLAGS: ""
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
clang_7_release:
<<: *job_definition
environment:
CC: clang-7
CXX: clang++-7
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-7
CXXFLAGS: ""
BUILD_TYPE: "Release"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
# clang_werror:
# <<: *job_definition
# environment:
# CC: clang-7
# CXX: clang++-7
# BUILD_TOOLSET: clang
# APT_COMPILER_PACKAGE: clang-7
# CXXFLAGS: "-Werror"
# BUILD_TYPE: "Release"
# CMAKE_FLAGS: ""
# RUN_TESTS: false
gcc_werror:
<<: *job_definition
environment:
CC: gcc-8
CXX: g++-8
BUILD_TOOLSET: gcc
APT_COMPILER_PACKAGE: "g++-8"
CXXFLAGS: "-Werror"
BUILD_TYPE: "Release"
CMAKE_FLAGS: ""
RUN_TESTS: false
no_compatibility:
<<: *job_definition
environment:
CC: clang-7
CXX: clang++-7
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-7
CXXFLAGS: "-DCRYFS_NO_COMPATIBILITY"
2017-09-18 21:56:47 +02:00
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2017-10-02 09:02:55 +02:00
address_sanitizer:
<<: *job_definition
environment:
CC: clang-7
CXX: clang++-7
2017-10-02 09:02:55 +02:00
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-7
2017-10-08 08:10:13 +02:00
CXXFLAGS: "-O2 -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize-address-use-after-scope"
2017-10-02 09:02:55 +02:00
BUILD_TYPE: "Debug"
2018-09-30 03:08:01 +02:00
ASAN_OPTIONS: "detect_leaks=1 check_initialization_order=1 detect_stack_use_after_return=1 detect_invalid_pointer_pairs=1 atexit=1"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2018-09-30 05:31:39 +02:00
ub_sanitizer:
<<: *job_definition
environment:
CC: clang-7
CXX: clang++-7
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-7
CXXFLAGS: "-O2 -fno-sanitize-recover=undefined,nullability,implicit-conversion,unsigned-integer-overflow -fno-omit-frame-pointer -fno-common"
BUILD_TYPE: "Debug"
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2018-05-03 09:47:51 +02:00
thread_sanitizer:
<<: *job_definition
environment:
CC: clang-7
CXX: clang++-7
2018-05-03 09:47:51 +02:00
BUILD_TOOLSET: clang
APT_COMPILER_PACKAGE: clang-7
2018-05-03 09:47:51 +02:00
CXXFLAGS: "-O2 -fsanitize=thread -fno-omit-frame-pointer"
BUILD_TYPE: "Debug"
DISABLE_BROKEN_TSAN_TESTS: true
2018-09-30 05:41:46 +02:00
CMAKE_FLAGS: ""
2018-09-30 09:33:09 +02:00
RUN_TESTS: true
2017-09-11 15:38:08 +02:00
workflows:
version: 2
2017-09-11 23:40:41 +02:00
build_and_test:
2017-09-11 15:38:08 +02:00
jobs:
2017-09-18 21:56:47 +02:00
- gcc_5_debug:
<<: *enable_for_tags
2017-09-18 21:56:47 +02:00
- gcc_5_release:
<<: *enable_for_tags
2017-09-18 21:56:47 +02:00
- gcc_6_debug:
<<: *enable_for_tags
2017-09-18 21:56:47 +02:00
- gcc_6_release:
<<: *enable_for_tags
2017-09-18 21:56:47 +02:00
- gcc_7_debug:
<<: *enable_for_tags
2017-09-18 21:56:47 +02:00
- gcc_7_release:
2017-09-11 23:40:41 +02:00
<<: *enable_for_tags
- gcc_8_debug:
<<: *enable_for_tags
- gcc_8_release:
<<: *enable_for_tags
- clang_4_debug:
<<: *enable_for_tags
- clang_4_release:
<<: *enable_for_tags
- clang_5_debug:
<<: *enable_for_tags
- clang_5_release:
<<: *enable_for_tags
- clang_6_debug:
2017-09-18 21:56:47 +02:00
<<: *enable_for_tags
- clang_6_release:
2017-09-18 21:56:47 +02:00
<<: *enable_for_tags
- clang_7_debug:
2017-09-18 21:56:47 +02:00
<<: *enable_for_tags
- clang_7_release:
2017-09-11 23:40:41 +02:00
<<: *enable_for_tags
2018-09-30 09:33:09 +02:00
# - clang_werror:
# <<: *enable_for_tags
- gcc_werror:
<<: *enable_for_tags
- no_compatibility:
<<: *enable_for_tags
2017-10-02 09:02:55 +02:00
- address_sanitizer:
<<: *enable_for_tags
2018-09-30 05:31:39 +02:00
- ub_sanitizer:
<<: *enable_for_tags
2018-05-03 09:47:51 +02:00
- thread_sanitizer:
<<: *enable_for_tags