From 69ffe90e214210f9fe098109809ff834461ecbde Mon Sep 17 00:00:00 2001 From: Emily Toop Date: Wed, 22 Aug 2018 13:06:44 +0100 Subject: [PATCH] Move iOS testing and document generation into post test jobs --- .travis.yml | 40 +++++++++------------------------------- scripts/cargo-doc.sh | 8 ++++++++ scripts/test-ios.sh | 23 +++++++++++++++++++++++ 3 files changed, 40 insertions(+), 31 deletions(-) create mode 100755 scripts/cargo-doc.sh create mode 100755 scripts/test-ios.sh diff --git a/.travis.yml b/.travis.yml index 2fd2352b..10368b0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,6 @@ language: rust os: osx before_install: - brew install sqlcipher --with-fts -env: - - MENTAT_RUST_VERSION=1.25.0 # Must align with `build/version.rs`. rust: - 1.25.0 - stable @@ -15,18 +13,15 @@ matrix: allow_failures: - rust: nightly fast_finish: true -install: - - | - if [[ "$TRAVIS_RUST_VERSION" = "$MENTAT_RUST_VERSION" ]]; then - rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios && - # The version of cargo-lipo in Crates.io doesn't contain any support for Cargo manifests in subdirectories and the build fail. - # We therefore need to use a Beta version that contains the right code. - cargo install --git https://github.com/TimNN/cargo-lipo --rev d347567ff337ee169ba46a624229a451dd6f6067 && - # If we don't list the devices available then, when we come to pick one during the test run, Travis doesn't - # think that there are any devices available and the build fails. - # TODO: See if there is a less time consuming way of doing this. - instruments -s devices - fi +jobs: + include: + - stage: "Test iOS" + rust: 1.25.0 + script: ./scripts/install-ios.sh + script: ./scripts/test-ios.sh + - stage: "Docs" + rust: 1.25.0 + script: ./scripts/cargo-doc.sh script: - cargo test --verbose --all - cargo test --features edn/serde_support --verbose --all @@ -38,21 +33,4 @@ script: for manifest in $(find . -type f -name Cargo.toml); do cargo test --manifest-path $manifest --verbose --no-default-features --features sqlcipher done - - | - if [[ "$TRAVIS_RUST_VERSION" = "$MENTAT_RUST_VERSION" ]]; then - pushd ffi && - cargo lipo --release && - popd && - pushd sdks/swift/Mentat && - xcodebuild -configuration Debug -scheme "Mentat Debug" -sdk iphonesimulator test -destination 'platform=iOS Simulator,name=iPhone X,OS=11.4' && - popd - fi -after_success: - - | - if [[ "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" ]]; then - cargo doc && - echo "" > target/doc/index.html && - git clone https://github.com/davisp/ghp-import.git && - ./ghp-import/ghp_import.py -n -p -f -r https://"$GH_TOKEN"@github.com/"$TRAVIS_REPO_SLUG.git" target/doc - fi cache: cargo diff --git a/scripts/cargo-doc.sh b/scripts/cargo-doc.sh new file mode 100755 index 00000000..52942bea --- /dev/null +++ b/scripts/cargo-doc.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" ]]; then + cargo doc && + echo "" > target/doc/index.html && + git clone https://github.com/davisp/ghp-import.git && + ./ghp-import/ghp_import.py -n -p -f -r https://"$GH_TOKEN"@github.com/"$TRAVIS_REPO_SLUG.git" target/doc +fi diff --git a/scripts/test-ios.sh b/scripts/test-ios.sh new file mode 100755 index 00000000..b836a37a --- /dev/null +++ b/scripts/test-ios.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Install iOS targets with Rustup. We need to install all targets as we are building a universal library. +rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios + +# The version of cargo-lipo in Crates.io doesn't contain any support for Cargo manifests in subdirectories and the build fail. +# We therefore need to use a Beta version that contains the right code. +cargo install --git https://github.com/TimNN/cargo-lipo --rev d347567ff337ee169ba46a624229a451dd6f6067 + +# If we don't list the devices available then, when we come to pick one during the test run, Travis doesn't +# think that there are any devices available and the build fails. +# TODO: See if there is a less time consuming way of doing this. +# instruments -s devices + +# Build Mentat as a universal iOS library. +pushd ffi +cargo lipo --release +popd + +# Run the iOS SDK tests using xcodebuild. +pushd sdks/swift/Mentat +xcodebuild -configuration Debug -scheme "Mentat Debug" -sdk iphonesimulator test -destination 'platform=iOS Simulator,name=iPhone X,OS=11.4' +popd