From: Michael Wallner Date: Fri, 2 Oct 2020 07:58:06 +0000 (+0200) Subject: github-actions X-Git-Tag: 1.1.0-beta1~236^2~22^2~32 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=fc38ee40136ea17ee4f1fb679042a786cadefba9;p=m6w6%2Flibmemcached github-actions --- diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..17ed7c84 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,29 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{C,c{,c,pp,xx},h{,h,pp,xx}}] +indent_style = space +indent_size = 2 + +[*.yml] +indent_style = space +indent_size = 2 + +[*.{rst,m{,{,ark}d{,own}}}}] +trim_trailing_whitespace = false +indent_style = space +indent_size = 4 + +[{CMake{Lists,Config}.txt,*.cmake}] +indent_style = space +indent_size = 4 + +[{Makefile,*.mk}] +indent_style = tab + + diff --git a/.github/workflows/cmake-build-ci.gen b/.github/workflows/cmake-build-ci.gen new file mode 100755 index 00000000..2d5a6b72 --- /dev/null +++ b/.github/workflows/cmake-build-ci.gen @@ -0,0 +1,221 @@ +#!/usr/bin/env php + "Linux", + "Linux" => "ubuntu-20.04", + "macOS" => "macos-10.15", + "ubuntu-20.04" => "gnu", + "macos-10.15" => "clang", + "gnu" => [ + "ver" => "cur", + "CC" => "gcc", + "CXX" => "g++", + ], + "clang" => [ + "ver" => "", + "CC" => "clang", + "CXX" => "clang++", + ], +]; +const APT = [ + "ubuntu-20.04" => [ + "gnu" => [ + "new" => [ + "CC" => "gcc-10", + "CXX" => "g++-10", + ] + ] + ] +]; +const MAP = [ + 'env.OS_VER' => [ + "ubuntu-20.04" => [ + 'env.CC_VND' => [ + "gnu" => [ + 'env.CC_VER' => [ + "new" => "-10", + "cur" => "-9", + "old" => "-8" + ] + ], + "clang" => [ + 'env.CC_VER' => [ + "new" => "-10", + "cur" => "-9", + "old" => "-8" + ] + ] + ] + ], + "ubuntu-18.04" => [ + 'env.CC_VND' => [ + "gnu" => [ + 'env.CC_VER' => [ + "new" => "-9", + "cur" => "-8", + "old" => "-7" + ] + ], + "clang" => [ + 'env.CC_VER' => [ + "new" => "-9", + "cur" => "-8", + "old" => "-6.0" + ] + ] + ] + ] + ] +]; + +/** + * @var bool $splat_map false = no splat map, null = default splat map, true = full splat map + */ +function steps($splat_map = null) { + if ($splat_map !== false) { + foreach (MAP as $os_is => $os_vers) { + foreach ($os_vers as $os_ver => $cc_vnds_) { + if (!$splat_map && DEF[DEF["os"]] != $os_ver) continue; + foreach ($cc_vnds_ as $cc_vnd_is => $cc_vnds) { + foreach ($cc_vnds as $cc_vnd => $cc_vers_) { + if (!$splat_map && DEF[DEF[DEF["os"]]] != $cc_vnd) continue; + foreach ($cc_vers_ as $cc_ver_is => $cc_vers) { + foreach ($cc_vers as $cc_ver => $ver) { + if (!$splat_map && DEF[DEF[DEF[DEF["os"]]]]["ver"] != $cc_ver) continue; +?> + - name: Prepare environment () + if: () + run: echo CC= >> ${GITHUB_ENV} + run: echo CXX= >> ${GITHUB_ENV} + + run: echo INSTALL_CC='' >> ${GITHUB_ENV} + run: echo INSTALL_CXX='' >> ${GITHUB_ENV} + + - name: Install dependencies + if: runner.os == 'Linux' + run: sudo apt-get install libevent-dev libsasl-dev ${INSTALL_MEMCACHED} ${INSTALL_CC} ${INSTALL_CXX} + - name: Generate build tree (${CMAKE_CONFIG_TYPE}) + run: mkdir build + run: cmake -S . -B build + - name: Build all with ${CXX} ${CXXFLAGS} + run: make -C build -j2 all + - name: Test + run: make -C build -j2 test + - name: Install + run: make -C build -j2 install DESTDIR=. + - name: Failed tests log + if: ${{ failure() }} + run: cat Testing/Temporary/LastTest.log + +name: cmake-build-ci +on: + push: + paths-ignore: + - "docs/**" + branches-ignore: + - gh-pages + - v1.x + pull_request: + branches: + - master + - v1.x +env: + # defaults + INSTALL_MEMCACHED: memcached + CMAKE_CONFIG_TYPE: Debug + BUILD_TESTING: "ON" + ENABLE_SASL: "ON" + ENABLE_HASH_HSIEH: "ON" + ENABLE_DTRACE: "ON" + VERBOSE: "ON" + OS_VND: # + OS_VER: # + CC_VND: # + CC_VER: # + +jobs: + # release builds + ci-rel: + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-18.04] + compiler_vendor: [gnu, clang] + compiler_version: [new, cur, old] + runs-on: ${{ matrix.os }} + env: + CMAKE_CONFIG_TYPE: Release + CC_VND: ${{ matrix.compiler_vendor }} + CC_VER: ${{ matrix.compiler_version }} + OS_VND: ${{ runner.os }} + OS_VER: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + + + # sanitizer build + ci-san: + runs-on: # + env: + ENABLE_SANITIZERS: "address;undefined" + steps: + - uses: actions/checkout@v2 + + + # coverage build + ci-cov: + runs-on: # + env: + CFLAGS: --coverage + CXXFLAGS: --coverage + steps: + - uses: actions/checkout@v2 + + - uses: codecov/codecov-action@v1.0.13 + + # memcached new + ci-new: + runs-on: # + env: + INSTALL_MEMCACHED: + MEMCACHED_PREFIX: /tmp + MEMCACHED_BINARY: /tmp/bin/memcached + enable_sasl: yes + enable_sasl_pwdb: yes + enable_docs: no + enable_coverage: no + enable_dependency_tracking: no + steps: + - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + with: + repository: memcached/memcached + ref: 1.6.7 + - name: Build memcached + run: | + cd memcached + ./autogen.sh + ./configure CFLAGS="-O2 -pipe" --prefix=${MEMCACHED_PREFIX} + make -j2 + make install + cd .. + + diff --git a/.github/workflows/cmake-build-ci.yml b/.github/workflows/cmake-build-ci.yml new file mode 100644 index 00000000..e33e604c --- /dev/null +++ b/.github/workflows/cmake-build-ci.yml @@ -0,0 +1,212 @@ +# Generated file; do not edit! +name: cmake-build-ci +on: + push: + paths-ignore: + - "docs/**" + branches-ignore: + - gh-pages + - v1.x + pull_request: + branches: + - master + - v1.x +env: + # defaults + INSTALL_MEMCACHED: memcached + CMAKE_CONFIG_TYPE: Debug + BUILD_TESTING: "ON" + ENABLE_SASL: "ON" + ENABLE_HASH_HSIEH: "ON" + ENABLE_DTRACE: "ON" + VERBOSE: "ON" + OS_VND: Linux # + OS_VER: ubuntu-20.04 # + CC_VND: gnu # + CC_VER: cur # + +jobs: + # release builds + ci-rel: + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-18.04] + compiler_vendor: [gnu, clang] + compiler_version: [new, cur, old] + runs-on: ${{ matrix.os }} + env: + CMAKE_CONFIG_TYPE: Release + CC_VND: ${{ matrix.compiler_vendor }} + CC_VER: ${{ matrix.compiler_version }} + OS_VND: ${{ runner.os }} + OS_VER: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Prepare environment (for new gnu on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='gnu') && (env.CC_VER=='new') + run: echo CC=gcc-10 >> ${GITHUB_ENV} + run: echo CXX=g++-10 >> ${GITHUB_ENV} + run: echo INSTALL_CC='gcc-10' >> ${GITHUB_ENV} + run: echo INSTALL_CXX='g++-10' >> ${GITHUB_ENV} + - name: Prepare environment (for cur gnu on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='gnu') && (env.CC_VER=='cur') + run: echo CC=gcc-9 >> ${GITHUB_ENV} + run: echo CXX=g++-9 >> ${GITHUB_ENV} + - name: Prepare environment (for old gnu on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='gnu') && (env.CC_VER=='old') + run: echo CC=gcc-8 >> ${GITHUB_ENV} + run: echo CXX=g++-8 >> ${GITHUB_ENV} + - name: Prepare environment (for new clang on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='clang') && (env.CC_VER=='new') + run: echo CC=clang-10 >> ${GITHUB_ENV} + run: echo CXX=clang++-10 >> ${GITHUB_ENV} + - name: Prepare environment (for cur clang on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='clang') && (env.CC_VER=='cur') + run: echo CC=clang-9 >> ${GITHUB_ENV} + run: echo CXX=clang++-9 >> ${GITHUB_ENV} + - name: Prepare environment (for old clang on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='clang') && (env.CC_VER=='old') + run: echo CC=clang-8 >> ${GITHUB_ENV} + run: echo CXX=clang++-8 >> ${GITHUB_ENV} + - name: Prepare environment (for new gnu on ubuntu-18.04) + if: (env.OS_VER=='ubuntu-18.04') && (env.CC_VND=='gnu') && (env.CC_VER=='new') + run: echo CC=gcc-9 >> ${GITHUB_ENV} + run: echo CXX=g++-9 >> ${GITHUB_ENV} + - name: Prepare environment (for cur gnu on ubuntu-18.04) + if: (env.OS_VER=='ubuntu-18.04') && (env.CC_VND=='gnu') && (env.CC_VER=='cur') + run: echo CC=gcc-8 >> ${GITHUB_ENV} + run: echo CXX=g++-8 >> ${GITHUB_ENV} + - name: Prepare environment (for old gnu on ubuntu-18.04) + if: (env.OS_VER=='ubuntu-18.04') && (env.CC_VND=='gnu') && (env.CC_VER=='old') + run: echo CC=gcc-7 >> ${GITHUB_ENV} + run: echo CXX=g++-7 >> ${GITHUB_ENV} + - name: Prepare environment (for new clang on ubuntu-18.04) + if: (env.OS_VER=='ubuntu-18.04') && (env.CC_VND=='clang') && (env.CC_VER=='new') + run: echo CC=clang-9 >> ${GITHUB_ENV} + run: echo CXX=clang++-9 >> ${GITHUB_ENV} + - name: Prepare environment (for cur clang on ubuntu-18.04) + if: (env.OS_VER=='ubuntu-18.04') && (env.CC_VND=='clang') && (env.CC_VER=='cur') + run: echo CC=clang-8 >> ${GITHUB_ENV} + run: echo CXX=clang++-8 >> ${GITHUB_ENV} + - name: Prepare environment (for old clang on ubuntu-18.04) + if: (env.OS_VER=='ubuntu-18.04') && (env.CC_VND=='clang') && (env.CC_VER=='old') + run: echo CC=clang-6.0 >> ${GITHUB_ENV} + run: echo CXX=clang++-6.0 >> ${GITHUB_ENV} + - name: Install dependencies + if: runner.os == 'Linux' + run: sudo apt-get install libevent-dev libsasl-dev ${INSTALL_MEMCACHED} ${INSTALL_CC} ${INSTALL_CXX} + - name: Generate build tree (${CMAKE_CONFIG_TYPE}) + run: mkdir build + run: cmake -S . -B build + - name: Build all with ${CXX} ${CXXFLAGS} + run: make -C build -j2 all + - name: Test + run: make -C build -j2 test + - name: Install + run: make -C build -j2 install DESTDIR=. + - name: Failed tests log + if: ${{ failure() }} + run: cat Testing/Temporary/LastTest.log + + # sanitizer build + ci-san: + runs-on: ubuntu-20.04 # + env: + ENABLE_SANITIZERS: "address;undefined" + steps: + - uses: actions/checkout@v2 + - name: Prepare environment (for cur gnu on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='gnu') && (env.CC_VER=='cur') + run: echo CC=gcc-9 >> ${GITHUB_ENV} + run: echo CXX=g++-9 >> ${GITHUB_ENV} + - name: Install dependencies + if: runner.os == 'Linux' + run: sudo apt-get install libevent-dev libsasl-dev ${INSTALL_MEMCACHED} ${INSTALL_CC} ${INSTALL_CXX} + - name: Generate build tree (${CMAKE_CONFIG_TYPE}) + run: mkdir build + run: cmake -S . -B build + - name: Build all with ${CXX} ${CXXFLAGS} + run: make -C build -j2 all + - name: Test + run: make -C build -j2 test + - name: Install + run: make -C build -j2 install DESTDIR=. + - name: Failed tests log + if: ${{ failure() }} + run: cat Testing/Temporary/LastTest.log + + # coverage build + ci-cov: + runs-on: ubuntu-20.04 # + env: + CFLAGS: --coverage + CXXFLAGS: --coverage + steps: + - uses: actions/checkout@v2 + - name: Prepare environment (for cur gnu on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='gnu') && (env.CC_VER=='cur') + run: echo CC=gcc-9 >> ${GITHUB_ENV} + run: echo CXX=g++-9 >> ${GITHUB_ENV} + - name: Install dependencies + if: runner.os == 'Linux' + run: sudo apt-get install libevent-dev libsasl-dev ${INSTALL_MEMCACHED} ${INSTALL_CC} ${INSTALL_CXX} + - name: Generate build tree (${CMAKE_CONFIG_TYPE}) + run: mkdir build + run: cmake -S . -B build + - name: Build all with ${CXX} ${CXXFLAGS} + run: make -C build -j2 all + - name: Test + run: make -C build -j2 test + - name: Install + run: make -C build -j2 install DESTDIR=. + - name: Failed tests log + if: ${{ failure() }} + run: cat Testing/Temporary/LastTest.log + - uses: codecov/codecov-action@v1.0.13 + + # memcached new + ci-new: + runs-on: ubuntu-20.04 # + env: + INSTALL_MEMCACHED: + MEMCACHED_PREFIX: /tmp + MEMCACHED_BINARY: /tmp/bin/memcached + enable_sasl: yes + enable_sasl_pwdb: yes + enable_docs: no + enable_coverage: no + enable_dependency_tracking: no + steps: + - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + with: + repository: memcached/memcached + ref: 1.6.7 + - name: Build memcached + run: | + cd memcached + ./autogen.sh + ./configure CFLAGS="-O2 -pipe" --prefix=${MEMCACHED_PREFIX} + make -j2 + make install + cd .. + - name: Prepare environment (for cur gnu on ubuntu-20.04) + if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='gnu') && (env.CC_VER=='cur') + run: echo CC=gcc-9 >> ${GITHUB_ENV} + run: echo CXX=g++-9 >> ${GITHUB_ENV} + - name: Install dependencies + if: runner.os == 'Linux' + run: sudo apt-get install libevent-dev libsasl-dev ${INSTALL_MEMCACHED} ${INSTALL_CC} ${INSTALL_CXX} + - name: Generate build tree (${CMAKE_CONFIG_TYPE}) + run: mkdir build + run: cmake -S . -B build + - name: Build all with ${CXX} ${CXXFLAGS} + run: make -C build -j2 all + - name: Test + run: make -C build -j2 test + - name: Install + run: make -C build -j2 install DESTDIR=. + - name: Failed tests log + if: ${{ failure() }} + run: cat Testing/Temporary/LastTest.log + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5d96e698..00000000 --- a/.travis.yml +++ /dev/null @@ -1,56 +0,0 @@ -services: - - memcached - -addons: - apt: - packages: - - python-sphinx - - valgrind - - libevent-dev - - libsasl2-dev - -dist: bionic -language: cpp -compiler: -# - gcc - - clang - -env: -# - BUILD=Release SASL=false -# - BUILD=Debug SASL=true PREFIX=/opt PORT=11212 MC_VERSION=1.5.22 -# - BUILD=Debug SASL=false PREFIX=/opt PORT=11212 MC_VERSION=1.6.6 - - BUILD=Debug SASL=true PREFIX=/opt PORT=11212 SANITIZERS="address;undefined" - -#before_install: -install: - - | - if ${SASL} || test -n "$MC_VERSION"; - then - git clone -b ${MC_VERSION:-1.5.22} https://github.com/memcached/memcached && - cd memcached && ./autogen.sh && - CFLAGS="-O2 -pipe" ./configure --prefix=${PREFIX} --disable-dependency-tracking --enable-sasl --enable-sasl-pwdb --disable-coverage --disable-docs && - make -j2 && make install && cd ..; - ${PREFIX}/bin/memcached -l 127.0.0.1 -p ${PORT} -U ${PORT} -m 128 & - fi; - - -before_script: - - echo stats settings | nc -q 0 localhost ${PORT:-11211} | column -t - - sudo systemctl stop memcached - - killall memcached || true - - mkdir build - -script: - - cd build - - cmake -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=${BUILD} -DENABLE_SASL=${SASL} -DENABLE_SANITIZERS=${SANITIZERS} -DMEMCACHED_BINARY=${PREFIX:-/usr}/bin/memcached .. - - make -j2 VERBOSE=1 - - make test VERBOSE=1 - - make install DESTDIR=. - -#before_cache: -#after_success: - -after_failure: - - cat Testing/Temporary/LastTest.log - -#after_script: diff --git a/CMake/CheckDebug.cmake b/CMake/CheckDebug.cmake index cd0dd9b4..32fbf26d 100644 --- a/CMake/CheckDebug.cmake +++ b/CMake/CheckDebug.cmake @@ -49,10 +49,7 @@ function(check_debug) if(HAVE_ASAN) add_compile_definitions(HAVE_ASAN) add_compile_options(-fsanitize=address) - if(CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -v -fsanitize=address") - endif() - link_libraries(asan) + link_libraries(-fsanitize=address) check_flag(-fsanitize-recover=address IGNORE) endif() endif() @@ -65,10 +62,7 @@ function(check_debug) if(HAVE_UBSAN) add_compile_definitions(HAVE_UBSAN) add_compile_options(-fsanitize=undefined) - if(CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -v -fsanitize=undefined") - endif() - link_libraries(ubsan) + link_libraries(-fsanitize=undefined) check_flag(-fsanitize-recover=undefined IGNORE) endif() endif() diff --git a/CMakeConfig.txt b/CMakeConfig.txt index b99b507d..231ebcbc 100644 --- a/CMakeConfig.txt +++ b/CMakeConfig.txt @@ -13,9 +13,9 @@ elseif(UNIX) endif() option(BUILD_TESTING "whether to enable build of the test suite" - OFF) + $ENV{BUILD_TESTING}) option(BUILD_DOCSONLY "build *only* documentation" - OFF) + $ENV{BUILD_DOCSONLY}) option(BUILD_DOCS "build documentation" ${BUILD_DOCSONLY}) option(BUILD_DOCS_HTML "build HTML docs" @@ -26,19 +26,19 @@ option(BUILD_DOCS_MANGZ "gzip manpages" ${BUILD_DOCS_MAN}) option(ENABLE_DTRACE "enable dtrace support" - OFF) + $ENV{ENABLE_DTRACE}) option(ENABLE_HASH_FNV64 "enable fnv64 hash support" ON) option(ENABLE_HASH_MURMUR "enable murmur hash support" ON) option(ENABLE_HASH_HSIEH "enable hsieh hash support" - OFF) + $ENV{ENABLE_HASH_HSIEH}) option(ENABLE_MEMASLAP "enable memaslap client" ON) option(ENABLE_SASL "enable SASL support" - OFF) + $ENV{ENABLE_SASL}) -set(ENABLE_SANITIZERS "" +set(ENABLE_SANITIZERS $ENV{ENABLE_SANITIZERS} CACHE STRING "sanitizers to enable (e.g. address undefined ...)") if(BUILD_TESTING)