Skip to content

Commit

Permalink
Merge pull request #157 from pushkarnk/test-kitura
Browse files Browse the repository at this point in the history
Travis: Run Kitura tests against the current branch
  • Loading branch information
Pushkar N Kulkarni authored Jan 26, 2019
2 parents 32508e0 + 4b5df8d commit c02779e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
41 changes: 41 additions & 0 deletions .kitura-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Run Kitura-NIO tests
swift test
echo ">> Done running tests. Now preparing to run Kitura tests ..."

# Clone Kitura
echo ">> cd .. && git clone https://github.com/IBM-Swift/Kitura && cd Kitura"
cd .. && git clone https://github.com/IBM-Swift/Kitura && cd Kitura

# Set KITURA_NIO
echo ">> export KITURA_NIO=1"
export KITURA_NIO=1

# Build once
echo ">> swift build"
swift build

# Edit package Kitura-NIO to point to the current branch
echo ">> swift package edit Kitura-NIO --path ../Kitura-NIO"
swift package edit Kitura-NIO --path ../Kitura-NIO
echo ">> swift package edit returned $?."

# If the `swift package edit` command failed, exit with the same failure code
PACKAGE_EDIT_RESULT=$?
if [[ $PACKAGE_EDIT_RESULT != 0 ]]; then
echo ">> Failed to edit the Kitura-NIO dependency."
exit $PACKAGE_EDIT_RESULT
fi

# Run Kitura tests
echo ">> swift test"
swift test

# If the tests failed, exit
TEST_EXIT_CODE=$?
if [[ $TEST_EXIT_CODE != 0 ]]; then
exit $TEST_EXIT_CODE
fi
echo ">> Done running Kitura tests."

# Move back to the original build directory. This is needed on macOS builds for the subsequent swiftlint step.
cd ../Kitura-NIO
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ matrix:
- os: linux
dist: trusty
sudo: required
env: SWIFT_SNAPSHOT=4.0.3
env: SWIFT_SNAPSHOT=4.0.3 CUSTOM_TEST_SCRIPT=.kitura-test.sh
- os: linux
dist: trusty
sudo: required
env: SWIFT_SNAPSHOT=4.1.3
env: SWIFT_SNAPSHOT=4.1.3 CUSTOM_TEST_SCRIPT=.kitura-test.sh
- os: linux
dist: trusty
sudo: required
Expand All @@ -41,7 +41,7 @@ matrix:
- os: osx
osx_image: xcode9.2
sudo: required
env: SWIFT_SNAPSHOT=4.0.3 BREW_INSTALL_PACKAGES="libressl"
env: SWIFT_SNAPSHOT=4.0.3 BREW_INSTALL_PACKAGES="libressl" CUSTOM_TEST_SCRIPT=.kitura-test.sh
- os: osx
osx_image: xcode9.4
sudo: required
Expand All @@ -53,7 +53,7 @@ matrix:
- os: osx
osx_image: xcode10.1
sudo: required
env: SWIFT_SNAPSHOT=$SWIFT_DEVELOPMENT_SNAPSHOT BREW_INSTALL_PACKAGES="libressl"
env: SWIFT_SNAPSHOT=$SWIFT_DEVELOPMENT_SNAPSHOT BREW_INSTALL_PACKAGES="libressl" CUSTOM_TEST_SCRIPT=.kitura-test.sh

before_install:
- git clone https://github.com/IBM-Swift/Package-Builder.git
Expand Down

0 comments on commit c02779e

Please sign in to comment.