Skip to content

Commit

Permalink
chore: setup integration test in ci
Browse files Browse the repository at this point in the history
- Use Travis Branch Trigger to run integration test.
- Use Travis Pull Request Trigger to run unit test.
- Run both tests in master branch.
  • Loading branch information
doitian committed Apr 12, 2019
1 parent 00bca19 commit fb82031
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git:
depth: 2
submodules: false

if: 'branch IN (master, develop, staging, trying) OR type != push OR fork = true OR tag =~ ^v'
if: 'branch IN (master, develop) OR branch =~ /^rc\// OR type != push OR fork = true OR tag IS present'

env:
global:
Expand Down
43 changes: 31 additions & 12 deletions devtools/ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,43 @@ echo "TRAVIS_BRANCH=$TRAVIS_BRANCH"

cargo sweep -s

if [ "$FMT" = true ]; then
make fmt
fi
if [ "$CHECK" = true ]; then
make check
make clippy
fi
if [ "$TEST" = true ]; then
make test
# Run test only in master branch and pull requests
RUN_TEST=false
# Run integration only in master, develop and rc branches
RUN_INTEGRATION=false
if [ "$TRAVIS_PULL_REQUEST" != false ]; then
RUN_TEST=true
else
RUN_INTEGRATION=true
if [ "$TRAVIS_BRANCH" = master ]; then
RUN_TEST=true
fi
fi

git diff --exit-code Cargo.lock
if [ "$RUN_TEST" = true ]; then
if [ "$FMT" = true ]; then
make fmt
fi
if [ "$CHECK" = true ]; then
make check
make clippy
fi
if [ "$TEST" = true ]; then
make test
fi

git diff --exit-code Cargo.lock
fi

if [ "$TRAVIS_BRANCH" = master -o "$TRAVIS_BRANCH" = staging -o "$TRAVIS_BRANCH" = trying ]; then
cargo build
# We'll create PR for develop and rc branches to trigger the integration test.
if [ "$RUN_INTEGRATION" = true ]; then
echo "Running integration test..."
cargo build --verbose
cd test && cargo run ../target/debug/ckb

# Switch to release mode when the running time is much longer than the build time.
# cargo build --release
# cargo run --release -p ckb-test target/release/ckb
else
echo "Skip integration test..."
fi

0 comments on commit fb82031

Please sign in to comment.