From efce087f139e3f7dc9d27ea18b398e679d11be0d Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 14:40:57 +0300 Subject: [PATCH 01/12] Add cloudformation template. --- cloudformation/ci.template.js | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 cloudformation/ci.template.js diff --git a/cloudformation/ci.template.js b/cloudformation/ci.template.js new file mode 100644 index 00000000..1d12cdff --- /dev/null +++ b/cloudformation/ci.template.js @@ -0,0 +1,56 @@ +var cf = require('@mapbox/cloudfriend'); + +module.exports = { +AWSTemplateFormatVersion: '2010-09-09', + Resources: { + User: { + Type: 'AWS::IAM::User', + Properties: { + Policies: [ + { + PolicyName: 'List-objects-in-S3-bucket', + PolicyDocument: { + Statement: [ + { + Action: [ + 's3:GetObject', + 's3:GetObjectVersion', + 's3:GetObjectAcl', + 's3:ListBucket', + 's3:GetBucketLocation', + 's3:ListAllMyBuckets', + 's3:DeleteObject', + 's3:DeleteObjectVersion', + 's3:PutObject', + 's3:PutObjectAcl' + ], + Effect: 'Allow', + Resource: [ + 'arn:aws:s3:::mapbox', + 'arn:aws:s3:::mapbox/*' + ], + Condition: { + StringLike: { + 's3:prefix': '/vision/travis/ios-builds*' + } + } + } + ] + } + } + ] + } + }, + AccessKey: { + Type: 'AWS::IAM::AccessKey', + Properties: { + UserName: cf.ref('User') + } + } + }, + Outputs: { + AccessKeyId: { Value: cf.ref('AccessKey') }, + SecretAccessKey: { Value: cf.getAtt('AccessKey', 'SecretAccessKey') } + } +}; + From 2292400f5e2ce8a42369ad236db7fad358ad8d31 Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 14:41:07 +0300 Subject: [PATCH 02/12] Add utils scripts. --- scripts/utils/environment.sh | 33 +++++++++++++++++++++++++++++++++ scripts/utils/errors.sh | 17 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100755 scripts/utils/environment.sh create mode 100644 scripts/utils/errors.sh diff --git a/scripts/utils/environment.sh b/scripts/utils/environment.sh new file mode 100755 index 00000000..b14763e4 --- /dev/null +++ b/scripts/utils/environment.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +dir=$(dirname "${BASH_SOURCE[0]}") +source ${dir}/errors.sh + +################### +# Functions # +################### + +isDirExistsAtPath () { + local -r dirPath="$1" + [ -d "${dirPath}" ] +} + +isFileExistsAtPath() { + local -r filePath="$1" + [ -f "${filePath}" ] +} + +isFileExistsOnS3() { + local -r filePath="$1" + filesList=$(aws s3 ls "${filePath}") +} + +createEmptyFileOnS3() { + local -r remoteFilePath="$1" + local -r fileName="$(basename ${remoteFilePath})" + + localFilePath="./${fileName}" + touch "${localFilePath}" + aws s3 cp "${localFilePath}" "$(dirname ${remoteFilePath})/" + rm -f "${localFilePath}" +} diff --git a/scripts/utils/errors.sh b/scripts/utils/errors.sh new file mode 100644 index 00000000..38f01b05 --- /dev/null +++ b/scripts/utils/errors.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +############# +# Constants # +############# + +# 1-10 is reservated for custom return codes +ERROR_ILLEGAL_NUMBER_OF_ARGS=11 +ERROR_CANT_PARSE_ARGUMENTS=12 +ERROR_FILE_DOES_NOT_EXIST=13 +ERROR_CANT_CHANGE_DIRECTORY=14 + +#################### +# Helper functions # +#################### + +echoerr() { echo "ERROR: $*" 1>&2; } From 1be84a213636697f8c334f1e3b7fa7ef30ecbabf Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 14:41:31 +0300 Subject: [PATCH 03/12] Add basic scripts to run CI jobs. --- scripts/ci/build.sh | 64 +++++++ scripts/ci/init-dependencies-to-build.sh | 5 + scripts/ci/install-dependencies-to-build.sh | 5 + .../install-dependencies-to-pull-from-s3.sh | 5 + scripts/ci/prepare-for-cache.sh | 5 + scripts/ci/remote-build-artifacts.sh | 179 ++++++++++++++++++ 6 files changed, 263 insertions(+) create mode 100755 scripts/ci/build.sh create mode 100755 scripts/ci/init-dependencies-to-build.sh create mode 100755 scripts/ci/install-dependencies-to-build.sh create mode 100755 scripts/ci/install-dependencies-to-pull-from-s3.sh create mode 100755 scripts/ci/prepare-for-cache.sh create mode 100755 scripts/ci/remote-build-artifacts.sh diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh new file mode 100755 index 00000000..2dff97fc --- /dev/null +++ b/scripts/ci/build.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# Uncomment to debug +#DST='platform=iOS Simulator,OS=13.2,name=iPhone 11' +#IOS_BUILD_TYPE='Debug' +#IOS_BUILD_DIR='build' + +set -eo pipefail + +dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +source "${dir}/../utils/errors.sh" + +####################### +# Helper functions # +####################### + +function buildProject() { + local -r SCHEME_TO_BUILD="${1}" + + xcodebuild \ + -project "MapboxVision.xcodeproj" \ + -scheme "${SCHEME_TO_BUILD}" \ + -destination "${DST}" \ + -configuration "${IOS_BUILD_TYPE}" \ + build \ + CONFIGURATION_BUILD_DIR="${IOS_BUILD_DIR}/" | xcpretty +} + +function testProject() { + local -r SCHEME_TO_TEST="${1}" + + xcodebuild test \ + -project "MapboxVision.xcodeproj" \ + -scheme "${SCHEME_TO_TEST}" \ + -destination "${DST}" \ + -configuration "${IOS_BUILD_TYPE}" \ + CONFIGURATION_BUILD_DIR="${IOS_BUILD_DIR}/" | xcpretty +} + +################### +# Main script # +################### + +if [[ $# -eq 2 ]]; then + while [[ $# -gt 0 ]]; do + argument="$1" + + case ${argument} in + -b|--build) + schemeToBuild="$2" + buildProject "${schemeToBuild}" + shift + shift + ;; + *) # unknown option + echoerr "Can't parse arguments. Unknown argument ${argument}" + exit "$ERROR_CANT_PARSE_ARGUMENTS" + ;; + esac + done +else + echoerr "Arguments must be passed" + exit "$ERROR_ILLEGAL_NUMBER_OF_ARGS" +fi diff --git a/scripts/ci/init-dependencies-to-build.sh b/scripts/ci/init-dependencies-to-build.sh new file mode 100755 index 00000000..c13df3d8 --- /dev/null +++ b/scripts/ci/init-dependencies-to-build.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eo pipefail + +carthage bootstrap --platform ios --cache-builds diff --git a/scripts/ci/install-dependencies-to-build.sh b/scripts/ci/install-dependencies-to-build.sh new file mode 100755 index 00000000..d2b23630 --- /dev/null +++ b/scripts/ci/install-dependencies-to-build.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +gem install xcpretty diff --git a/scripts/ci/install-dependencies-to-pull-from-s3.sh b/scripts/ci/install-dependencies-to-pull-from-s3.sh new file mode 100755 index 00000000..1406c28b --- /dev/null +++ b/scripts/ci/install-dependencies-to-pull-from-s3.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +brew install awscli diff --git a/scripts/ci/prepare-for-cache.sh b/scripts/ci/prepare-for-cache.sh new file mode 100755 index 00000000..2e92cd48 --- /dev/null +++ b/scripts/ci/prepare-for-cache.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +brew cleanuph diff --git a/scripts/ci/remote-build-artifacts.sh b/scripts/ci/remote-build-artifacts.sh new file mode 100755 index 00000000..999cafed --- /dev/null +++ b/scripts/ci/remote-build-artifacts.sh @@ -0,0 +1,179 @@ +#!/usr/bin/env bash + +set -euo pipefail + +dir=$(dirname "${BASH_SOURCE[0]}") +source ${dir}/../utils/environment.sh +source ${dir}/../utils/errors.sh + +########################### +# Filescope variables # +########################### + +# Uncomment lines below to debug +#IOS_BUILD_TYPE="Release" +#IOS_PLATFORM_TYPE="iphoneos" +#IOS_BUILD_DIR="build" + +buildConfig="${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}" +s3BasePath="${AWS_S3_BUILD_ARTIFACTS_BASE_PATH}" + +# "Directories" on AWS S3 to store uploaded build products +s3BuildDir="${s3BasePath}/${buildConfig}" + +checksumFileName=".checksumSHA256.txt" +syncMarkerFileName=".syncMarkerFile" +pullMarkerFileName=".pullMakerFile" + +######################## +# Helper functions # +######################## + +function performCleanup() { + rm -f "${copiedRemoteChecksumFile}" +} + +function pullFramework() { + frameworkName="$1" + framework="${frameworkName}.framework" + + localFrameworkPath="Carthage/Build/iOS/${buildConfig}/${framework}" + remoteFrameworkPath="${s3BuildDir}/${frameworkName}/${framework}" + + echo + echo "Pulling ${framework}" + echo + + echo "Checking if ${framework} exists locally" + localChecksum="" + if ! isDirExistsAtPath "${localFrameworkPath}"; then + echo "Build product ${framework} is not found at ${localFrameworkPath}" + else + set +o pipefail + localChecksum=$(find "${localFrameworkPath}" -print0 | sort -z | xargs -0 shasum -a 256 2>&1 | shasum -a 256 | awk '{print $1}') + set -o pipefail + fi + + echo "Getting a checksum for a remote version of ${framework}" + + remoteChecksumFilePath="${s3BuildDir}/${frameworkName}/${checksumFileName}" + copiedRemoteChecksumFile="./${checksumFileName}" + + if isFileExistsOnS3 "${remoteChecksumFilePath}"; then + aws s3 cp "${remoteChecksumFilePath}" "${copiedRemoteChecksumFile}" + + if isFileExistsAtPath "${copiedRemoteChecksumFile}"; then + remoteChecksum=$(cat ${copiedRemoteChecksumFile}) + + echo + echo "Checksum for a remote build product: ${remoteChecksum}" + echo "Checksum for a local build product: ${localChecksum}" + + if [[ "${localChecksum}" == "${remoteChecksum}" ]]; then + echo "${frameworkName} at ${s3BuildDir} was not changed, update is not needed" + performCleanup + return + else + echo "There's a new version of ${framework}, update is needed" + fi + fi + else + echoerr "Checksum file does not exist at ${remoteChecksumFilePath}" + exit "$ERROR_FILE_DOES_NOT_EXIST" + fi + + # We implement "mutual exclusion" with files we can treat as flags. + # Each actor (repository) which wants to work with AWS S3, sets up a flag (creates an empty marker file). + # Other actors (repositories) can easily see the flags. + # When `mapbox-vision-ios` repo wants to pull the new verison of framework, it does the following: + # 1. raise the flag (creates a pullMarkerFlag file) + # 2. when there's no syncMarkerFlag, we start pulling process + # 3. when the pulling is completed, we lower the flag (remove pullMarkerFlag file) + # + # What we do in case when there's a syncMarkerFlag (step 2 above)? + # - we lower our flag (removes pullMarkerFlag file) + # - we wait until sync flag is lowered (syncMarkerFlag is removed) + # - then we raise our flag (create pullMarkerFlag file) + # + # The same behaviour is applicable for other actors (including mapbox-vision repo). + + echo + echo "Checking if build artifacts are currently being updated" + echo + syncMarkerFilePath="${s3BuildDir}/${frameworkName}/${syncMarkerFileName}" + pullMarkerFilePath="${s3BuildDir}/${frameworkName}/${pullMarkerFileName}" + + while : ; do + echo "Putting a pull marker to indicate we want to pull latest build artifacts" + createEmptyFileOnS3 "${pullMarkerFilePath}" + + if isFileExistsOnS3 "${syncMarkerFilePath}"; then + echo "Sync marker was found. That means uploading of build artifacts is in progress" + echo "Removing the pull marker" + aws s3 rm "${pullMarkerFilePath}" --quiet + else + echo "Sync marker was not found. That means we can start pulling process" + break + fi + + echo "Retrying in several seconds" + echo + sleep $[ ( $RANDOM % 20 ) + 1 ]s # 1-20 seconds random sleep, time interval to check flag next time + done + + echo + echo "Start syncing" + echo + + aws s3 sync "${s3BuildDir}/${frameworkName}/${framework}" "${localFrameworkPath}" + + echo + echo "Removing the pull marker to allow external repos to upload updated build artifacts" + echo + aws s3 rm "${pullMarkerFilePath}" --quiet + + performCleanup + echo "${framework} was sucсessfully pulled" +} + +function pullNativeBuildProducts() { + if [[ $# -ne 0 ]]; then + echoerr "Illegal arguments passed to ${FUNCNAME[0]}" + exit "$ERROR_ILLEGAL_NUMBER_OF_ARGS" + fi + + local -r buildArtifactsToPull=("MapboxVisionNative" "MapboxVisionARNative" "MapboxVisionSafetyNative") + + for framework in "${buildArtifactsToPull[@]}"; do + pullFramework "${framework}" + done + + echo + echo "Build dependecies are up-to-date now." + echo +} + +################### +# Main script # +################### + +if [[ $# -gt 0 ]]; then + while [[ $# -gt 0 ]]; do + argument="$1" + + case ${argument} in + -p|--pull-native-deps) + pullNativeBuildProducts + shift + shift + ;; + *) # unknown option + echoerr "Can't parse arguments. Unknown argument ${argument}" + exit "$ERROR_CANT_PARSE_ARGUMENTS" + ;; + esac + done +else + echoerr "Arguments must be passed" + exit "$ERROR_ILLEGAL_NUMBER_OF_ARGS" +fi From 1e0b472f0482ca4257f884716e2c130490f25d0d Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 14:41:40 +0300 Subject: [PATCH 04/12] Update Travis config. --- .travis.yml | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..4ecf638c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,77 @@ +git: + depth: 3 + submodules: false + +notifications: + email: false + +branches: + only: + - master + - dev + - /^release\/.*$/ + +stages: + - compile-and-test + +env: + global: + - JOBS=4 + - PROJECT_NAME="mapbox-vision-ios" + +jobs: + global: + env: + - IOS_BUILD_DIR='build' + include: + - &iOS + stage: compile-and-test + if: type = pull_request + os: osx + osx_image: xcode11.2 + language: swift + name: iOS / Release / Simulator / Xcode 11.2 + cache: + directories: + - SDK/Platforms/iOS/Carthage + - $HOME/Library/Caches/Homebrew + env: + - IOS_BUILD_TYPE='Release' + - IOS_PLATFORM_TYPE='iphonesimulator' + - DST='platform=iOS Simulator,OS=13.2.2,name=iPhone 11' + install: + - scripts/ci/install-dependencies-to-build.sh + - scripts/ci/install-dependencies-to-pull-from-s3.sh + before_script: + - scripts/ci/init-dependencies-to-build.sh + - scripts/ci/remote-build-artifacts.sh --pull-native-deps + - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/MapboxVisionNative.framework" "Carthage/Build/iOS" + - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/MapboxVisionARNative.framework" "Carthage/Build/iOS" + - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/MapboxVisionSafetyNative.framework" "Carthage/Build/iOS" + script: + - scripts/ci/build.sh --build MapboxVision + - scripts/ci/build.sh --build MapboxVisionAR + - scripts/ci/build.sh --build MapboxVisionSafety + before_cache: + - scripts/ci/prepare-for-cache.sh + + - <<: *iOS + name: iOS / Debug / Simulator / Xcode 11.2 + env: + - IOS_BUILD_TYPE='Debug' + - IOS_PLATFORM_TYPE='iphonesimulator' + - DST='platform=iOS Simulator,OS=13.2.2,name=iPhone 11' + + - <<: *iOS + name: iOS / Release / Device / Xcode 11.2 + env: + - IOS_BUILD_TYPE='Release' + - IOS_PLATFORM_TYPE='iphoneos' + - DST='generic/platform=iOS' + + - <<: *iOS + name: iOS / Debug / Device / Xcode 11.2 + env: + - IOS_BUILD_TYPE='Debug' + - IOS_PLATFORM_TYPE='iphoneos' + - DST='generic/platform=iOS' From 7aa64170c7c947fa66304a311a43b4c964196b07 Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 14:57:17 +0300 Subject: [PATCH 05/12] Update PolicyName in cloudformation template. --- cloudformation/ci.template.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudformation/ci.template.js b/cloudformation/ci.template.js index 1d12cdff..3bbd3bfc 100644 --- a/cloudformation/ci.template.js +++ b/cloudformation/ci.template.js @@ -8,7 +8,7 @@ AWSTemplateFormatVersion: '2010-09-09', Properties: { Policies: [ { - PolicyName: 'List-objects-in-S3-bucket', + PolicyName: 'AWS-S3-access', PolicyDocument: { Statement: [ { From 4b7a97ed61f264c721b6e3b0539b533379c7facc Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 16:04:00 +0300 Subject: [PATCH 06/12] Update cloudformation template. --- cloudformation/ci.template.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cloudformation/ci.template.js b/cloudformation/ci.template.js index 3bbd3bfc..784e9e59 100644 --- a/cloudformation/ci.template.js +++ b/cloudformation/ci.template.js @@ -28,12 +28,7 @@ AWSTemplateFormatVersion: '2010-09-09', Resource: [ 'arn:aws:s3:::mapbox', 'arn:aws:s3:::mapbox/*' - ], - Condition: { - StringLike: { - 's3:prefix': '/vision/travis/ios-builds*' - } - } + ] } ] } @@ -53,4 +48,3 @@ AWSTemplateFormatVersion: '2010-09-09', SecretAccessKey: { Value: cf.getAtt('AccessKey', 'SecretAccessKey') } } }; - From 72be90e5c049b7bd3c4e217881af1c68d44b513a Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 16:26:53 +0300 Subject: [PATCH 07/12] Move copying of pulled framework into the script. --- .travis.yml | 3 --- scripts/ci/remote-build-artifacts.sh | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ecf638c..681c5893 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,9 +45,6 @@ jobs: before_script: - scripts/ci/init-dependencies-to-build.sh - scripts/ci/remote-build-artifacts.sh --pull-native-deps - - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/MapboxVisionNative.framework" "Carthage/Build/iOS" - - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/MapboxVisionARNative.framework" "Carthage/Build/iOS" - - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/MapboxVisionSafetyNative.framework" "Carthage/Build/iOS" script: - scripts/ci/build.sh --build MapboxVision - scripts/ci/build.sh --build MapboxVisionAR diff --git a/scripts/ci/remote-build-artifacts.sh b/scripts/ci/remote-build-artifacts.sh index 999cafed..6c356b64 100755 --- a/scripts/ci/remote-build-artifacts.sh +++ b/scripts/ci/remote-build-artifacts.sh @@ -146,6 +146,9 @@ function pullNativeBuildProducts() { for framework in "${buildArtifactsToPull[@]}"; do pullFramework "${framework}" + + # copy pulled frameworks into Carthage/Build/iOS dir to allow building + cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/${framework}.framework" "Carthage/Build/iOS" done echo From 9b9951b82e01b544aac08ad1ac1f712c61723ef6 Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 16:38:41 +0300 Subject: [PATCH 08/12] Fix minor issues with S3 paths and cp command. --- scripts/ci/remote-build-artifacts.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/ci/remote-build-artifacts.sh b/scripts/ci/remote-build-artifacts.sh index 6c356b64..11c29b37 100755 --- a/scripts/ci/remote-build-artifacts.sh +++ b/scripts/ci/remote-build-artifacts.sh @@ -15,7 +15,8 @@ source ${dir}/../utils/errors.sh #IOS_PLATFORM_TYPE="iphoneos" #IOS_BUILD_DIR="build" -buildConfig="${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}" +# We have only release builds on AWS +buildConfig="Release-${IOS_PLATFORM_TYPE}" s3BasePath="${AWS_S3_BUILD_ARTIFACTS_BASE_PATH}" # "Directories" on AWS S3 to store uploaded build products @@ -144,11 +145,12 @@ function pullNativeBuildProducts() { local -r buildArtifactsToPull=("MapboxVisionNative" "MapboxVisionARNative" "MapboxVisionSafetyNative") - for framework in "${buildArtifactsToPull[@]}"; do - pullFramework "${framework}" + for buildArtifact in "${buildArtifactsToPull[@]}"; do + pullFramework "${buildArtifact}" # copy pulled frameworks into Carthage/Build/iOS dir to allow building - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/${framework}.framework" "Carthage/Build/iOS" + echo "Copying ${buildArtifact} into Carthage/Build/iOS dir" + cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/${buildArtifact}.framework" "Carthage/Build/iOS" done echo From 2638225937c442434f9450f584fd745542fc3929 Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 17:00:18 +0300 Subject: [PATCH 09/12] Fix issue with argument parsing in remote-build-artifacts.sh script. --- scripts/ci/remote-build-artifacts.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ci/remote-build-artifacts.sh b/scripts/ci/remote-build-artifacts.sh index 11c29b37..6c9797ce 100755 --- a/scripts/ci/remote-build-artifacts.sh +++ b/scripts/ci/remote-build-artifacts.sh @@ -170,7 +170,6 @@ if [[ $# -gt 0 ]]; then -p|--pull-native-deps) pullNativeBuildProducts shift - shift ;; *) # unknown option echoerr "Can't parse arguments. Unknown argument ${argument}" From b3b7792d0303b1c2421c1cc11bfc8caeb9b6d52e Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 17:26:45 +0300 Subject: [PATCH 10/12] Avoid usage of custom build dir. --- .travis.yml | 3 --- scripts/ci/build.sh | 10 ++++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 681c5893..8cecaa50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,9 +20,6 @@ env: - PROJECT_NAME="mapbox-vision-ios" jobs: - global: - env: - - IOS_BUILD_DIR='build' include: - &iOS stage: compile-and-test diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 2dff97fc..81989181 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -3,7 +3,6 @@ # Uncomment to debug #DST='platform=iOS Simulator,OS=13.2,name=iPhone 11' #IOS_BUILD_TYPE='Debug' -#IOS_BUILD_DIR='build' set -eo pipefail @@ -22,19 +21,18 @@ function buildProject() { -scheme "${SCHEME_TO_BUILD}" \ -destination "${DST}" \ -configuration "${IOS_BUILD_TYPE}" \ - build \ - CONFIGURATION_BUILD_DIR="${IOS_BUILD_DIR}/" | xcpretty + build | xcpretty } function testProject() { local -r SCHEME_TO_TEST="${1}" - xcodebuild test \ + xcodebuild \ + test \ -project "MapboxVision.xcodeproj" \ -scheme "${SCHEME_TO_TEST}" \ -destination "${DST}" \ - -configuration "${IOS_BUILD_TYPE}" \ - CONFIGURATION_BUILD_DIR="${IOS_BUILD_DIR}/" | xcpretty + -configuration "${IOS_BUILD_TYPE}" | xcpretty } ################### From e4d5afc48356eddfec22f6db2ac44df3c6aaaeea Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 17:29:08 +0300 Subject: [PATCH 11/12] Fix wrong path to local dependencies. --- scripts/ci/remote-build-artifacts.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/remote-build-artifacts.sh b/scripts/ci/remote-build-artifacts.sh index 6c9797ce..412d7bde 100755 --- a/scripts/ci/remote-build-artifacts.sh +++ b/scripts/ci/remote-build-artifacts.sh @@ -149,8 +149,9 @@ function pullNativeBuildProducts() { pullFramework "${buildArtifact}" # copy pulled frameworks into Carthage/Build/iOS dir to allow building + echo echo "Copying ${buildArtifact} into Carthage/Build/iOS dir" - cp -a "Carthage/Build/iOS/${IOS_BUILD_TYPE}-${IOS_PLATFORM_TYPE}/${buildArtifact}.framework" "Carthage/Build/iOS" + cp -a "Carthage/Build/iOS/Release-${IOS_PLATFORM_TYPE}/${buildArtifact}.framework" "Carthage/Build/iOS" done echo From 2982213b92a0b04852ce388ccb5b5479b5bfcd97 Mon Sep 17 00:00:00 2001 From: Dersim Davaod Date: Thu, 9 Apr 2020 17:42:13 +0300 Subject: [PATCH 12/12] Fix typo in prepare-for-cache.sh script. --- scripts/ci/prepare-for-cache.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/prepare-for-cache.sh b/scripts/ci/prepare-for-cache.sh index 2e92cd48..070ce763 100755 --- a/scripts/ci/prepare-for-cache.sh +++ b/scripts/ci/prepare-for-cache.sh @@ -2,4 +2,4 @@ set -euo pipefail -brew cleanuph +brew cleanup