simdjson/.circleci/config.yml

193 lines
6.4 KiB
YAML

version: 2.1
# Reusable image / compiler definitions
executors:
gcc7:
docker:
- image: gcc:7
environment:
CXX: g++
BUILD_FLAGS: -j
CTEST_FLAGS: -j4 --output-on-failure
gcc8:
docker:
- image: gcc:8
environment:
CXX: g++
BUILD_FLAGS: -j
CTEST_FLAGS: -j4 --output-on-failure
gcc9:
docker:
- image: gcc:9
environment:
CXX: g++
BUILD_FLAGS: -j
CTEST_FLAGS: -j4 --output-on-failure
clang6:
docker:
- image: ubuntu:18.04
environment:
CXX: clang++-6.0
BUILD_FLAGS: -j
CTEST_FLAGS: -j4 --output-on-failure
# Reusable test commands (and initializer for clang 6)
commands:
init_clang6:
steps:
- run: apt-get update -qq
- run: apt-get install -y clang build-essential git
make_test:
steps:
- checkout
- run: make $BUILD_FLAGS
- run: ./json2json -h # Print out the implementation we're using on this hardware
- run: make amalgamate
- run: make test
- run: make checkperf
cmake_prep:
steps:
- run: apt-get update -qq
- run: apt-get install -y cmake
- checkout
cmake_build:
steps:
- cmake_prep
- run: cmake $CMAKE_FLAGS -DCMAKE_INSTALL_PREFIX:PATH=destination .
- run: make $BUILD_FLAGS all
- run: tools/json2json -h # Print out the implementation we're using on this hardware
cmake_test:
steps:
- cmake_build
- run: ctest $CTEST_FLAGS -L acceptance
- run: ctest $CTEST_FLAGS -LE acceptance -E checkperf
cmake_test_all:
steps:
- cmake_build
- run: ctest $CTEST_FLAGS -L acceptance -LE per_implementation
- run: SIMDJSON_FORCE_IMPLEMENTATION=haswell ctest $CTEST_FLAGS -L per_implementation
- run: SIMDJSON_FORCE_IMPLEMENTATION=westmere ctest $CTEST_FLAGS -L per_implementation
- run: SIMDJSON_FORCE_IMPLEMENTATION=fallback ctest $CTEST_FLAGS -L per_implementation
- run: ctest $CTEST_FLAGS -LE "acceptance|per_implementation" # Everything we haven't run yet, run now.
# we not only want cmake to build and run tests, but we want also a successful installation from which we can build, link and run programs
cmake_install_test: # this version builds, install, test and then verify from the installation
steps:
- run: make install
- run: echo -e '#include <simdjson.h>\nint main(int argc,char**argv) {simdjson::dom::parser parser;simdjson::dom::element tweets = parser.load(argv[1]); }' > tmp.cpp && c++ -Idestination/include -Ldestination/lib -std=c++17 -Wl,-rpath,destination/lib -o linkandrun tmp.cpp -lsimdjson && ./linkandrun jsonexamples/twitter.json
jobs:
# static
gcc7:
description: Build and run tests on GCC 7 and AVX 2 with a cmake static build
executor: gcc7
environment: { CMAKE_FLAGS: -DSIMDJSON_GOOGLE_BENCHMARKS=ON }
steps: [ cmake_test_all, cmake_install_test ]
clang6:
description: Build and run tests on clang 6 and AVX 2 with a cmake static build
executor: clang6
environment: { CMAKE_FLAGS: -DSIMDJSON_GOOGLE_BENCHMARKS=ON }
steps: [ init_clang6, cmake_test_all, cmake_install_test ]
# sanitize
sanitize-gcc9:
description: Build and run tests on GCC 9 and AVX 2 with a cmake sanitize build
executor: gcc9
environment: { CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_SANITIZE=ON, CTEST_FLAGS: -j4 --output-on-failure -E checkperf }
steps: [ cmake_test_all ]
sanitize-clang6:
description: Build and run tests on clang 6 and AVX 2 with a cmake sanitize build
executor: clang6
environment: { CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_SANITIZE=ON, CTEST_FLAGS: -j4 --output-on-failure -E checkperf }
steps: [ init_clang6, cmake_test_all ]
# dynamic
dynamic-gcc7:
description: Build and run tests on GCC 7 and AVX 2 with a cmake dynamic build
executor: gcc7
environment: { CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF }
steps: [ cmake_test, cmake_install_test ]
dynamic-clang6:
description: Build and run tests on clang 6 and AVX 2 with a cmake dynamic build
executor: clang6
environment: { CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF }
steps: [ init_clang6, cmake_test, cmake_install_test ]
# unthreaded
unthreaded-gcc7:
description: Build and run tests on GCC 7 and AVX 2 *without* threads
executor: gcc7
environment: { CMAKE_FLAGS: -DSIMDJSON_ENABLE_THREADS=OFF }
steps: [ cmake_test, cmake_install_test ]
unthreaded-clang6:
description: Build and run tests on Clang 6 and AVX 2 *without* threads
executor: clang6
environment: { CMAKE_FLAGS: -DSIMDJSON_ENABLE_THREADS=OFF }
steps: [ init_clang6, cmake_test, cmake_install_test ]
# noexcept
noexcept-gcc7:
description: Build and run tests on GCC 7 and AVX 2 with exceptions off
executor: gcc7
environment: { CMAKE_FLAGS: -DSIMDJSON_EXCEPTIONS=OFF }
steps: [ cmake_test, cmake_install_test ]
noexcept-clang6:
description: Build and run tests on GCC 7 and AVX 2 with exceptions off
executor: clang6
environment: { CMAKE_FLAGS: -DSIMDJSON_EXCEPTIONS=OFF }
steps: [ init_clang6, cmake_test, cmake_install_test ]
#
# Misc.
#
# make (test and checkperf)
arch-haswell-gcc7:
description: Build, run tests and check performance on GCC 7 with -march=haswell
executor: gcc7
environment: { ARCHFLAGS: -march=haswell }
steps: [ make_test ]
arch-nehalem-gcc7:
description: Build, run tests and check performance on GCC 7 with -march=nehalem
executor: gcc7
environment: { ARCHFLAGS: -march=nehalem }
steps: [ make_test ]
no-computed-goto-gcc7:
description: Build, run tests and check performance on GCC 7 with -DSIMDJSON_NO_COMPUTED_GOTO=true
executor: gcc7
environment: { EXTRAFLAGS: -DSIMDJSON_NO_COMPUTED_GOTO=true }
steps: [ make_test ]
workflows:
version: 2.1
build_and_test:
jobs:
# full multi-implementation tests
- gcc7
- clang6
# full single-implementation tests
- sanitize-gcc9
- sanitize-clang6
- dynamic-gcc7
- dynamic-clang6
- unthreaded-gcc7
- unthreaded-clang6
# quicker make single-implementation tests
- arch-haswell-gcc7
- arch-nehalem-gcc7
- no-computed-goto-gcc7
# TODO add windows: https://circleci.com/docs/2.0/configuration-reference/#windows