From: Michael Wallner Date: Mon, 21 Dec 2020 08:44:26 +0000 (+0100) Subject: ci: gh-actions: consolidate gitter notify X-Git-Tag: 1.1.0-beta1~20 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Flibmemcached;a=commitdiff_plain;h=2902291b9589d17e55d2397959c8cff9772b38a3 ci: gh-actions: consolidate gitter notify --- diff --git a/.github/notify-gitter.sh b/.github/notify-gitter.sh new file mode 100644 index 00000000..0d66504c --- /dev/null +++ b/.github/notify-gitter.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +GITTER=$1 + +REPO=${GITHUB_REPOSITORY} + +REF=$(basename ${GITHUB_REF}) +REF_URL=https://github.com/${REPO}/commits/${REF} + +BUILD_URL=https://github.com/${REPO}/actions/runs/${GITHUB_RUN_ID} +BUILD_ENV=${ImageOS}/${CC:-${CC_VND}-${CC_VER}} + +case "$2" in +1|true) + level=info + status=success + ;; +*) + level=error + status=failure + ;; +esac +message="Github [${REPO}](${REF_URL}) (${REF}) [${status}](${BUILD_URL}) (${BUILD_ENV})" + +curl -sS "${GITTER}" --data-urlencode "level=${level}" --data-urlencode "message=${message}" + diff --git a/.github/workflows/cmake-build-ci.gen b/.github/workflows/cmake-build-ci.gen index dea4d8d7..40c4db2d 100755 --- a/.github/workflows/cmake-build-ci.gen +++ b/.github/workflows/cmake-build-ci.gen @@ -242,24 +242,10 @@ function steps_package() { } function steps_notify($os_vnd) { - if ($os_vnd !== "Windows") : ?> - name: Notify Gitter (success) - if: ${{ success() && runner.os != 'Windows'}} - 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() && runner.os != 'Windows'}} - 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}})" + run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ success() }} + # windows release builds windows: diff --git a/.github/workflows/cmake-build-ci.yml b/.github/workflows/cmake-build-ci.yml index 96f170c5..13a2f40e 100644 --- a/.github/workflows/cmake-build-ci.yml +++ b/.github/workflows/cmake-build-ci.yml @@ -111,19 +111,7 @@ jobs: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target push-artifacts - name: Notify Gitter (success) - if: ${{ success() && runner.os != 'Windows'}} - 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() && runner.os != 'Windows'}} - 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}})" + run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ success() }} - uses: codecov/codecov-action@v1.0.13 # sanitizer build @@ -201,19 +189,7 @@ jobs: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target push-artifacts - name: Notify Gitter (success) - if: ${{ success() && runner.os != 'Windows'}} - 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() && runner.os != 'Windows'}} - 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}})" + run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ success() }} # mac debug dbg-mac: @@ -284,19 +260,7 @@ jobs: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target push-artifacts - name: Notify Gitter (success) - if: ${{ success() && runner.os != 'Windows'}} - 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() && runner.os != 'Windows'}} - 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}})" + run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ success() }} - uses: codecov/codecov-action@v1.0.13 # mac release @@ -315,13 +279,12 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Prepare environment (for cur gnu on ubuntu-20.04) - if: (env.OS_VER=='ubuntu-20.04') && (env.CC_VND=='gnu') && (env.CC_VER=='cur') + - name: Install dependencies (macOS) + if: runner.os == 'macOS' run: | - echo CC="gcc-9" >> ${GITHUB_ENV} - echo CXX="g++-9" >> ${GITHUB_ENV} - - name: Install dependencies () - if: runner.os == '' + brew install bison flex sphinx-doc ${INSTALL_MEMCACHED} + brew services stop memcached || true + echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV} - name: Build memcached if: runner.os != 'Windows' run: | @@ -368,19 +331,7 @@ jobs: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target push-artifacts - name: Notify Gitter (success) - if: ${{ success() && runner.os != 'Windows'}} - 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() && runner.os != 'Windows'}} - 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}})" + run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ success() }} # windows release builds windows: @@ -442,6 +393,8 @@ jobs: 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 + - name: Notify Gitter (success) + run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ success() }} # linux release builds release: @@ -584,16 +537,4 @@ jobs: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target push-artifacts - name: Notify Gitter (success) - if: ${{ success() && runner.os != 'Windows'}} - 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() && runner.os != 'Windows'}} - 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}})" + run: bash .github/notify-gitter.sh ${{ secrets.GITTER }} ${{ success() }}