typo
[awesomized/libmemcached] / .github / workflows / cmake-build-ci.gen
index 8d1dc993b1bf1a4364d29ddc5362f6417ff6b357..310d1eda6c8a7e5f6e9b7002c809c42dea320333 100755 (executable)
@@ -16,7 +16,7 @@ const DEF = [
     "CXX"  => "g++",
   ],
   "clang" => [
-    "ver" => "",
+    "ver" => "apple",
     "CC"  => "clang",
     "CXX"  => "clang++",
   ],
@@ -119,9 +119,20 @@ function steps_setenv($splat_map = null) {
 
 function steps_getdeps() {
 ?>
-<?=PRE?> - name: Install dependencies
+<?=PRE?> - name: Install dependencies (Linux)
 <?=PRE?>   if: runner.os == 'Linux'
-<?=PRE?>   run: sudo apt-get install libevent-dev libsasl2-dev ${INSTALL_MEMCACHED} ${INSTALL_CC} ${INSTALL_CXX}
+<?=PRE?>   run: |
+<?=PRE?>     sudo apt-get install \
+<?=PRE?>       libevent-dev \
+<?=PRE?>       libsasl2-dev \
+<?=PRE?>       ${INSTALL_MEMCACHED} \
+<?=PRE?>       ${INSTALL_CC} ${INSTALL_CXX}
+<?=PRE?>     sudo systemctl stop memcached || true
+<?=PRE?> - name: Install dependencies (Mac)
+<?=PRE?>   if: runner.os == 'macOS'
+<?=PRE?>   run: |
+<?=PRE?>     brew install bison flex ${INSTALL_MEMCACHED}
+<?=PRE?>     brew services stop memcached || true
 <?php
 }
 
@@ -137,7 +148,7 @@ function steps_build() {
 <?=PRE?>   run: make -C build -j2 install DESTDIR=.
 <?=PRE?> - name: Failed tests log
 <?=PRE?>   if: ${{ failure() }}
-<?=PRE?>   run: cat build/Testing/Temporary/LastTest.log
+<?=PRE?>   run: cat build/Testing/Temporary/LastTest.log || true
 <?php
 }
 
@@ -147,17 +158,23 @@ function steps($splat_map = null) {
   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: 
+on:
   push:
-    paths-ignore: 
+    paths-ignore:
       - "docs/**"
-    branches-ignore: 
+    branches-ignore:
       - gh-pages
       - v1.x
   pull_request:
-    branches: 
+    branches:
       - master
       - v1.x
 env:
@@ -175,60 +192,16 @@ env:
   CC_VER:   <?=DEF[DEF[DEF[DEF["os"]]]]["ver"]?> #
 
 jobs:
-  # 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); ?>
-
-  # sanitizer build
-  ci-san:
-    runs-on: <?=DEF[DEF["os"]]?> #
-    env:
-      ENABLE_SANITIZERS: "address;undefined"
-    steps: 
-      - uses: actions/checkout@v2
-<?php steps(); ?>
 
-  # coverage build
-  ci-cov:
-    runs-on: <?=DEF[DEF["os"]]?> #
-    env:
-      CFLAGS: --coverage
-      CXXFLAGS: --coverage
-    steps: 
-      - uses: actions/checkout@v2
-<?php steps(); ?>
-      - uses: codecov/codecov-action@v1.0.13
-        with:
-          directory: build/src
-
-  # memcached new
+  # new memcached
   ci-new:
+    name: ci-dbg (<?=defaults()?>, memcached-1.6)
     runs-on: <?=DEF[DEF["os"]]?> #
     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
+      ENABLE_SASL:      "ON"
     steps:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
@@ -242,9 +215,67 @@ jobs:
         run: |
           cd memcached
           ./autogen.sh
-          ./configure CFLAGS="-O2 -pipe" --prefix=${MEMCACHED_PREFIX}
+          ./configure CFLAGS="-O2 -pipe" \
+            --prefix=${MEMCACHED_PREFIX} \
+            --enable-sasl \
+            --enable-sasl-pwdb \
+            --disable-docs \
+            --disable-coverage \
+            --disable-dependency-tracking
           make -j2
           make install
           cd ..
 <?php steps_build(); ?>
 
+  # 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
+    env:
+      MEMCACHED_BINARY: /usr/local/bin/memcached
+    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); ?>