-<?=PRE?> - name: Install dependencies
-<?=PRE?> if: runner.os == 'Linux'
-<?=PRE?> run: sudo apt-get install libevent-dev libsasl-dev ${INSTALL_MEMCACHED} ${INSTALL_CC} ${INSTALL_CXX}
-<?=PRE?> - name: Generate build tree (${CMAKE_CONFIG_TYPE})
-<?=PRE?> run: mkdir build
-<?=PRE?> run: cmake -S . -B build
-<?=PRE?> - name: Build all with ${CXX} ${CXXFLAGS}
-<?=PRE?> run: make -C build -j2 all
-<?=PRE?> - name: Test
-<?=PRE?> run: make -C build -j2 test
-<?=PRE?> - name: Install
-<?=PRE?> run: make -C build -j2 install DESTDIR=.
-<?=PRE?> - name: Failed tests log
-<?=PRE?> if: ${{ failure() }}
-<?=PRE?> run: cat Testing/Temporary/LastTest.log
+ - name: Install dependencies (<?=$os_vnd?>)
+ if: runner.os == '<?=$os_vnd?>'
+<?php
+ if ($os_vnd === "Linux") :
+?>
+ run: |
+ sudo apt-get install -my \
+ libevent-dev \
+ libsasl2-dev \
+ libtbb-dev \
+ python3-sphinx \
+ ${INSTALL_MEMCACHED} \
+ ${INSTALL_CC} ${INSTALL_CXX}
+ sudo systemctl stop memcached || true
+<?php
+ endif;
+ if ($os_vnd === "macOS") :
+?>
+ run: |
+ brew install bison flex sphinx-doc ${INSTALL_MEMCACHED}
+ brew services stop memcached || true
+ echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV}
+<?php
+ endif;
+ if ($os_vnd === "Windows") :
+?>
+ uses: msys2/setup-msys2@v2
+ with:
+ release: false
+ path-type: inherit
+ install: >-
+ rsync
+ openssh
+<?php
+ endif;
+ if ($os_vnd != "Windows") :
+?>
+ - name: Build memcached
+ if: runner.os != 'Windows'
+ 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
+ endif;
+}
+
+function steps_build() {
+?>
+ - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }})
+ run: cmake --config ${{ env.CMAKE_BUILD_TYPE }} -S . -B build
+ - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }}
+ run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2
+<?php
+}
+
+function steps_test() {
+?>
+ - name: Test
+ if: env.BUILD_TESTING == 'ON'
+ run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target test
+ - name: Install
+ if: env.BUILD_TESTING == 'ON'
+ run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} --prefix /tmp
+ - name: Failed tests log
+ if: ${{ env.BUILD_TESTING == 'ON' && failure() }}
+ run: cat build/Testing/Temporary/LastTest.log || true
+<?php
+}
+
+function steps_package() {
+?>
+ - name: Package
+ env:
+ PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }}
+ if: env.CC_VER == 'cur' && env.CMAKE_BUILD_TYPE == 'Release'
+ run: |
+ cmake --config ${{ env.CMAKE_BUILD_TYPE }} -S . -B build
+ cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package
+ cmake -DCPACK_COMPONENT_INSTALL=ON build
+ cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package
+ cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target push-artifacts
+<?php
+}
+
+function steps_notify($os_vnd) {
+?>
+ - name: Notify Gitter
+ run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ job.status }}
+<?php
+}
+
+function steps($os_vnd, $splat_map = null) {
+ steps_setenv($os_vnd, $splat_map);
+ steps_getdeps($os_vnd);
+ steps_build();
+ steps_test();
+ steps_package();
+ steps_notify($os_vnd);
+}
+
+function defaults($os_vnd = DEF["os"]) {
+ $os_ver = DEF[$os_vnd];
+ $cc_vnd = DEF[$os_ver];
+ $cc_ver = DEF[$cc_vnd]["ver"];
+ return "$os_ver, $cc_vnd, $cc_ver";
+}
+
+function env_override($os_vnd, $cc_vnd = null) {
+ isset($cc_vnd) or $cc_vnd = DEF[DEF[$os_vnd]];
+?>
+ OS_VND: <?=$os_vnd?> #
+ OS_VER: <?=DEF[$os_vnd]?> #
+ CC_VND: <?=$cc_vnd?> #
+ CC_VER: <?=DEF[$cc_vnd]["ver"]?> #