@@ -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 notify (if not running on a PR)"
45+ command : |
46+ [[ "<< parameters.event >>" == "failure" ]] && message=" ❌ Nightly job **${CIRCLE_JOB}** failed on **${CIRCLE_BRANCH}**. Please see ${CIRCLE_BUILD_URL} for details."
47+ [[ "<< parameters.event >>" == "success" ]] && message=" ✅ Nightly job **${CIRCLE_JOB}** succeeded on **${CIRCLE_BRANCH}**. Please see ${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 # --------------------------------------------------------------------------
@@ -263,28 +301,6 @@ defaults:
263301 requires :
264302 - b_win_release
265303
266- # --------------------------------------------------------------------------
267- # Notification Templates
268- - gitter_notify_failure : &gitter_notify_failure
269- name : Gitter notify failure
270- command : >-
271- curl -X POST -i
272- -i -H "Content-Type: application/json"
273- -H "Accept: application/json"
274- -H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
275- -d '{"text":" ❌ Nightly job **'$CIRCLE_JOB'** failed on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
276- when : on_fail
277-
278- - gitter_notify_success : &gitter_notify_success
279- name : Gitter notify success
280- command : >-
281- curl -X POST -i
282- -i -H "Content-Type: application/json"
283- -H "Accept: application/json"
284- -H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
285- -d '{"text":" ✅ Nightly job **'$CIRCLE_JOB'** succeeded on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
286- when : on_success
287-
288304# -----------------------------------------------------------------------------------------------
289305jobs :
290306
@@ -502,7 +518,7 @@ jobs:
502518 steps :
503519 - checkout
504520 - run : *run_build
505- - run : * gitter_notify_failure
521+ - gitter_notify_failure
506522 - store_artifacts : *artifacts_solc
507523 - persist_to_workspace : *artifacts_executables
508524
@@ -595,8 +611,8 @@ jobs:
595611 git clone https://github.com/ethereum/solidity-fuzzing-corpus /tmp/solidity-fuzzing-corpus
596612 mkdir -p test_results
597613 scripts/regressions.py -o test_results
598- - run : * gitter_notify_failure
599- - run : * gitter_notify_success
614+ - gitter_notify_failure
615+ - gitter_notify_success
600616 - store_test_results : *store_test_results
601617 - store_artifacts : *artifacts_test_results
602618
@@ -807,7 +823,7 @@ jobs:
807823 - when :
808824 condition : true
809825 << : *steps_soltest
810- - run : * gitter_notify_failure
826+ - gitter_notify_failure
811827
812828 t_ubu_ubsan_clang_cli :
813829 docker :
@@ -816,7 +832,7 @@ jobs:
816832 - when :
817833 condition : true
818834 << : *steps_cmdline_tests
819- - run : * gitter_notify_failure
835+ - gitter_notify_failure
820836
821837 t_ems_solcjs :
822838 docker :
@@ -874,8 +890,8 @@ jobs:
874890 - when :
875891 condition : <<parameters.gitter_notify>>
876892 steps :
877- - run : * gitter_notify_failure
878- - run : * gitter_notify_success
893+ - gitter_notify_failure
894+ - gitter_notify_success
879895
880896 b_win : &b_win
881897 executor :
0 commit comments