Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Travis CI config #27

Merged
merged 7 commits into from
Feb 7, 2019
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
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Created with package:mono_repo v1.2.1
language: dart

before_install:
- chmod +x tool/travis.sh

jobs:
include:
- stage: analyze
name: "SDK: stable - DIR: floor_generator - TASKS: dartfmt -n --set-exit-if-changed ."
script: ./tool/travis.sh dartfmt
env: PKG="floor_generator"
dart: stable
- stage: analyze
name: "SDK: stable - DIR: floor_generator - TASKS: dartanalyzer --fatal-infos --fatal-warnings ."
script: ./tool/travis.sh dartanalyzer
env: PKG="floor_generator"
dart: stable
- stage: unit_test
name: "SDK: stable - DIR: floor_generator - TASKS: pub run test"
script: ./tool/travis.sh test
env: PKG="floor_generator"
dart: stable

stages:
- analyze
- unit_test

cache:
directories:
- "$HOME/.pub-cache"
10 changes: 10 additions & 0 deletions floor_generator/mono_pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://github.com/dart-lang/mono_repo for details
dart:
- stable

stages:
- analyze:
- dartfmt
- dartanalyzer: --fatal-infos --fatal-warnings .
- unit_test:
- test
10 changes: 10 additions & 0 deletions mono_pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://github.com/dart-lang/mono_repo for details
dart:
- stable

stages:
- analyze:
- dartfmt
- dartanalyzer: --fatal-infos --fatal-warnings .
- unit_test:
- test
45 changes: 45 additions & 0 deletions tool/travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
# Created with package:mono_repo v1.2.1

if [ -z "$PKG" ]; then
echo -e '\033[31mPKG environment variable must be set!\033[0m'
exit 1
fi

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
dartanalyzer) echo
echo -e '\033[1mTASK: dartanalyzer\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

shift
done

exit $EXIT_CODE