Merge branch 'gh-actions' into catch
authorMichael Wallner <mike@php.net>
Mon, 5 Oct 2020 11:41:59 +0000 (13:41 +0200)
committerMichael Wallner <mike@php.net>
Mon, 5 Oct 2020 11:41:59 +0000 (13:41 +0200)
12 files changed:
.editorconfig [new file with mode: 0644]
.github/workflows/cmake-build-ci.gen [new file with mode: 0755]
.github/workflows/cmake-build-ci.yml [new file with mode: 0644]
.travis.yml [deleted file]
CMake/CheckDebug.cmake
CMake/CheckDependency.cmake
CMakeConfig.txt
README.md
codecov.yml [new file with mode: 0644]
test/tests/memcached/regression/binary_block_add.cpp
test/tests/memcached/stat.cpp
test/tests/memcached/udp.cpp

diff --git a/.editorconfig b/.editorconfig
new file mode 100644 (file)
index 0000000..17ed7c8
--- /dev/null
@@ -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 (executable)
index 0000000..bff77cd
--- /dev/null
@@ -0,0 +1,282 @@
+#!/usr/bin/env php
+<?php
+
+echo "# Generated file; do not edit!\n";
+
+const DEF = [
+  "os" => "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" => "apple",
+    "CC"  => "clang",
+    "CXX"  => "clang++",
+  ],
+];
+const ENV = [
+  "ubuntu-20.04" => [
+    "gnu" => [
+      "new" => [
+        "INSTALL_CC" => "gcc-10",
+        "INSTALL_CXX" => "g++-10",
+      ]
+    ]
+  ],
+  "ubuntu-18.04" => [
+    "clang" => [
+      "old" => [
+        "CXXFLAGS" => "-stdlib=libc++"
+      ]
+    ]
+  ]
+];
+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_setenv($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 (<?= "for $cc_ver $cc_vnd on $os_ver" ?>)
+        if: (<?="$os_is=='$os_ver') && ($cc_vnd_is=='$cc_vnd') && ($cc_ver_is=='$cc_ver'"?>)
+        run: |
+          echo CC="<?=DEF[$cc_vnd]["CC"] . $ver?>" >> ${GITHUB_ENV}
+          echo CXX="<?=DEF[$cc_vnd]["CXX"] . $ver?>" >> ${GITHUB_ENV}
+<?php
+                if (isset(ENV[$os_ver][$cc_vnd][$cc_ver])) {
+                  foreach (ENV[$os_ver][$cc_vnd][$cc_ver] as $env => $val) {
+?>
+          echo <?=$env?>="<?=$val?>" >> ${GITHUB_ENV}
+<?php
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+function steps_getdeps() {
+?>
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get install \
+            libevent-dev \
+            libsasl2-dev \
+            ${INSTALL_MEMCACHED} \
+            ${INSTALL_CC} ${INSTALL_CXX}
+          sudo systemctl stop memcached || true
+      - name: Install dependencies (Mac)
+        if: runner.os == 'macOS'
+        run: |
+          brew install bison flex ${INSTALL_MEMCACHED}
+          brew services stop memcached || true
+          echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV}
+      - name: Build memcached
+        run: |
+          if test -d memcached
+          then
+            cd memcached
+            ./autogen.sh
+            ./configure CFLAGS="-O2 -pipe" \
+              --prefix=${MEMCACHED_PREFIX} \
+              --enable-sasl \
+              --enable-sasl-pwdb \
+              --disable-coverage \
+              --disable-dependency-tracking \
+              --disable-docs \
+              --disable-extstore \
+              --disable-option-checking \
+              ;
+            make -j2
+            make install
+            cd ..
+            echo MEMCACHED_BINARY="${MEMCACHED_PREFIX}/bin/memcached" >> ${GITHUB_ENV}
+          fi
+<?php
+}
+
+function steps_build() {
+?>
+      - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+        run: cmake -S . -B build
+      - name: Build all with ${{ env.CXX }} ${{ env.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 build/Testing/Temporary/LastTest.log || true
+<?php
+}
+
+function steps($splat_map = null) {
+  steps_setenv($splat_map);
+  steps_getdeps();
+  steps_build();
+}
+
+function defaults() {
+  $os_ver = DEF[DEF["os"]];
+  $cc_vnd = DEF[$os_ver];
+  $cc_ver = DEF[$cc_vnd]["ver"];
+  return "$os_ver, $cc_vnd, $cc_ver";
+}
+?>
+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_BUILD_TYPE:   Debug
+  BUILD_TESTING:      "ON"
+  ENABLE_SASL:        "OFF"
+  ENABLE_HASH_HSIEH:  "ON"
+  ENABLE_DTRACE:      "OFF"
+  VERBOSE:            "ON"
+  OS_VND:   <?=DEF["os"]?> #
+  OS_VER:   <?=DEF[DEF["os"]]?> #
+  CC_VND:   <?=DEF[DEF[DEF["os"]]]?> #
+  CC_VER:   <?=DEF[DEF[DEF[DEF["os"]]]]["ver"]?> #
+
+jobs:
+
+  # new memcached
+  ci-new:
+    name: ci-dbg (<?=defaults()?>, memcached-1.6)
+    runs-on: <?=DEF[DEF["os"]]?> #
+    env:
+      INSTALL_MEMCACHED:
+      MEMCACHED_PREFIX: /tmp
+      ENABLE_SASL:      "ON"
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/checkout@v2
+        with:
+          repository: memcached/memcached
+          path: memcached
+          ref: 1.6.7
+<?php steps(); ?>
+
+  # sanitizer build
+  ci-san:
+    name: ci-dbg (<?=defaults()?>, sanitizers)
+    runs-on: <?=DEF[DEF["os"]]?> #
+    env:
+      ENABLE_SANITIZERS: "address;undefined"
+    steps:
+      - uses: actions/checkout@v2
+<?php steps(); ?>
+
+  # coverage build
+  ci-cov:
+    name: ci-dbg (<?=defaults()?>, coverage)
+    runs-on: <?=DEF[DEF["os"]]?> #
+    env:
+      CFLAGS: -O0 --coverage
+      CXXFLAGS: -O0 --coverage
+    steps:
+      - uses: actions/checkout@v2
+<?php steps(); ?>
+      - uses: codecov/codecov-action@v1.0.13
+
+  # mac build
+  ci-mac:
+    name: ci-dbg (<?=DEF["macOS"]?>, <?=DEF[DEF["macOS"]]?>, <?=DEF[DEF[DEF["macOS"]]]["ver"]?>)
+    runs-on: <?=DEF["macOS"]?> #
+    continue-on-error: true
+    steps:
+      - uses: actions/checkout@v2
+<?php steps(false); ?>
+
+  # release builds
+  ci-rel:
+    strategy:
+      fail-fast: false
+      matrix:
+        os_ver: [ubuntu-20.04, ubuntu-18.04]
+        cc_vnd: [gnu, clang]
+        cc_ver: [new, cur, old]
+    runs-on: ${{ matrix.os_ver }}
+    continue-on-error: ${{ matrix.cc_vnd == 'clang' }}
+    env:
+      CMAKE_BUILD_TYPE: Release
+      OS_VND: Linux
+      OS_VER: ${{ matrix.os_ver }}
+      CC_VND: ${{ matrix.cc_vnd }}
+      CC_VER: ${{ matrix.cc_ver }}
+    steps:
+      - uses: actions/checkout@v2
+<?php steps(true); ?>
diff --git a/.github/workflows/cmake-build-ci.yml b/.github/workflows/cmake-build-ci.yml
new file mode 100644 (file)
index 0000000..4cf46a6
--- /dev/null
@@ -0,0 +1,404 @@
+# 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_BUILD_TYPE:   Debug
+  BUILD_TESTING:      "ON"
+  ENABLE_SASL:        "OFF"
+  ENABLE_HASH_HSIEH:  "ON"
+  ENABLE_DTRACE:      "OFF"
+  VERBOSE:            "ON"
+  OS_VND:   Linux #
+  OS_VER:   ubuntu-20.04 #
+  CC_VND:   gnu #
+  CC_VER:   cur #
+
+jobs:
+
+  # new memcached
+  ci-new:
+    name: ci-dbg (ubuntu-20.04, gnu, cur, memcached-1.6)
+    runs-on: ubuntu-20.04 #
+    env:
+      INSTALL_MEMCACHED:
+      MEMCACHED_PREFIX: /tmp
+      ENABLE_SASL:      "ON"
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/checkout@v2
+        with:
+          repository: memcached/memcached
+          path: memcached
+          ref: 1.6.7
+      - 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}
+          echo CXX="g++-9" >> ${GITHUB_ENV}
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get install \
+            libevent-dev \
+            libsasl2-dev \
+            ${INSTALL_MEMCACHED} \
+            ${INSTALL_CC} ${INSTALL_CXX}
+          sudo systemctl stop memcached || true
+      - name: Install dependencies (Mac)
+        if: runner.os == 'macOS'
+        run: |
+          brew install bison flex ${INSTALL_MEMCACHED}
+          brew services stop memcached || true
+          echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV}
+      - name: Build memcached
+        run: |
+          if test -d memcached
+          then
+            cd memcached
+            ./autogen.sh
+            ./configure CFLAGS="-O2 -pipe" \
+              --prefix=${MEMCACHED_PREFIX} \
+              --enable-sasl \
+              --enable-sasl-pwdb \
+              --disable-coverage \
+              --disable-dependency-tracking \
+              --disable-docs \
+              --disable-extstore \
+              --disable-option-checking \
+              ;
+            make -j2
+            make install
+            cd ..
+            echo MEMCACHED_BINARY="${MEMCACHED_PREFIX}/bin/memcached" >> ${GITHUB_ENV}
+          fi
+      - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+        run: cmake -S . -B build
+      - name: Build all with ${{ env.CXX }} ${{ env.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 build/Testing/Temporary/LastTest.log || true
+
+  # sanitizer build
+  ci-san:
+    name: ci-dbg (ubuntu-20.04, gnu, cur, sanitizers)
+    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}
+          echo CXX="g++-9" >> ${GITHUB_ENV}
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get install \
+            libevent-dev \
+            libsasl2-dev \
+            ${INSTALL_MEMCACHED} \
+            ${INSTALL_CC} ${INSTALL_CXX}
+          sudo systemctl stop memcached || true
+      - name: Install dependencies (Mac)
+        if: runner.os == 'macOS'
+        run: |
+          brew install bison flex ${INSTALL_MEMCACHED}
+          brew services stop memcached || true
+          echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV}
+      - name: Build memcached
+        run: |
+          if test -d memcached
+          then
+            cd memcached
+            ./autogen.sh
+            ./configure CFLAGS="-O2 -pipe" \
+              --prefix=${MEMCACHED_PREFIX} \
+              --enable-sasl \
+              --enable-sasl-pwdb \
+              --disable-coverage \
+              --disable-dependency-tracking \
+              --disable-docs \
+              --disable-extstore \
+              --disable-option-checking \
+              ;
+            make -j2
+            make install
+            cd ..
+            echo MEMCACHED_BINARY="${MEMCACHED_PREFIX}/bin/memcached" >> ${GITHUB_ENV}
+          fi
+      - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+        run: cmake -S . -B build
+      - name: Build all with ${{ env.CXX }} ${{ env.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 build/Testing/Temporary/LastTest.log || true
+
+  # coverage build
+  ci-cov:
+    name: ci-dbg (ubuntu-20.04, gnu, cur, coverage)
+    runs-on: ubuntu-20.04 #
+    env:
+      CFLAGS: -O0 --coverage
+      CXXFLAGS: -O0 --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}
+          echo CXX="g++-9" >> ${GITHUB_ENV}
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get install \
+            libevent-dev \
+            libsasl2-dev \
+            ${INSTALL_MEMCACHED} \
+            ${INSTALL_CC} ${INSTALL_CXX}
+          sudo systemctl stop memcached || true
+      - name: Install dependencies (Mac)
+        if: runner.os == 'macOS'
+        run: |
+          brew install bison flex ${INSTALL_MEMCACHED}
+          brew services stop memcached || true
+          echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV}
+      - name: Build memcached
+        run: |
+          if test -d memcached
+          then
+            cd memcached
+            ./autogen.sh
+            ./configure CFLAGS="-O2 -pipe" \
+              --prefix=${MEMCACHED_PREFIX} \
+              --enable-sasl \
+              --enable-sasl-pwdb \
+              --disable-coverage \
+              --disable-dependency-tracking \
+              --disable-docs \
+              --disable-extstore \
+              --disable-option-checking \
+              ;
+            make -j2
+            make install
+            cd ..
+            echo MEMCACHED_BINARY="${MEMCACHED_PREFIX}/bin/memcached" >> ${GITHUB_ENV}
+          fi
+      - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+        run: cmake -S . -B build
+      - name: Build all with ${{ env.CXX }} ${{ env.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 build/Testing/Temporary/LastTest.log || true
+      - uses: codecov/codecov-action@v1.0.13
+
+  # mac build
+  ci-mac:
+    name: ci-dbg (macos-10.15, clang, apple)
+    runs-on: macos-10.15 #
+    continue-on-error: true
+    steps:
+      - uses: actions/checkout@v2
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get install \
+            libevent-dev \
+            libsasl2-dev \
+            ${INSTALL_MEMCACHED} \
+            ${INSTALL_CC} ${INSTALL_CXX}
+          sudo systemctl stop memcached || true
+      - name: Install dependencies (Mac)
+        if: runner.os == 'macOS'
+        run: |
+          brew install bison flex ${INSTALL_MEMCACHED}
+          brew services stop memcached || true
+          echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV}
+      - name: Build memcached
+        run: |
+          if test -d memcached
+          then
+            cd memcached
+            ./autogen.sh
+            ./configure CFLAGS="-O2 -pipe" \
+              --prefix=${MEMCACHED_PREFIX} \
+              --enable-sasl \
+              --enable-sasl-pwdb \
+              --disable-coverage \
+              --disable-dependency-tracking \
+              --disable-docs \
+              --disable-extstore \
+              --disable-option-checking \
+              ;
+            make -j2
+            make install
+            cd ..
+            echo MEMCACHED_BINARY="${MEMCACHED_PREFIX}/bin/memcached" >> ${GITHUB_ENV}
+          fi
+      - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+        run: cmake -S . -B build
+      - name: Build all with ${{ env.CXX }} ${{ env.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 build/Testing/Temporary/LastTest.log || true
+
+  # release builds
+  ci-rel:
+    strategy:
+      fail-fast: false
+      matrix:
+        os_ver: [ubuntu-20.04, ubuntu-18.04]
+        cc_vnd: [gnu, clang]
+        cc_ver: [new, cur, old]
+    runs-on: ${{ matrix.os_ver }}
+    continue-on-error: ${{ matrix.cc_vnd == 'clang' }}
+    env:
+      CMAKE_BUILD_TYPE: Release
+      OS_VND: Linux
+      OS_VER: ${{ matrix.os_ver }}
+      CC_VND: ${{ matrix.cc_vnd }}
+      CC_VER: ${{ matrix.cc_ver }}
+    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}
+          echo CXX="g++-10" >> ${GITHUB_ENV}
+          echo INSTALL_CC="gcc-10" >> ${GITHUB_ENV}
+          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}
+          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}
+          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}
+          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}
+          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}
+          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}
+          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}
+          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}
+          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}
+          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}
+          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}
+          echo CXX="clang++-6.0" >> ${GITHUB_ENV}
+          echo CXXFLAGS="-stdlib=libc++" >> ${GITHUB_ENV}
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get install \
+            libevent-dev \
+            libsasl2-dev \
+            ${INSTALL_MEMCACHED} \
+            ${INSTALL_CC} ${INSTALL_CXX}
+          sudo systemctl stop memcached || true
+      - name: Install dependencies (Mac)
+        if: runner.os == 'macOS'
+        run: |
+          brew install bison flex ${INSTALL_MEMCACHED}
+          brew services stop memcached || true
+          echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV}
+      - name: Build memcached
+        run: |
+          if test -d memcached
+          then
+            cd memcached
+            ./autogen.sh
+            ./configure CFLAGS="-O2 -pipe" \
+              --prefix=${MEMCACHED_PREFIX} \
+              --enable-sasl \
+              --enable-sasl-pwdb \
+              --disable-coverage \
+              --disable-dependency-tracking \
+              --disable-docs \
+              --disable-extstore \
+              --disable-option-checking \
+              ;
+            make -j2
+            make install
+            cd ..
+            echo MEMCACHED_BINARY="${MEMCACHED_PREFIX}/bin/memcached" >> ${GITHUB_ENV}
+          fi
+      - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+        run: cmake -S . -B build
+      - name: Build all with ${{ env.CXX }} ${{ env.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 build/Testing/Temporary/LastTest.log || true
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index 5d96e69..0000000
+++ /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:
index cd0dd9b40f0cbbdd5e68a4e5de4610b8fe5d9d91..32fbf26d1ddb1dcd7caf576d4a2fdb13a487e164 100644 (file)
@@ -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()
index 1003d68c28b0e4d759186ff9ee08e9de619869be..862321fb4e2dd85c71d29f46d14a6d9a612ea08f 100644 (file)
@@ -41,7 +41,7 @@ function(check_dependency NAME LIB HEADER)
         endif()
                if(NOT ${NAME}_FOUND)
                        check_dependency_basic(${NAME} ${LIB} ${HEADER})
-               else()  
+               else()
                        set(${NAME} ${${NAME}_FOUND} PARENT_SCOPE)
                        set(${NAME}_LIBRARIES ${${NAME}_LDFLAGS} PARENT_SCOPE)
                        set(${NAME}_INCLUDEDIR ${${NAME}_INCLUDEDIR} PARENT_SCOPE)
index b99b507dae388c3f7e7aa83582c2f5c845fd13ac..baced8881fe6d27588587c1be03b89025f0f7a1a 100644 (file)
@@ -1,5 +1,11 @@
-set(CMAKE_BUILD_TYPE Release
-    CACHE STRING "build type (Release, Debug, ...)")
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+    if(NOT DEFINED ENV{CMAKE_BUILD_TYPE})
+        set(ENV{CMAKE_BUILD_TYPE} Release)
+    endif()
+    set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE}
+        CACHE STRING "build type (Release, Debug, ...)" FORCE)
+endif()
 set(CMAKE_INSTALL_PREFIX /usr/local
     CACHE PATH "install prefix")
 
