@@ -30,6 +30,44 @@ parameters:
3030orbs :
3131 win : circleci/windows@2.2.0
3232
33+ commands :
34+ gitter_notify :
35+ description : " Posts a notification to the main room on Gitter (if not running on a PR)."
36+ parameters :
37+ event :
38+ type : enum
39+ enum : ["failure", "success"]
40+ condition :
41+ type : string
42+ steps :
43+ - run :
44+ name : " Gitter notification"
45+ command : |
46+ [[ "<< parameters.event >>" == "failure" ]] && message=" ❌ Nightly job **${CIRCLE_JOB}** failed on **${CIRCLE_BRANCH}**. Please see [build #${CIRCLE_BUILD_NUM}](${CIRCLE_BUILD_URL}) for details."
47+ [[ "<< parameters.event >>" == "success" ]] && message=" ✅ Nightly job **${CIRCLE_JOB}** succeeded on **${CIRCLE_BRANCH}**. Please see [build #${CIRCLE_BUILD_NUM}](${CIRCLE_BUILD_URL}) for details."
48+
49+ curl "https://api.gitter.im/v1/rooms/${GITTER_NOTIFY_ROOM_ID}/chatMessages" \
50+ --request POST \
51+ --include \
52+ --header "Content-Type: application/json" \
53+ --header "Accept: application/json" \
54+ --header "Authorization: Bearer ${GITTER_API_TOKEN}" \
55+ --data "{\"text\":\"${message}\"}"
56+
57+ gitter_notify_failure :
58+ description : " Posts a failure notification to the main room on Gitter (if not running on a PR)."
59+ steps :
60+ - gitter_notify :
61+ event : failure
62+ condition : on_fail
63+
64+ gitter_notify_success :
65+ description : " Posts a success notification to the main room on Gitter (if not running on a PR)."
66+ steps :
67+ - gitter_notify :
68+ event : success
69+ condition : on_success
70+
3371defaults :
3472
3573 # --------------------------------------------------------------------------
@@ -267,28 +305,6 @@ defaults:
267305 requires :
268306 - b_win_release
269307
270- # --------------------------------------------------------------------------
271- # Notification Templates
272- - gitter_notify_failure : &gitter_notify_failure
273- name : Gitter notify failure
274- command : >-
275- curl -X POST -i
276- -i -H "Content-Type: application/json"
277- -H "Accept: application/json"
278- -H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
279- -d '{"text":" ❌ Nightly job **'$CIRCLE_JOB'** failed on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
280- when : on_fail
281-
282- - gitter_notify_success : &gitter_notify_success
283- name : Gitter notify success
284- command : >-
285- curl -X POST -i
286- -i -H "Content-Type: application/json"
287- -H "Accept: application/json"
288- -H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
289- -d '{"text":" ✅ Nightly job **'$CIRCLE_JOB'** succeeded on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
290- when : on_success
291-
292308# -----------------------------------------------------------------------------------------------
293309jobs :
294310
@@ -507,7 +523,7 @@ jobs:
507523 steps :
508524 - checkout
509525 - run : *run_build
510- - run : * gitter_notify_failure
526+ - gitter_notify_failure
511527 - store_artifacts : *artifacts_solc
512528 - persist_to_workspace : *artifacts_executables
513529
@@ -600,8 +616,8 @@ jobs:
600616 git clone https://github.com/ethereum/solidity-fuzzing-corpus /tmp/solidity-fuzzing-corpus
601617 mkdir -p test_results
602618 scripts/regressions.py -o test_results
603- - run : * gitter_notify_failure
604- - run : * gitter_notify_success
619+ - gitter_notify_failure
620+ - gitter_notify_success
605621 - store_test_results : *store_test_results
606622 - store_artifacts : *artifacts_test_results
607623
@@ -813,7 +829,7 @@ jobs:
813829 - when :
814830 condition : true
815831 << : *steps_soltest
816- - run : * gitter_notify_failure
832+ - gitter_notify_failure
817833
818834 t_ubu_ubsan_clang_cli :
819835 docker :
@@ -822,7 +838,7 @@ jobs:
822838 - when :
823839 condition : true
824840 << : *steps_cmdline_tests
825- - run : * gitter_notify_failure
841+ - gitter_notify_failure
826842
827843 t_ems_solcjs :
828844 docker :
@@ -906,8 +922,8 @@ jobs:
906922 - when :
907923 condition : <<parameters.gitter_notify>>
908924 steps :
909- - run : * gitter_notify_failure
910- - run : * gitter_notify_success
925+ - gitter_notify_failure
926+ - gitter_notify_success
911927
912928 b_win : &b_win
913929 executor :
0 commit comments