From cabd72b529a07dbbd709d0791d0eb20499583dd2 Mon Sep 17 00:00:00 2001 From: Ole Begemann Date: Tue, 28 Mar 2017 19:48:32 +0200 Subject: [PATCH 1/4] Include Xcode 8.3 and Swift 3.1 in Travis CI config --- .travis.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6186e58..11bb567 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,11 @@ matrix: include: - os: osx - language: generic - # Xcode version implicitly defines the Swift version to be used on macOS. + language: objective-c osx_image: xcode8.2 - + - os: osx + language: objective-c + osx_image: xcode8.3 - os: linux language: generic sudo: required @@ -12,7 +13,7 @@ matrix: - docker env: # The Docker image to use on Linux in Docker notation, - # e.g. "swift" or "myusername/myswift" or "swift:3.0.2". + # e.g. "swift" or "myusername/myswift" or "swift:3.1". # The image must have Swift installed so that the `swift` # command is in the `$PATH`. # @@ -21,8 +22,15 @@ matrix: # 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" + # image supports this, e.g. "swift:3.0.2" or "swift:latest". + - DOCKER_IMAGE="swift:3.0" + - os: linux + language: generic + sudo: required + services: + - docker + env: + - DOCKER_IMAGE="swift:3.1" script: - chmod ugo+x ./scripts/travis-build-script.sh From 5d683d2810888db0c2bf8363d960e2257e0c0db8 Mon Sep 17 00:00:00 2001 From: Ole Begemann Date: Wed, 29 Mar 2017 00:14:32 +0200 Subject: [PATCH 2/4] Fix --- scripts/travis-build-script.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/travis-build-script.sh b/scripts/travis-build-script.sh index df2fed6..6d36b43 100644 --- a/scripts/travis-build-script.sh +++ b/scripts/travis-build-script.sh @@ -4,17 +4,19 @@ # . Supports testing Swift Package Manager # packages on macOS and Linux. +set -ue -o pipefail + echo "Running on OS: ${TRAVIS_OS_NAME}" if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then # macOS # 1. Test using Swift Package Manager + swift --version swift build --clean swift build swift test # 2. Test using xcodebuild - set -o pipefail xcodebuild test -scheme SortedArray-macOS | xcpretty xcodebuild test -scheme SortedArray-iOS -destination "platform=iOS Simulator,name=iPhone 7,OS=10.1" | xcpretty xcodebuild test -scheme SortedArray-tvOS -destination "platform=tvOS Simulator,name=Apple TV 1080p" | xcpretty @@ -29,5 +31,5 @@ elif [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then # 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" + docker run --volume "$(pwd):/root/repo" ${DOCKER_IMAGE} /bin/bash -c "cd /root/repo; swift --version; swift build --clean; swift build; swift test" fi From b0df2ba1c1b84b7c64a69ab134839d16aaa2f309 Mon Sep 17 00:00:00 2001 From: Ole Begemann Date: Wed, 29 Mar 2017 00:15:38 +0200 Subject: [PATCH 3/4] Fix --- scripts/travis-build-script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/travis-build-script.sh b/scripts/travis-build-script.sh index 6d36b43..1895c3a 100644 --- a/scripts/travis-build-script.sh +++ b/scripts/travis-build-script.sh @@ -27,9 +27,9 @@ elif [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then 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} + 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 --version; swift build --clean; swift build; swift test" + docker run --volume "$(pwd):/root/repo" "${DOCKER_IMAGE}" /bin/bash -c "cd /root/repo; swift --version; swift build --clean; swift build; swift test" fi From 352e607acd34f9b269c04f305f20dcdff3090e10 Mon Sep 17 00:00:00 2001 From: Ole Begemann Date: Fri, 28 Apr 2017 11:07:25 +0200 Subject: [PATCH 4/4] [WIP] Travis --- Dockerfile | 11 +++++++++++ scripts/travis-build-script.sh | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..733ea43 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM swift:3.0.2 + +WORKDIR /package + +COPY Package.swift ./ +RUN swift package fetch + +COPY . ./ +RUN swift build + +CMD swift test diff --git a/scripts/travis-build-script.sh b/scripts/travis-build-script.sh index 1895c3a..89e032c 100644 --- a/scripts/travis-build-script.sh +++ b/scripts/travis-build-script.sh @@ -12,8 +12,8 @@ if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then # macOS # 1. Test using Swift Package Manager swift --version + # Replace with swift package clean when dropping Swift 3.0 support. swift build --clean - swift build swift test # 2. Test using xcodebuild @@ -31,5 +31,5 @@ elif [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then # 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 --version; swift build --clean; swift build; swift test" + docker run --volume "$(pwd):/package" "${DOCKER_IMAGE}" /bin/bash -c "cd /package; swift --version; swift build --clean; swift test" fi