ci: sr.ht: notify gitter
authorMichael Wallner <mike@php.net>
Mon, 21 Dec 2020 18:06:45 +0000 (19:06 +0100)
committerMichael Wallner <mike@php.net>
Mon, 21 Dec 2020 18:06:45 +0000 (19:06 +0100)
.builds/alpine.yml
.builds/freebsd.yml
.builds/openbsd.yml
.builds/scripts/maybe [new file with mode: 0755]
.builds/scripts/notify-gitter [new file with mode: 0755]
.builds/scripts/prepare [new file with mode: 0755]

index 1fbd9667c10d0561446ce28a12a752829bc96533..c8cda83f05fce186c6825f9dc32fcf83202ed1e8 100644 (file)
@@ -12,16 +12,21 @@ sources:
   - https://github.com/m6w6/libmemcached
 secrets:
   - 685c5b0a-395c-4031-97f8-97496bb6c25f
+  - 79d59693-c250-4eba-9569-24650f86256b
 environment:
   ENABLE_HASH_HSIEH:  "ON"
   ENABLE_MEMASLAP:    "ON"
   VERBOSE:            "ON"
 tasks:
+  - prepare: |
+      ./libmemcached/.builds/scripts/prepare
   - configure: |
-      cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug
+      maybe cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug
   - build: |
-      cmake --build debug -j2
+      maybe cmake --build debug -j2
   - test: |
-      cmake --build debug -j2 --target test
+      maybe cmake --build debug -j2 --target test
   - install: |
-      cmake --install debug --prefix /tmp
+      maybe cmake --install debug --prefix /tmp
+  - success: |
+      maybe
index 18692c3560b1d8bf188cbfdb129592085e1776b0..bdfd71131efc67daa081586153e1a1cf028eb70e 100644 (file)
@@ -3,6 +3,7 @@ packages:
   - autotools
   - bison
   - cmake
+  - curl
   - cyrus-sasl
   - flex
   - libevent
@@ -22,28 +23,32 @@ environment:
   VERBOSE:            "ON"
   MEMCACHED_BINARY:   "/home/build/memcached/work/stage/home/build/bin/memcached"
 tasks:
+  - prepare: |
+      ./libmemcached/.builds/scripts/prepare
   - memcached: |
       ln -s /usr/ports/Mk .
       ln -s /usr/ports/Templates .
       cp -R /usr/ports/databases/memcached .
       cd memcached
       echo bin/memcached > pkg-plist
-      make all install PREFIX=/home/build \
+      maybe make all install PREFIX=/home/build \
         INSTALL_AS_USER=1 NO_PKG_REGISTER=1 \
         SASLPWDB_CONFIGURE_ENABLE=sasl-pwdb \
         OPTIONS_SET="SASL SASLPWDB" \
         OPTIONS_DEFINE="SASL SASLPWDB"
   - configure: |
-      cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug
+      maybe cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug
   - build: |
-      cmake --build debug -j2
+      maybe cmake --build debug -j2
   - test: |
-      cmake --build debug -j2 --target test
+      maybe cmake --build debug -j2 --target test
   - install: |
-      cmake --install debug --prefix /tmp
+      maybe cmake --install debug --prefix /tmp
   - package: |
-      cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCS_MANGZ=ON -S libmemcached -B release
-      cmake --build release -j2 --target package -- VERBOSE=
-      cmake -DCPACK_COMPONENT_INSTALL=ON release
-      cmake --build release -j2 --target package -- VERBOSE=
-      cmake --build release -j2 --target push-artifacts -- VERBOSE=
+      maybe cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCS_MANGZ=ON -S libmemcached -B release
+      maybe cmake --build release -j2 --target package -- VERBOSE=
+      maybe cmake -DCPACK_COMPONENT_INSTALL=ON release
+      maybe cmake --build release -j2 --target package -- VERBOSE=
+      maybe cmake --build release -j2 --target push-artifacts -- VERBOSE=
+  - success: |
+      maybe
index ce5cef13f98184b3d5e9de45c54a1c11bd07be54..968bf9ac82f8cedee7b953f362c316442f65ed89 100644 (file)
@@ -2,7 +2,7 @@ image: openbsd/latest
 packages:
   - bison
   - cmake
-  - cyrus-sasl--
+  - curl--
   - libevent
   - memcached--
   - pkgconf
@@ -22,17 +22,21 @@ environment:
   VERBOSE:            "ON"
   MEMCACHED_BINARY:   "memcached"
 tasks:
+  - prepare: |
+      ./libmemcached/.builds/scripts/prepare
   - configure: |
-      cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug
+      maybe cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug
   - build: |
-      cmake --build debug -j2
+      maybe cmake --build debug -j2
   - test: |
-      cmake --build debug -j2 --target test
+      maybe cmake --build debug -j2 --target test
   - install: |
-      cmake --install debug --prefix /tmp
+      maybe cmake --install debug --prefix /tmp
   - package: |
-      cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCS_MANGZ=ON -S libmemcached -B release
-      cmake --build release -j2 --target package -- VERBOSE=
-      cmake -DCPACK_COMPONENT_INSTALL=ON release
-      cmake --build release -j2 --target package -- VERBOSE=
-      cmake --build release -j2 --target push-artifacts -- VERBOSE=
+      maybe cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCS_MANGZ=ON -S libmemcached -B release
+      maybe cmake --build release -j2 --target package -- VERBOSE=
+      maybe cmake -DCPACK_COMPONENT_INSTALL=ON release
+      maybe cmake --build release -j2 --target package -- VERBOSE=
+      maybe cmake --build release -j2 --target push-artifacts -- VERBOSE=
+  - success:
+      maybe
diff --git a/.builds/scripts/maybe b/.builds/scripts/maybe
new file mode 100755 (executable)
index 0000000..0a5b661
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+if test $# -eq 0
+then
+       notify-gitter success
+fi
+
+"$@"
+ERROR=$?
+
+if test $ERROR -ne 0
+then
+       notify-gitter failure
+       exit $ERROR
+fi
diff --git a/.builds/scripts/notify-gitter b/.builds/scripts/notify-gitter
new file mode 100755 (executable)
index 0000000..f16c2fe
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+set -eu
+
+GITTER=$(cat ~/.gitter)
+STATUS=$1
+
+REPO=m6w6/libmemcached
+REF=$(git describe --abbrev --always libmemcached)
+REF_URL=https://github.com/${REPO}/commits/${REF}
+
+BUILD_URL=${JOB_URL}
+BUILD_TAG=$(uname -o)
+if test "$BUILD_TAG" = "GNU/Linux"
+then
+       BUILD_TAG=$(lsb_release -irs)
+fi
+BUILD_CXX=$(c++ --version | head -1)
+BUILD_ENV=${BUILD_TAG}/${BUILD_CXX}
+
+case "$STATUS" in
+success)
+       LEVEL=info
+       ;;
+*)
+       LEVEL=error
+       ;;
+esac
+MESSAGE="Sourcehut [${REPO}](${REF_URL}) (${REF}) [${STATUS}](${BUILD_URL}) (${BUILD_ENV})"
+
+curl -sS "${GITTER}" --data-urlencode "level=${LEVEL}" --data-urlencode "message=${MESSAGE}"
+
diff --git a/.builds/scripts/prepare b/.builds/scripts/prepare
new file mode 100755 (executable)
index 0000000..c327355
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+echo 'PATH="$PATH:~/libmemcached/.builds/scripts"' >~/.buildenv