Update travis (#238)
* Changes caused by mono_repo 2.0
* Run tests on linux, osx, and windows
diff --git a/.travis.yml b/.travis.yml
index 46715f9..db3bd46 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,4 @@
-# Created with package:mono_repo v1.2.1
+# Created with package:mono_repo v2.0.0
language: dart
# Custom configuration
@@ -8,64 +8,68 @@
- "export PATH=$PWD/protoc/bin:$PATH"
- echo $PATH
- "echo \"dependency_overrides: {protobuf: {path: ../protobuf}}\" >> protoc_plugin/pubspec.yaml"
+os:
+ - linux
+ - osx
+ - windows
jobs:
include:
- stage: format_analyzer_tests
- name: "SDK: stable - DIR: api_benchmark - TASKS: [./compile_protos.sh, dartfmt -n --set-exit-if-changed ., dartanalyzer --fatal-warnings .]"
- script: ./tool/travis.sh command_0 dartfmt dartanalyzer_0
- env: PKG="api_benchmark"
+ name: "SDK: stable; PKG: api_benchmark; TASKS: [`./compile_protos.sh`, `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-warnings .`]"
dart: stable
+ env: PKGS="api_benchmark"
+ script: ./tool/travis.sh command_0 dartfmt dartanalyzer_0
- stage: format_analyzer_tests
- name: "SDK: dev - DIR: protobuf - TASKS: dartanalyzer --fatal-infos --fatal-warnings ."
+ name: "SDK: stable; PKG: query_benchmark; TASKS: [`./compile_protos.sh`, `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-warnings .`]"
+ dart: stable
+ env: PKGS="query_benchmark"
+ script: ./tool/travis.sh command_0 dartfmt dartanalyzer_0
+ - stage: format_analyzer_tests
+ name: "SDK: dev; PKG: protobuf; TASKS: `dartanalyzer --fatal-infos --fatal-warnings .`"
+ dart: dev
+ env: PKGS="protobuf"
script: ./tool/travis.sh dartanalyzer_1
- env: PKG="protobuf"
- dart: dev
- stage: format_analyzer_tests
- name: "SDK: stable - DIR: protobuf - TASKS: dartfmt -n --set-exit-if-changed ."
+ name: "SDK: stable; PKG: protobuf; TASKS: `dartfmt -n --set-exit-if-changed .`"
+ dart: stable
+ env: PKGS="protobuf"
script: ./tool/travis.sh dartfmt
- env: PKG="protobuf"
- dart: stable
- stage: format_analyzer_tests
- name: "SDK: stable - DIR: protobuf - TASKS: dartanalyzer --fatal-warnings ."
+ name: "SDK: stable; PKG: protobuf; TASKS: `dartanalyzer --fatal-warnings .`"
+ dart: stable
+ env: PKGS="protobuf"
script: ./tool/travis.sh dartanalyzer_0
- env: PKG="protobuf"
- dart: stable
- stage: format_analyzer_tests
- name: "SDK: stable - DIR: protobuf - TASKS: pub run test"
- script: ./tool/travis.sh test
- env: PKG="protobuf"
+ name: "SDK: stable; PKG: protobuf; TASKS: `pub run test`"
dart: stable
- - stage: format_analyzer_tests
- name: "SDK: dev - DIR: protobuf - TASKS: pub run test"
+ env: PKGS="protobuf"
script: ./tool/travis.sh test
- env: PKG="protobuf"
+ - stage: format_analyzer_tests
+ name: "SDK: dev; PKG: protobuf; TASKS: `pub run test`"
dart: dev
+ env: PKGS="protobuf"
+ script: ./tool/travis.sh test
- stage: format_analyzer_tests
- name: "SDK: dev - DIR: protoc_plugin - TASKS: [make protos, dartanalyzer --fatal-infos --fatal-warnings .]"
+ name: "SDK: dev; PKG: protoc_plugin; TASKS: [`make protos`, `dartanalyzer --fatal-infos --fatal-warnings .`]"
+ dart: dev
+ env: PKGS="protoc_plugin"
script: ./tool/travis.sh command_1 dartanalyzer_1
- env: PKG="protoc_plugin"
- dart: dev
- stage: format_analyzer_tests
- name: "SDK: stable - DIR: protoc_plugin - TASKS: [make protos, dartfmt -n --set-exit-if-changed ., dartanalyzer --fatal-warnings .]"
+ name: "SDK: stable; PKG: protoc_plugin; TASKS: [`make protos`, `dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-warnings .`]"
+ dart: stable
+ env: PKGS="protoc_plugin"
script: ./tool/travis.sh command_1 dartfmt dartanalyzer_0
- env: PKG="protoc_plugin"
- dart: stable
- stage: format_analyzer_tests
- name: "SDK: stable - DIR: protoc_plugin - TASKS: [make protos, pub run test]"
- script: ./tool/travis.sh command_1 test
- env: PKG="protoc_plugin"
+ name: "SDK: stable; PKG: protoc_plugin; TASKS: [`make protos`, `pub run test`]"
dart: stable
- - stage: format_analyzer_tests
- name: "SDK: dev - DIR: protoc_plugin - TASKS: [make protos, pub run test]"
+ env: PKGS="protoc_plugin"
script: ./tool/travis.sh command_1 test
- env: PKG="protoc_plugin"
+ - stage: format_analyzer_tests
+ name: "SDK: dev; PKG: protoc_plugin; TASKS: [`make protos`, `pub run test`]"
dart: dev
- - stage: format_analyzer_tests
- name: "SDK: stable - DIR: query_benchmark - TASKS: [./compile_protos.sh, dartfmt -n --set-exit-if-changed ., dartanalyzer --fatal-warnings .]"
- script: ./tool/travis.sh command_0 dartfmt dartanalyzer_0
- env: PKG="query_benchmark"
- dart: stable
+ env: PKGS="protoc_plugin"
+ script: ./tool/travis.sh command_1 test
stages:
- format_analyzer_tests
diff --git a/mono_repo.yaml b/mono_repo.yaml
index a7c9808..84fefd6 100644
--- a/mono_repo.yaml
+++ b/mono_repo.yaml
@@ -8,3 +8,9 @@
# Run the protoc_plugin tests with the protobuf from the repo, not from pub.
# This could be avoided with a fix of: https://github.com/dart-lang/mono_repo/issues/117.
- "echo \"dependency_overrides: {protobuf: {path: ../protobuf}}\" >> protoc_plugin/pubspec.yaml"
+
+ os:
+ - linux
+ - osx
+ - windows
+
diff --git a/tool/travis.sh b/tool/travis.sh
index f65d474..f22c4e2 100755
--- a/tool/travis.sh
+++ b/tool/travis.sh
@@ -1,60 +1,62 @@
#!/bin/bash
-# Created with package:mono_repo v1.2.1
+# Created with package:mono_repo v2.0.0
-if [ -z "$PKG" ]; then
- echo -e '\033[31mPKG environment variable must be set!\033[0m'
+if [[ -z ${PKGS} ]]; then
+ echo -e '\033[31mPKGS environment variable must be set!\033[0m'
exit 1
fi
-if [ "$#" == "0" ]; then
+if [[ "$#" == "0" ]]; then
echo -e '\033[31mAt least one task argument must be provided!\033[0m'
exit 1
fi
-pushd $PKG
-pub upgrade || exit $?
-
EXIT_CODE=0
-while (( "$#" )); do
- TASK=$1
- case $TASK in
- command_0) echo
- echo -e '\033[1mTASK: command_0\033[22m'
- echo -e './compile_protos.sh'
- ./compile_protos.sh || EXIT_CODE=$?
- ;;
- command_1) echo
- echo -e '\033[1mTASK: command_1\033[22m'
- echo -e 'make protos'
- make protos || EXIT_CODE=$?
- ;;
- dartanalyzer_0) echo
- echo -e '\033[1mTASK: dartanalyzer_0\033[22m'
- echo -e 'dartanalyzer --fatal-warnings .'
- dartanalyzer --fatal-warnings . || EXIT_CODE=$?
- ;;
- dartanalyzer_1) echo
- echo -e '\033[1mTASK: dartanalyzer_1\033[22m'
- echo -e 'dartanalyzer --fatal-infos --fatal-warnings .'
- dartanalyzer --fatal-infos --fatal-warnings . || EXIT_CODE=$?
- ;;
- dartfmt) echo
- echo -e '\033[1mTASK: dartfmt\033[22m'
- echo -e 'dartfmt -n --set-exit-if-changed .'
- dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
- ;;
- test) echo
- echo -e '\033[1mTASK: test\033[22m'
- echo -e 'pub run test'
- pub run test || EXIT_CODE=$?
- ;;
- *) echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
- EXIT_CODE=1
- ;;
- esac
+for PKG in ${PKGS}; do
+ echo -e "\033[1mPKG: ${PKG}\033[22m"
+ pushd "${PKG}" || exit $?
+ pub upgrade --no-precompile || exit $?
- shift
+ for TASK in "$@"; do
+ case ${TASK} in
+ command_0) echo
+ echo -e '\033[1mTASK: command_0\033[22m'
+ echo -e './compile_protos.sh'
+ ./compile_protos.sh || EXIT_CODE=$?
+ ;;
+ command_1) echo
+ echo -e '\033[1mTASK: command_1\033[22m'
+ echo -e 'make protos'
+ make protos || EXIT_CODE=$?
+ ;;
+ dartanalyzer_0) echo
+ echo -e '\033[1mTASK: dartanalyzer_0\033[22m'
+ echo -e 'dartanalyzer --fatal-warnings .'
+ dartanalyzer --fatal-warnings . || EXIT_CODE=$?
+ ;;
+ dartanalyzer_1) echo
+ echo -e '\033[1mTASK: dartanalyzer_1\033[22m'
+ echo -e 'dartanalyzer --fatal-infos --fatal-warnings .'
+ dartanalyzer --fatal-infos --fatal-warnings . || EXIT_CODE=$?
+ ;;
+ dartfmt) echo
+ echo -e '\033[1mTASK: dartfmt\033[22m'
+ echo -e 'dartfmt -n --set-exit-if-changed .'
+ dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
+ ;;
+ test) echo
+ echo -e '\033[1mTASK: test\033[22m'
+ echo -e 'pub run test'
+ pub run test || EXIT_CODE=$?
+ ;;
+ *) echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
+ EXIT_CODE=1
+ ;;
+ esac
+ done
+
+ popd
done
-exit $EXIT_CODE
+exit ${EXIT_CODE}