@@ -13,9 +19,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 +32,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)
index 1f6222974078be66e0779984c5945c62d43c2577..d37343dcfb95c86b81905807eee05ab35634016f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
 # libmemcached
 
-[![Build Status](https://travis-ci.org/m6w6/libmemcached.svg?branch=v1.0)](https://travis-ci.org/m6w6/libmemcached) [![Join the chat at https://gitter.im/m6w6/libmemcached](https://badges.gitter.im/m6w6/libmemcached.svg)](https://gitter.im/m6w6/libmemcached?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build Status](https://github.com/m6w6/libmemcached/workflows/cmake-build-ci/badge.svg)](https://github.com/m6w6/libmemcached/actions?query=workflow%3Acmake-build-ci) 
+[![Gitter Chat](https://badges.gitter.im/m6w6/libmemcached.svg)](https://gitter.im/m6w6/libmemcached?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 
 libmemcached is an open source C/C++ client library and tools for the
 memcached server (http://memcached.org/). It has been designed to be
diff --git a/codecov.yml b/codecov.yml
new file mode 100644 (file)
index 0000000..38e8c50
--- /dev/null
@@ -0,0 +1,20 @@
+
+ignore:
+  - "/usr"
+
+coverage:
+  status:
+    project:
+      default:
+        target: auto
+        threshold: 1%
+  range: 60..90
+  round: nearest
+  precision: 0
+  notify:
+    gitter:
+      default:
+        url: "https://webhooks.gitter.im/e/a6210fd7fb7b5105b2b0"
+        threshold: 1%
+
+
index c0873aa81430997721b76194c09a96c1ba5612ba..468a611d6848b567538db7c8dd3b800e6c4e2214 100644 (file)
@@ -11,7 +11,7 @@ TEST_CASE("memcached_regression_binary_block_add") {
   INFO("binary: " << binary);
 
   for (auto i = 0; i < 20480; ++i) {
-    auto rkey = random_ascii_string(12);
+    auto rkey = random_ascii_string(12) + to_string(i);
     memcached_return_t rc = memcached_add_by_key(memc, S("key"), rkey.c_str(), rkey.length(), blob.c_str(), blob.length(), 0, 0);
 
     if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE) {
index 92682f57cfc549c27f9404a21a45588eea935f38..c07a0d1eec408e5130a278e79ab363b374cd0aa2 100644 (file)
@@ -22,7 +22,7 @@ TEST_CASE("memcached_stat") {
 
   SECTION("execute") {
     for (auto i = 0; i < 64; ++i) {
-      auto key = random_ascii_string(32);
+      auto key = random_ascii_string(12) + to_string(i);
       REQUIRE_SUCCESS(memcached_set(memc, key.c_str(), key.length(), nullptr, 0, 0, 0));
     }
 
index 0c76f535f9caa1304151039f9d1796d7fdad8afb..85e44126c7ae742becda21bddf4bc6470408960c 100644 (file)
@@ -2,6 +2,10 @@
 #include "test/lib/MemcachedCluster.hpp"
 
 TEST_CASE("memcached_udp") {
+#ifdef __APPLE__
+  WARN("skip: memcached crashes");
+  SUCCEED();
+#else
   auto test = MemcachedCluster::udp();
   auto memc = &test.memc;
 
@@ -89,4 +93,5 @@ TEST_CASE("memcached_udp") {
       }
     }
   }
+#endif
 }