Skip to content

Commit

Permalink
ci: split into multiple jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Dec 13, 2017
1 parent cb723a5 commit cc9e799
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 36 deletions.
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@ language: bash
os: linux
dist: trusty

env:
- BUILD_TYPE=build
matrix:
include:
- env:
- BUILD_TYPE=build
- env:
- BUILD_TYPE=platformio
- env:
- BUILD_TYPE=docs
- env:
- BUILD_TYPE=package
- env:
- BUILD_TYPE=host_tests

install:
- pip install --user -r doc/requirements.txt
Expand All @@ -25,6 +35,7 @@ deploy:
on:
repo: esp8266/Arduino
tags: true
condition: "$BUILD_TYPE = package"

notifications:
email:
Expand Down
56 changes: 22 additions & 34 deletions tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,31 +169,8 @@ function build_sketches_with_platformio()
set -e
}

function run_travis_ci_build()
function install_arduino()
{
# Build documentation using Sphinx
echo -e "travis_fold:start:docs"
cd $TRAVIS_BUILD_DIR/doc
build_docs
echo -e "travis_fold:end:docs"

# Build release package
echo -e "travis_fold:start:build_package"
cd $TRAVIS_BUILD_DIR/package
build_package
echo -e "travis_fold:end:build_package"

if [ "$TRAVIS_TAG" != "" ]; then
echo "Skipping tests for tagged build"
return 0;
fi

# Run host side tests
echo -e "travis_fold:start:host_tests"
cd $TRAVIS_BUILD_DIR/tests
run_host_tests
echo -e "travis_fold:end:host_tests"

# Install Arduino IDE and required libraries
echo -e "travis_fold:start:sketch_test_env_prepare"
cd $TRAVIS_BUILD_DIR
Expand All @@ -202,7 +179,10 @@ function run_travis_ci_build()
cd $TRAVIS_BUILD_DIR
install_libraries
echo -e "travis_fold:end:sketch_test_env_prepare"
}

function build_sketches_with_arduino()
{
# Compile sketches
echo -e "travis_fold:start:sketch_test"
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries"
Expand All @@ -212,20 +192,28 @@ function run_travis_ci_build()
echo -e "travis_fold:start:size_report"
cat size.log
echo -e "travis_fold:end:size_report"

# PlatformIO
echo -e "travis_fold:start:install_platformio"
install_platformio
echo -e "travis_fold:end:install_platformio"

echo -e "travis_fold:start:build_sketches_with_platformio"
build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose"
echo -e "travis_fold:end:build_sketches_with_platformio"
}

set -e

if [ "$BUILD_TYPE" = "build" ]; then
run_travis_ci_build
install_arduino
build_sketches_with_arduino
elif [ "$BUILD_TYPE" = "platformio" ]; then
# PlatformIO
install_platformio
build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose"
elif [ "$BUILD_TYPE" = "docs" ]; then
# Build documentation using Sphinx
cd $TRAVIS_BUILD_DIR/doc
build_docs
elif [ "$BUILD_TYPE" = "package" ]; then
# Build release package
cd $TRAVIS_BUILD_DIR/package
build_package
elif [ "$BUILD_TYPE" = "host_tests" ]; then
# Run host side tests
cd $TRAVIS_BUILD_DIR/tests
run_host_tests
fi

0 comments on commit cc9e799

Please sign in to comment.