From 1e080e086eed966bfbb1278f7afd24aa9ee27811 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 21 Dec 2020 19:06:45 +0100 Subject: [PATCH] ci: sr.ht: notify gitter --- .builds/alpine.yml | 13 +++++++++---- .builds/freebsd.yml | 25 +++++++++++++++---------- .builds/openbsd.yml | 24 ++++++++++++++---------- .builds/scripts/maybe | 14 ++++++++++++++ .builds/scripts/notify-gitter | 31 +++++++++++++++++++++++++++++++ .builds/scripts/prepare | 2 ++ 6 files changed, 85 insertions(+), 24 deletions(-) create mode 100755 .builds/scripts/maybe create mode 100755 .builds/scripts/notify-gitter create mode 100755 .builds/scripts/prepare diff --git a/.builds/alpine.yml b/.builds/alpine.yml index 1fbd9667..c8cda83f 100644 --- a/.builds/alpine.yml +++ b/.builds/alpine.yml @@ -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 diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 18692c35..bdfd7113 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -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 diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml index ce5cef13..968bf9ac 100644 --- a/.builds/openbsd.yml +++ b/.builds/openbsd.yml @@ -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 index 00000000..0a5b6616 --- /dev/null +++ b/.builds/scripts/maybe @@ -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 index 00000000..f16c2fe4 --- /dev/null +++ b/.builds/scripts/notify-gitter @@ -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 index 00000000..c3273558 --- /dev/null +++ b/.builds/scripts/prepare @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo 'PATH="$PATH:~/libmemcached/.builds/scripts"' >~/.buildenv -- 2.30.2