add webhook notifications to chat for failed builds (#1396)
Update to latest mono_repo and use the `on_completion` support to ping our chat for failed push/scheduled builds.
Also added a cron job.
Also removes travis :)
diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml
index 8847c36..81bc070 100644
--- a/.github/workflows/dart.yml
+++ b/.github/workflows/dart.yml
@@ -1,4 +1,4 @@
-# Created with package:mono_repo v3.1.0
+# Created with package:mono_repo v3.2.0
name: Dart CI
on:
push:
@@ -6,6 +6,8 @@
- main
- master
pull_request:
+ schedule:
+ - cron: "0 0 * * 0"
defaults:
run:
shell: bash
@@ -32,7 +34,7 @@
version: latest
- run: dart --version
- uses: actions/checkout@v2
- - run: pub global activate mono_repo 3.1.0
+ - run: pub global activate mono_repo 3.2.0
- run: pub global run mono_repo generate --validate
job_002:
name: "OS: linux; SDK: dev; PKGS: pkgs/test, pkgs/test_api, pkgs/test_core; TASKS: [`dartfmt -n --set-exit-if-changed .`, `dartanalyzer --enable-experiment=non-nullable --fatal-infos --fatal-warnings .`]"
@@ -195,3 +197,23 @@
PKGS: pkgs/test_api
TRAVIS_OS_NAME: linux
run: tool/ci.sh command_5
+ job_009:
+ needs:
+ - job_001
+ - job_002
+ - job_003
+ - job_004
+ - job_005
+ - job_006
+ - job_007
+ - job_008
+ name: Notify failure
+ runs-on: ubuntu-latest
+ if: "(github.event_name == 'push' || github.event_name == 'schedule') && failure()"
+ steps:
+ - run: |
+ curl -H "Content-Type: application/json" -X POST -d \
+ "{'text':'Build failed! ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}'}" \
+ "${BUILD_AND_TEST_TEAM_CHAT_WEBHOOK_URL}"
+ env:
+ CHAT_WEBHOOK_URL: "${{ secrets.BUILD_AND_TEST_TEAM_CHAT_WEBHOOK_URL }}"
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index fd7be10..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-# Created with package:mono_repo v3.1.0
-language: dart
-
-# Custom configuration
-addons:
- chrome: stable
-env:
- global: FORCE_TEST_EXIT=true
-after_failure:
- - tool/report_failure.sh
-
-jobs:
- include:
- - stage: analyze_and_format
- name: mono_repo self validate
- os: linux
- script: "pub global activate mono_repo 3.1.0 && pub global run mono_repo generate --validate"
- - stage: analyze_and_format
- name: "SDK: dev; PKGS: pkgs/test, pkgs/test_api, pkgs/test_core; TASKS: [`dartfmt -n --set-exit-if-changed .`, `dartanalyzer --enable-experiment=non-nullable --fatal-infos --fatal-warnings .`]"
- dart: dev
- os: linux
- env: PKGS="pkgs/test pkgs/test_api pkgs/test_core"
- script: tool/ci.sh dartfmt dartanalyzer
- - stage: unit_test
- name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run --enable-experiment=non-nullable test --preset travis -x phantomjs --total-shards 5 --shard-index 0`"
- dart: dev
- os: linux
- env: PKGS="pkgs/test"
- script: tool/ci.sh command_0
- - stage: unit_test
- name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run --enable-experiment=non-nullable test --preset travis -x phantomjs --total-shards 5 --shard-index 1`"
- dart: dev
- os: linux
- env: PKGS="pkgs/test"
- script: tool/ci.sh command_1
- - stage: unit_test
- name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run --enable-experiment=non-nullable test --preset travis -x phantomjs --total-shards 5 --shard-index 2`"
- dart: dev
- os: linux
- env: PKGS="pkgs/test"
- script: tool/ci.sh command_2
- - stage: unit_test
- name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run --enable-experiment=non-nullable test --preset travis -x phantomjs --total-shards 5 --shard-index 3`"
- dart: dev
- os: linux
- env: PKGS="pkgs/test"
- script: tool/ci.sh command_3
- - stage: unit_test
- name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run --enable-experiment=non-nullable test --preset travis -x phantomjs --total-shards 5 --shard-index 4`"
- dart: dev
- os: linux
- env: PKGS="pkgs/test"
- script: tool/ci.sh command_4
- - stage: unit_test
- name: "SDK: dev; PKG: pkgs/test_api; TASKS: `pub run --enable-experiment=non-nullable test --preset travis -x browser`"
- dart: dev
- os: linux
- env: PKGS="pkgs/test_api"
- script: tool/ci.sh command_5
-
-stages:
- - analyze_and_format
- - unit_test
-
-# Only building master means that we don't run two builds for each pull request.
-branches:
- only:
- - master
-
-cache:
- directories:
- - $HOME/.pub-cache
diff --git a/mono_repo.yaml b/mono_repo.yaml
index a1d69da..df9130e 100644
--- a/mono_repo.yaml
+++ b/mono_repo.yaml
@@ -4,15 +4,20 @@
github:
env:
FORCE_TEST_EXIT: true
-
-travis:
- addons:
- chrome: stable
- env:
- global: FORCE_TEST_EXIT=true
-
- after_failure:
- - tool/report_failure.sh
+ # Setting just `cron` keeps the defaults for `push` and `pull_request`
+ cron: '0 0 * * 0' # “At 00:00 (UTC) on Sunday.”
+ on_completion:
+ - name: "Notify failure"
+ runs-on: ubuntu-latest
+ # Run only if other jobs have failed and this is a push or scheduled build.
+ if: (github.event_name == 'push' || github.event_name == 'schedule') && failure()
+ steps:
+ - run: >
+ curl -H "Content-Type: application/json" -X POST -d \
+ "{'text':'Build failed! ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}'}" \
+ "${BUILD_AND_TEST_TEAM_CHAT_WEBHOOK_URL}"
+ env:
+ CHAT_WEBHOOK_URL: ${{ secrets.BUILD_AND_TEST_TEAM_CHAT_WEBHOOK_URL }}
merge_stages:
- analyze_and_format
diff --git a/tool/ci.sh b/tool/ci.sh
index c6618c5..59424fa 100755
--- a/tool/ci.sh
+++ b/tool/ci.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Created with package:mono_repo v3.1.0
+# Created with package:mono_repo v3.2.0
# Support built in commands on windows out of the box.
function pub() {
diff --git a/tool/report_failure.sh b/tool/report_failure.sh
deleted file mode 100755
index 3a0d925..0000000
--- a/tool/report_failure.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-if [ "$TRAVIS_EVENT_TYPE" != "pull_request" -a "$TRAVIS_ALLOW_FAILURE" != "true" ]; then
- curl -H "Content-Type: application/json" -X POST -d \
- "{'text':'Build failed! ${TRAVIS_BUILD_WEB_URL}'}" \
- "${CHAT_HOOK_URI}"
-fi