mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
CI: Refactor the gitter notification templates into a reusable command
This commit is contained in:
parent
ef21e43fa3
commit
0e71c12c56
@ -30,6 +30,44 @@ parameters:
|
|||||||
orbs:
|
orbs:
|
||||||
win: circleci/windows@2.2.0
|
win: circleci/windows@2.2.0
|
||||||
|
|
||||||
|
commands:
|
||||||
|
gitter_notify:
|
||||||
|
description: "Posts a notification to the main room on Gitter (if not running on a PR)."
|
||||||
|
parameters:
|
||||||
|
event:
|
||||||
|
type: enum
|
||||||
|
enum: ["failure", "success"]
|
||||||
|
condition:
|
||||||
|
type: string
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: "Gitter notification"
|
||||||
|
command: |
|
||||||
|
[[ "<< parameters.event >>" == "failure" ]] && message=" ❌ Nightly job **${CIRCLE_JOB}** failed on **${CIRCLE_BRANCH}**. Please see ${CIRCLE_BUILD_URL} for details."
|
||||||
|
[[ "<< parameters.event >>" == "success" ]] && message=" ✅ Nightly job **${CIRCLE_JOB}** succeeded on **${CIRCLE_BRANCH}**. Please see ${CIRCLE_BUILD_URL} for details."
|
||||||
|
|
||||||
|
curl "https://api.gitter.im/v1/rooms/${GITTER_NOTIFY_ROOM_ID}/chatMessages" \
|
||||||
|
--request POST \
|
||||||
|
--include \
|
||||||
|
--header "Content-Type: application/json" \
|
||||||
|
--header "Accept: application/json" \
|
||||||
|
--header "Authorization: Bearer ${GITTER_API_TOKEN}" \
|
||||||
|
--data "{\"text\":\"${message}\"}"
|
||||||
|
|
||||||
|
gitter_notify_failure:
|
||||||
|
description: "Posts a failure notification to the main room on Gitter (if not running on a PR)."
|
||||||
|
steps:
|
||||||
|
- gitter_notify:
|
||||||
|
event: failure
|
||||||
|
condition: on_fail
|
||||||
|
|
||||||
|
gitter_notify_success:
|
||||||
|
description: "Posts a success notification to the main room on Gitter (if not running on a PR)."
|
||||||
|
steps:
|
||||||
|
- gitter_notify:
|
||||||
|
event: success
|
||||||
|
condition: on_success
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@ -263,28 +301,6 @@ defaults:
|
|||||||
requires:
|
requires:
|
||||||
- b_win_release
|
- b_win_release
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Notification Templates
|
|
||||||
- gitter_notify_failure: &gitter_notify_failure
|
|
||||||
name: Gitter notify failure
|
|
||||||
command: >-
|
|
||||||
curl -X POST -i
|
|
||||||
-i -H "Content-Type: application/json"
|
|
||||||
-H "Accept: application/json"
|
|
||||||
-H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
|
|
||||||
-d '{"text":" ❌ Nightly job **'$CIRCLE_JOB'** failed on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
|
|
||||||
when: on_fail
|
|
||||||
|
|
||||||
- gitter_notify_success: &gitter_notify_success
|
|
||||||
name: Gitter notify success
|
|
||||||
command: >-
|
|
||||||
curl -X POST -i
|
|
||||||
-i -H "Content-Type: application/json"
|
|
||||||
-H "Accept: application/json"
|
|
||||||
-H "Authorization: Bearer $GITTER_API_TOKEN" "https://api.gitter.im/v1/rooms/$GITTER_NOTIFY_ROOM_ID/chatMessages"
|
|
||||||
-d '{"text":" ✅ Nightly job **'$CIRCLE_JOB'** succeeded on **'$CIRCLE_BRANCH'**. Please see '$CIRCLE_BUILD_URL' for details."}'
|
|
||||||
when: on_success
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@ -502,7 +518,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: *run_build
|
- run: *run_build
|
||||||
- run: *gitter_notify_failure
|
- gitter_notify_failure
|
||||||
- store_artifacts: *artifacts_solc
|
- store_artifacts: *artifacts_solc
|
||||||
- persist_to_workspace: *artifacts_executables
|
- persist_to_workspace: *artifacts_executables
|
||||||
|
|
||||||
@ -595,8 +611,8 @@ jobs:
|
|||||||
git clone https://github.com/ethereum/solidity-fuzzing-corpus /tmp/solidity-fuzzing-corpus
|
git clone https://github.com/ethereum/solidity-fuzzing-corpus /tmp/solidity-fuzzing-corpus
|
||||||
mkdir -p test_results
|
mkdir -p test_results
|
||||||
scripts/regressions.py -o test_results
|
scripts/regressions.py -o test_results
|
||||||
- run: *gitter_notify_failure
|
- gitter_notify_failure
|
||||||
- run: *gitter_notify_success
|
- gitter_notify_success
|
||||||
- store_test_results: *store_test_results
|
- store_test_results: *store_test_results
|
||||||
- store_artifacts: *artifacts_test_results
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
@ -807,7 +823,7 @@ jobs:
|
|||||||
- when:
|
- when:
|
||||||
condition: true
|
condition: true
|
||||||
<<: *steps_soltest
|
<<: *steps_soltest
|
||||||
- run: *gitter_notify_failure
|
- gitter_notify_failure
|
||||||
|
|
||||||
t_ubu_ubsan_clang_cli:
|
t_ubu_ubsan_clang_cli:
|
||||||
docker:
|
docker:
|
||||||
@ -816,7 +832,7 @@ jobs:
|
|||||||
- when:
|
- when:
|
||||||
condition: true
|
condition: true
|
||||||
<<: *steps_cmdline_tests
|
<<: *steps_cmdline_tests
|
||||||
- run: *gitter_notify_failure
|
- gitter_notify_failure
|
||||||
|
|
||||||
t_ems_solcjs:
|
t_ems_solcjs:
|
||||||
docker:
|
docker:
|
||||||
@ -874,8 +890,8 @@ jobs:
|
|||||||
- when:
|
- when:
|
||||||
condition: <<parameters.gitter_notify>>
|
condition: <<parameters.gitter_notify>>
|
||||||
steps:
|
steps:
|
||||||
- run: *gitter_notify_failure
|
- gitter_notify_failure
|
||||||
- run: *gitter_notify_success
|
- gitter_notify_success
|
||||||
|
|
||||||
b_win: &b_win
|
b_win: &b_win
|
||||||
executor:
|
executor:
|
||||||
|
Loading…
Reference in New Issue
Block a user