-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ole/travis-ci
Continuous integration setup with Travis CI
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
matrix: | ||
include: | ||
- os: osx | ||
language: generic | ||
# Xcode version implicitly defines the Swift version to be used on macOS. | ||
osx_image: xcode8.2 | ||
|
||
- os: linux | ||
language: generic | ||
sudo: required | ||
services: | ||
- docker | ||
env: | ||
# The Docker image to use on Linux in Docker notation, | ||
# e.g. "swift" or "myusername/myswift" or "swift:3.0.2". | ||
# The image must have Swift installed so that the `swift` | ||
# command is in the `$PATH`. | ||
# | ||
# I recommend Docker Hub's "official" (not maintained by Apple) | ||
# Swift image at https://hub.docker.com/r/_/swift/. Its name | ||
# is simply "swift". | ||
# | ||
# You can use tags to select a specific Swift version if the | ||
# image supports it, e.g. "swift:3.0.2" or "swift:latest". | ||
DOCKER_IMAGE="swift:3.0.2" | ||
|
||
script: | ||
- chmod ugo+x ./scripts/travis-build-script.sh | ||
- ./scripts/travis-build-script.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# The build script used for continuous integration builds on Travis CI | ||
# <https://travis-ci.org/>. Supports testing Swift Package Manager | ||
# packages on macOS and Linux. | ||
|
||
echo "Running on OS: ${TRAVIS_OS_NAME}" | ||
|
||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then | ||
# macOS | ||
swift build --clean | ||
swift build | ||
swift test | ||
elif [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then | ||
# Linux | ||
echo "Using Docker image: ${DOCKER_IMAGE}" | ||
# Download the Docker container. This is not strictly necessary since | ||
# docker run would automatically download a missing container. | ||
docker pull ${DOCKER_IMAGE} | ||
# Share the current directory (where Travis checked out the repository) | ||
# with the Docker container. | ||
# Then, in the container, cd into that directory and run the tests. | ||
docker run --volume "$(pwd):/root/repo" ${DOCKER_IMAGE} /bin/bash -c "cd /root/repo; swift build --clean; swift build; swift test" | ||
fi |