Skip to content

Commit

Permalink
Create separate install script for travis
Browse files Browse the repository at this point in the history
  • Loading branch information
nvzqz committed Jun 27, 2017
1 parent 22c0a27 commit fc301e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ matrix:
sudo: required
dist: trusty
env:
matrix:
- SWIFT_VERSION=swift-3.1
- SWIFT_VERSION=swift-3.0.2
- SWIFT_VERSIONS=(3.0.2 3.1)
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- FRAMEWORK_NAME="RandomKit"
- SWIFTENV_INSTALL="https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh"
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then gem install xcpretty -N; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then eval "$(curl -sL $SWIFTENV_INSTALL)"; fi
install: ./ci/install.sh
script: ./ci/travis.sh
15 changes: 15 additions & 0 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
export SWIFTENV_ROOT="$HOME/.swiftenv"
git clone https://github.com/kylef/swiftenv.git "$SWIFTENV_ROOT"
export PATH="$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"

for version in "$SWIFT_VERSIONS"; do
swiftenv install "$version"
done
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
gem install xcpretty -N
fi
7 changes: 6 additions & 1 deletion ci/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
set -e -o pipefail

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
swift test
for version in "$SWIFT_VERSIONS"; do
swiftenv global "$version"
swiftenv version

swift test
done
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
xcodebuild -version

Expand Down

0 comments on commit fc301e5

Please sign in to comment.