Skip to content

Commit 098c755

Browse files
committed
Update travis with mono_repo magic
1 parent f15fa5c commit 098c755

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.travis.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Created with https://github.com/dart-lang/mono_repo
2+
language: dart
3+
4+
dart:
5+
- dev
6+
- stable
7+
8+
env:
9+
- PKG=json_serializable TASK=dartanalyzer
10+
- PKG=json_serializable TASK=dartfmt
11+
- PKG=json_serializable TASK=test
12+
13+
matrix:
14+
excludes:
15+
- dart: stable
16+
env: PKG=json_serializable TASK=dartfmt
17+
18+
script: ./tool/travis.sh
19+
20+
# Only building master means that we don't run two builds for each pull request.
21+
branches:
22+
only: [master]
23+
24+
cache:
25+
directories:
26+
- $HOME/.pub-cache

tool/travis.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
# Created with https://github.com/dart-lang/mono_repo
3+
4+
# Fast fail the script on failures.
5+
set -e
6+
7+
if [ -z "$PKG" ]; then
8+
echo -e "PKG environment variable must be set!"
9+
exit 1
10+
elif [ -z "$TASK" ]; then
11+
echo -e "TASK environment variable must be set!"
12+
exit 1
13+
fi
14+
15+
pushd $PKG
16+
pub upgrade
17+
18+
case $TASK in
19+
dartanalyzer) echo
20+
echo -e "TASK: dartanalyzer"
21+
dartanalyzer .
22+
;;
23+
dartfmt) echo
24+
echo -e "TASK: dartfmt"
25+
dartfmt -n --set-exit-if-changed .
26+
;;
27+
test) echo
28+
echo -e "TASK: test"
29+
pub run test --run-skipped
30+
;;
31+
*) echo -e "Not expecting TASK '${TASK}'. Error!"
32+
exit 1
33+
;;
34+
esac

0 commit comments

Comments
 (0)