Skip to content

Commit

Permalink
Skip unit tests if only e2e tests are changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Seulgi Kim authored and sgkim126 committed Jan 28, 2019
1 parent c76041a commit d42f3e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
os: osx
before_install:
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-doc-change` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-change '^(docs|spec)/'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-change '^test/'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
install:
- rustup toolchain install nightly-2018-12-06
- rustup component add rustfmt-preview --toolchain nightly-2018-12-06
Expand All @@ -29,7 +30,7 @@ jobs:
os: osx
before_install:
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-doc-change` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-change '^(docs|spec)/'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
install:
- nvm install 10
- nvm use 10
Expand All @@ -48,7 +49,8 @@ jobs:
sudo: required
before_install:
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-doc-change` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-change '^(docs|spec)/'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-change '^test/'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
install:
- rustup toolchain install nightly-2018-12-06
- rustup component add rustfmt-preview --toolchain nightly-2018-12-06
Expand All @@ -64,7 +66,7 @@ jobs:
sudo: required
before_install:
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-doc-change` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
- SKIP=`.travis/check-change '^(docs|spec)/'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
install:
- nvm install 10
- nvm use 10
Expand Down
12 changes: 6 additions & 6 deletions .travis/check-doc-change → .travis/check-change
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# HOW TO USE THIS SCRIPT IN .travis.yml
# > SKIP=`.travis/check-doc-change` && if [[ "$SKIP" = skip ]]; then exit 0; fi
# > SKIP=`.travis/check-change` && if [[ "$SKIP" = skip ]]; then exit 0; fi
# There are three possible output categories, and desired effects in this script
# 1. exit 0; stdout "skip" -> Stop the process with a "Success" status.
# 2. exit 0; stdout "noskip" -> Do not skip the build process.
Expand Down Expand Up @@ -63,8 +63,8 @@ push)
# A--B--C
# Branch was forwarded A to B, or B to C. $TRAVIS_COMMIT_RANGE will be A...B or B...C
# NOTE:
# When job for A->B contains non-doc changes, and didn't finished yet,
# a job B->C which only contains doc changes will automatically cancel A->B
# When job for A->B contains non-target changes, and didn't finished yet,
# a job B->C which only contains target changes will automatically cancel A->B
# and can report B->C to success.
# TODO: disable auto cancel on master
echo "Forward push"
Expand All @@ -91,10 +91,10 @@ pull_request)
esac

git log --oneline --decorate --all --graph | head -n 10;
echo "Check doc change for: ${COMMIT_RANGE}"
if ! git diff --name-only ${COMMIT_RANGE} | grep -qvE '^(docs|spec)/'
echo "Check changes for: ${COMMIT_RANGE}"
if ! git diff --name-only ${COMMIT_RANGE} | grep -qvE "$1"
then
echo "Only docs were updated, or there's no change, not running the CI."
echo "Only '$1' were updated, or there's no change, not running the CI."
skip_travis
fi

Expand Down

0 comments on commit d42f3e8

Please sign in to comment.