msvc support
[m6w6/libmemcached] / .github / workflows / cmake-build-ci.gen
index 2438347cbecfa225ba55b757b7f0a1ab1d0073ae..1c758836eca17c9ee28e1d5806b4974fedb1c2fb 100755 (executable)
@@ -6,8 +6,10 @@ echo "# Generated file; do not edit!\n";
 const DEF = [
   "os" => "Linux",
   "Linux" => "ubuntu-20.04",
+  "Windows" => "windows-2019",
   "macOS" => "macos-10.15",
   "ubuntu-20.04" => "gnu",
+  "windows-2019" => "msvc",
   "macos-10.15" => "clang",
   "gnu" => [
     "ver" => "cur",
@@ -19,6 +21,11 @@ const DEF = [
     "CC"  => "clang",
     "CXX"  => "clang++",
   ],
+  "msvc" => [ // dummy
+    "ver" => "cur",
+    "CC" => "msvc",
+    "CXX" => "msvc",
+  ],
 ];
 const ENV = [
   "ubuntu-20.04" => [
@@ -74,7 +81,16 @@ const MAP = [
           ]
         ]
       ]
-    ]
+    ],
+    "windows-2019" => [
+      'env.CC_VND' => [
+        "msvc" => [
+          'env.CC_VER' => [
+            "cur" => "2019",
+          ],
+        ],
+      ],
+    ],
   ]
 ];
 
@@ -123,6 +139,7 @@ function steps_getdeps() {
           sudo apt-get install \
             libevent-dev \
             libsasl2-dev \
+            libtbb-dev \
             ${INSTALL_MEMCACHED} \
             ${INSTALL_CC} ${INSTALL_CXX}
           sudo systemctl stop memcached || true
@@ -165,17 +182,37 @@ function steps_build() {
       - name: Test
         run: make -C build -j2 test
       - name: Install
-        run: make -C build -j2 install DESTDIR=.
+        run: make -C build -j2 install DESTDIR=/tmp
       - name: Failed tests log
         if: ${{ failure() }}
         run: cat build/Testing/Temporary/LastTest.log || true
 <?php
 }
 
+function steps_notify() {
+?>
+      - name: Notify Gitter (success)
+        if: ${{ success() }}
+        run: |
+          REF=$(basename ${GITHUB_REF})
+          curl -sS "${{ secrets.GITTER }}" \
+            --data-urlencode "level=info" \
+            --data-urlencode "message=Github [${GITHUB_REPOSITORY}](https://github.com/${GITHUB_REPOSITORY}/commits/${REF}) (${REF}) [success](https://github.com/m6w6/libmemcached/actions/runs/${GITHUB_RUN_ID}) (${ImageOS}/${CC:-${CC_VND}-${CC_VER}})"
+      - name: Notify Gitter (failure)
+        if: ${{ failure() }}
+        run: |
+          REF=$(basename ${GITHUB_REF})
+          curl -sS "${{ secrets.GITTER }}" \
+            --data-urlencode "level=error" \
+            --data-urlencode "message=Github [${GITHUB_REPOSITORY}](https://github.com/${GITHUB_REPOSITORY}/commits/${REF}) (${REF}) [failure](https://github.com/m6w6/libmemcached/actions/runs/${GITHUB_RUN_ID}) (${ImageOS}/${CC:-${CC_VND}-${CC_VER}})"
+<?php
+}
+
 function steps($splat_map = null) {
   steps_setenv($splat_map);
   steps_getdeps();
   steps_build();
+  steps_notify();
 }
 
 function defaults() {
@@ -188,13 +225,14 @@ function defaults() {
 name: cmake-build-ci
 on:
   push:
-    paths-ignore:
-      - "docs/**"
-      - ".travis.yml"
-      - ".cirrus.yml"
+    paths:
+      - "include/**"
+      - "src/**"
+      - "test/**"
+      - "CMake*"
+      - ".github/workflows/cmake-build-ci*"
     branches-ignore:
       - gh-pages
-      - v1.x
   pull_request:
     branches:
       - master
@@ -223,6 +261,8 @@ jobs:
       INSTALL_MEMCACHED:
       MEMCACHED_PREFIX: /tmp
       ENABLE_SASL:      "ON"
+      CFLAGS:           "-O0 --coverage"
+      CXXFLAGS:         "-O0 --coverage"
     steps:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
@@ -231,6 +271,7 @@ jobs:
           path: memcached
           ref: 1.6.7
 <?php steps(); ?>
+      - uses: codecov/codecov-action@v1.0.13
 
   # sanitizer build
   dbg-san:
@@ -242,26 +283,55 @@ jobs:
       - uses: actions/checkout@v2
 <?php steps(); ?>
 
-  # coverage build
-  dbg-cov:
-    name: dbg-cov (<?=defaults()?>)
+  # thread sanitizer build
+  dbg-tsan:
+    name: dbg-tsan (<?=defaults()?>)
     runs-on: <?=DEF[DEF["os"]]?> #
     env:
-      CFLAGS: -O0 --coverage
-      CXXFLAGS: -O0 --coverage
+      ENABLE_SANITIZERS:  "thread"
     steps:
       - uses: actions/checkout@v2
 <?php steps(); ?>
-      - uses: codecov/codecov-action@v1.0.13
 
   # mac build
   dbg-mac:
     name: dbg-mac (<?=DEF["macOS"]?>, <?=DEF[DEF["macOS"]]?>, <?=DEF[DEF[DEF["macOS"]]]["ver"]?>)
     runs-on: <?=DEF["macOS"]?> #
+    env:
+      CFLAGS:   -O0 --coverage
+      CXXFLAGS: -O0 --coverage
+      OS_VND:   macOS
+      OS_VER:   <?=DEF["macOS"]?> #
+      CC_VND:   <?=DEF[DEF["macOS"]]?> #
+      CC_VER:   <?=DEF[DEF[DEF["macOS"]]]["ver"]?> #
     continue-on-error: true
     steps:
       - uses: actions/checkout@v2
 <?php steps(false); ?>
+      - uses: codecov/codecov-action@v1.0.13
+
+  # win build
+  win-msvc:
+    name: win-msvc (<?=DEF["Windows"]?>, <?=DEF[DEF["Windows"]]?>, <?=DEF[DEF[DEF["Windows"]]]["ver"]?>)
+    runs-on: <?=DEF["Windows"]?> #
+    env:
+      CMAKE_BUILD_TYPE: Release
+      BUILD_TESTING:    "OFF"
+      BISON_ROOT:       "C:/msys64/usr"
+      FLEX_ROOT:        "C:/msys64/usr"
+      OS_VND: Windows
+      OS_VER: <?=DEF["Windows"]?> #
+      CC_VND: <?=DEF[DEF["Windows"]]?> #
+      CC_VER: <?=DEF[DEF[DEF["Windows"]]]["ver"]?> #
+    continue-on-error: true
+    steps:
+      - uses: actions/checkout@v2
+      - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+        run: cmake --config ${{ env.CMAKE_BUILD_TYPE }} -S . -B build
+      - name: Build all with ${{ env.CC_VND }}
+        run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }}
+      - name: Install
+        run: cmake --install build --prefix installed --config ${{ env.CMAKE_BUILD_TYPE }}
 
   # release builds
   release: