Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Created with package:mono_repo v2.5.0
# Created with package:mono_repo v3.0.0
language: dart

jobs:
include:
- stage: mono_repo_self_validate
- stage: analyze_and_format
name: mono_repo self validate
os: linux
script: tool/mono_repo_self_validate.sh
script: "pub global activate mono_repo 3.0.0 && pub global run mono_repo travis --validate"
- stage: analyze_and_format
name: "SDK: 2.9.3; PKGS: angular_components, angular_gallery, angular_gallery_section, examples/app_layout_example, examples/material_button_example, examples/material_card_example, examples/material_checkbox_example, examples/material_chips_example, examples/material_datepicker_example, examples/material_dialog_example, examples/material_expansionpanel_example, examples/material_icon_example, examples/material_list_example, examples/material_menu_example, examples/material_popup_example, examples/material_progress_example, examples/material_radio_example, examples/material_slider_example, examples/material_spinner_example, examples/material_stepper_example, examples/material_tab_example, examples/material_toggle_example, examples/material_tooltip_example, examples/material_yes_no_buttons_example, examples/scorecard_example, examples/simple_html_example; TASKS: `dartanalyzer --fatal-warnings .`"
dart: "2.9.3"
Expand Down Expand Up @@ -57,7 +57,6 @@ jobs:
script: tool/travis.sh command_1 command_2

stages:
- mono_repo_self_validate
- analyze_and_format
- unit_test
- build
Expand Down
2 changes: 1 addition & 1 deletion mono_repo.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See with https://github.com/google/mono_repo.dart for details on this file

self_validate: true
self_validate: analyze_and_format
travis:
stages:
- analyze_and_format
Expand Down
141 changes: 84 additions & 57 deletions tool/travis.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#!/bin/bash
# Created with package:mono_repo v2.5.0
# Created with package:mono_repo v3.0.0

# Support built in commands on windows out of the box.
function pub {
function pub() {
if [[ $TRAVIS_OS_NAME == "windows" ]]; then
command pub.bat "$@"
else
command pub "$@"
fi
}
function dartfmt {
function dartfmt() {
if [[ $TRAVIS_OS_NAME == "windows" ]]; then
command dartfmt.bat "$@"
else
command dartfmt "$@"
fi
}
function dartanalyzer {
function dartanalyzer() {
if [[ $TRAVIS_OS_NAME == "windows" ]]; then
command dartanalyzer.bat "$@"
else
Expand All @@ -25,71 +25,98 @@ function dartanalyzer {
}

if [[ -z ${PKGS} ]]; then
echo -e '\033[31mPKGS environment variable must be set!\033[0m'
exit 1
echo -e '\033[31mPKGS environment variable must be set! - TERMINATING JOB\033[0m'
exit 64
fi

if [[ "$#" == "0" ]]; then
echo -e '\033[31mAt least one task argument must be provided!\033[0m'
exit 1
echo -e '\033[31mAt least one task argument must be provided! - TERMINATING JOB\033[0m'
exit 64
fi

EXIT_CODE=0
SUCCESS_COUNT=0
declare -a FAILURES

for PKG in ${PKGS}; do
echo -e "\033[1mPKG: ${PKG}\033[22m"
pushd "${PKG}" || exit $?
EXIT_CODE=0
pushd "${PKG}" >/dev/null || EXIT_CODE=$?

if [[ ${EXIT_CODE} -ne 0 ]]; then
echo -e "\033[31mPKG: '${PKG}' does not exist - TERMINATING JOB\033[0m"
exit 64
fi

pub upgrade --no-precompile || EXIT_CODE=$?

PUB_EXIT_CODE=0
pub upgrade --no-precompile || PUB_EXIT_CODE=$?
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo -e "\033[31mPKG: ${PKG}; 'pub upgrade' - FAILED (${EXIT_CODE})\033[0m"
FAILURES+=("${PKG}; 'pub upgrade'")
else
for TASK in "$@"; do
EXIT_CODE=0
echo
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
case ${TASK} in
command_0)
echo './tool/travis/install_protoc.sh'
./tool/travis/install_protoc.sh || EXIT_CODE=$?
;;
command_1)
echo 'pub run build_runner build web'
pub run build_runner build web || EXIT_CODE=$?
;;
command_2)
echo 'pub run build_runner build web --release'
pub run build_runner build web --release || EXIT_CODE=$?
;;
dartanalyzer_0)
echo 'dartanalyzer --fatal-warnings .'
dartanalyzer --fatal-warnings . || EXIT_CODE=$?
;;
dartanalyzer_1)
echo 'dartanalyzer --fatal-warnings --fatal-infos .'
dartanalyzer --fatal-warnings --fatal-infos . || EXIT_CODE=$?
;;
dartfmt)
echo 'dartfmt -n --set-exit-if-changed .'
dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
;;
test)
echo 'pub run test --run-skipped'
pub run test --run-skipped || EXIT_CODE=$?
;;
*)
echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m"
exit 64
;;
esac

if [[ ${PUB_EXIT_CODE} -ne 0 ]]; then
EXIT_CODE=1
echo -e '\033[31mpub upgrade failed\033[0m'
popd
continue
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo -e "\033[31mPKG: ${PKG}; TASK: ${TASK} - FAILED (${EXIT_CODE})\033[0m"
FAILURES+=("${PKG}; TASK: ${TASK}")
else
echo -e "\033[32mPKG: ${PKG}; TASK: ${TASK} - SUCCEEDED\033[0m"
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
fi

done
fi

for TASK in "$@"; do
echo
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
case ${TASK} in
command_0)
echo './tool/travis/install_protoc.sh'
./tool/travis/install_protoc.sh || EXIT_CODE=$?
;;
command_1)
echo 'pub run build_runner build web'
pub run build_runner build web || EXIT_CODE=$?
;;
command_2)
echo 'pub run build_runner build web --release'
pub run build_runner build web --release || EXIT_CODE=$?
;;
dartanalyzer_0)
echo 'dartanalyzer --fatal-warnings .'
dartanalyzer --fatal-warnings . || EXIT_CODE=$?
;;
dartanalyzer_1)
echo 'dartanalyzer --fatal-warnings --fatal-infos .'
dartanalyzer --fatal-warnings --fatal-infos . || EXIT_CODE=$?
;;
dartfmt)
echo 'dartfmt -n --set-exit-if-changed .'
dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
;;
test)
echo 'pub run test --run-skipped'
pub run test --run-skipped || EXIT_CODE=$?
;;
*)
echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
EXIT_CODE=1
;;
esac
done
echo
echo -e "\033[32mSUCCESS COUNT: ${SUCCESS_COUNT}\033[0m"

if [ ${#FAILURES[@]} -ne 0 ]; then
echo -e "\033[31mFAILURES: ${#FAILURES[@]}\033[0m"
for i in "${FAILURES[@]}"; do
echo -e "\033[31m $i\033[0m"
done
fi

popd
popd >/dev/null || exit 70
echo
done

exit ${EXIT_CODE}
if [ ${#FAILURES[@]} -ne 0 ]; then
exit 1
fi