Skip to content

Commit caa6944

Browse files
authored
Travis - run tests only for changed code (#665)
1 parent 2c0cacd commit caa6944

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

.travis.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,36 @@ before_install:
1313
- bundle exec pod install --project-directory=Example --repo-update
1414
- bundle exec pod install --project-directory=Firestore/Example --no-repo-update
1515
- brew install clang-format
16+
- echo "$TRAVIS_COMMIT_RANGE"
17+
- echo "$TRAVIS_PULL_REQUEST"
18+
- |
19+
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
20+
SKIP_FIREBASE=0
21+
SKIP_FIRESTORE=0
22+
else
23+
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -Eq '^(Firebase|Example)'
24+
SKIP_FIREBASE="$?"
25+
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -q Firestore
26+
SKIP_FIRESTORE="$?"
27+
fi
1628
1729
script:
1830
- "! git grep -I ' $'" # Fail on trailing whitespace in non-binary files
1931
- ./scripts/style.sh test-only # Validate clang-format compliance
20-
- ./test.sh
32+
- |
33+
if [ $SKIP_FIREBASE != 1 ]; then
34+
./test.sh
35+
fi
36+
- |
37+
if [ $SKIP_FIRESTORE != 1 ]; then
38+
./Firestore/test.sh
39+
fi
2140
2241
# TODO fix os_log deprecation warning in FIRLogger to remove --allow-warnings
23-
- bundle exec pod lib lint FirebaseCore.podspec --allow-warnings
42+
- |
43+
if [ $SKIP_FIREBASE != 1 ]; then
44+
bundle exec pod lib lint FirebaseCore.podspec --allow-warnings
45+
fi
2446
2547
# TODO - Uncomment subsequent lines once FirebaseCore source repo is in public Specs repo
2648
# - bundle exec pod lib lint FirebaseAuth.podspec

test.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,3 @@ if [ $RESULT != 0 ]; then exit $RESULT; fi
7070
test_tvOS; RESULT=$?
7171

7272
if [ $RESULT != 0 ]; then exit $RESULT; fi
73-
74-
# Also test Firestore
75-
Firestore/test.sh

0 commit comments

Comments
 (0)