Merge branch 'feature/script_to_upload' into 'develop'
Feature/script to upload See merge request BPHV_MIPS/mvm_core_ui!732
This commit is contained in:
commit
df2dfc6f39
90
.gitlab-ci.yml
Normal file
90
.gitlab-ci.yml
Normal file
@ -0,0 +1,90 @@
|
||||
stages:
|
||||
# - test
|
||||
- download
|
||||
- build
|
||||
- deploy
|
||||
|
||||
#test:
|
||||
# stage: test
|
||||
# script:
|
||||
# - echo "This job tests something"
|
||||
# tags:
|
||||
# - xcode_12_2
|
||||
|
||||
download_artifacts:
|
||||
stage: download
|
||||
script:
|
||||
- ./Scripts/download_dependencies.sh
|
||||
only:
|
||||
- branches
|
||||
- develop
|
||||
tags:
|
||||
- bash_shell
|
||||
environment:
|
||||
name: oneartifactory
|
||||
url: https://oneartifactoryprod.verizon.com/artifactory
|
||||
variables:
|
||||
ARTIFACTORY_URL: https://oneartifactoryprod.verizon.com/artifactory
|
||||
|
||||
build_project:
|
||||
stage: build
|
||||
script:
|
||||
- ./Scripts/build_aggregate.sh
|
||||
only:
|
||||
- branches
|
||||
- develop
|
||||
tags:
|
||||
- xcode_12_2
|
||||
|
||||
deploy_snapshot:
|
||||
stage: deploy
|
||||
script:
|
||||
- cd Scripts && ./upload_core_ui_frameworks.sh
|
||||
only:
|
||||
- branches
|
||||
- develop
|
||||
tags:
|
||||
- bash_shell
|
||||
environment:
|
||||
name: oneartifactory
|
||||
url: https://oneartifactoryprod.verizon.com/artifactory
|
||||
variables:
|
||||
ARTIFACTORY_URL: https://oneartifactoryprod.verizon.com/artifactory
|
||||
|
||||
#promote_snapshot:
|
||||
# stage: go live
|
||||
# # Prevent artifacts from needing to re-download. Everything we need is in Artifactory.
|
||||
# dependencies: []
|
||||
# script:
|
||||
# # Grab the framework version from the xcode project.
|
||||
# - framework_ver=$(cd RemoteView && agvtool vers -terse)
|
||||
# - cd Scripts && ./promote_remote_view_frameworks.sh $framework_ver
|
||||
# only:
|
||||
# - tags
|
||||
# tags:
|
||||
# - bash_shell
|
||||
# environment:
|
||||
# name: oneartifactory
|
||||
# url: https://oneartifactoryprod.verizon.com/artifactory
|
||||
# variables:
|
||||
# ARTIFACTORY_URL: https://oneartifactoryprod.verizon.com/artifactory
|
||||
#
|
||||
#create_version_tag:
|
||||
# stage: tag
|
||||
# when: manual
|
||||
# # Prevent artifacts from needing to re-download.
|
||||
# dependencies: []
|
||||
# script:
|
||||
# # Grab the framework version from the xcode project and create a tag of the version.
|
||||
# - framework_ver=$(cd RemoteView && agvtool vers -terse)
|
||||
# - git tag -a "v${framework_ver}" -m "Version ${framework_ver} created by gitlab-ci Build"
|
||||
# # Extract the git repo url to ssh version (git@gitlab.verizon.com)
|
||||
# - ci_push_repo="git@${CI_SERVER_HOST}:${CI_PROJECT_PATH}.git"
|
||||
# - echo $ci_push_repo
|
||||
# # Set the remote url for pushing assuming the gitlab runner has SSH access to the repo.
|
||||
# - git remote set-url --push origin $ci_push_repo
|
||||
# - git push origin "v${framework_ver}"
|
||||
# only:
|
||||
# - develop
|
||||
# tags:
|
||||
# - bash_shell
|
||||
31
Scripts/build_aggregate.sh
Executable file
31
Scripts/build_aggregate.sh
Executable file
@ -0,0 +1,31 @@
|
||||
unset TOOLCHAINS #Xcode 7.3 BUG FIX http://stackoverflow.com/questions/36184930/xcodebuild-7-3-cant-enable-bitcode
|
||||
|
||||
# define output folder environment variable
|
||||
C_PROJECT_NAME="MVMCoreUI"
|
||||
PHONE_CONFIGURATION="Release"
|
||||
SIMULATOR_CONFIGURATION="Debug"
|
||||
BUILD_DIR=$(xcodebuild -showBuildSettings -project ./MVMCoreUI.xcodeproj | grep -w -o 'BUILD_DIR = .*' | cut -d\ -f3-)
|
||||
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${SIMULATOR_CONFIGURATION}-iphonesimulator/${C_PROJECT_NAME}.framework"
|
||||
FRAMEWORKS_DIR=$BUILD_DIR/Frameworks
|
||||
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/universal
|
||||
|
||||
# Step 1. Build Device and Simulator versions
|
||||
xcodebuild -scheme "${C_PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${PHONE_CONFIGURATION} -sdk iphoneos -archivePath "${BUILD_DIR}/${PHONE_CONFIGURATION}-iphoneos/${C_PROJECT_NAME}" archive SKIP_INSTALL=false FRAMEWORK_SEARCH_PATHS=$FRAMEWORKS_DIR ALWAYS_SEARCH_USER_PATHS=true
|
||||
|
||||
xcodebuild -target "${C_PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${SIMULATOR_CONFIGURATION} -sdk iphonesimulator BUILD_DIR=$BUILD_DIR FRAMEWORK_SEARCH_PATHS=$FRAMEWORKS_DIR ALWAYS_SEARCH_USER_PATHS=true ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=true
|
||||
|
||||
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
|
||||
|
||||
rm -rf ${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}.framework
|
||||
cp -R "${BUILD_DIR}/${PHONE_CONFIGURATION}-iphoneos/${C_PROJECT_NAME}.xcarchive/Products/Library/Frameworks/${C_PROJECT_NAME}.framework" ${UNIVERSAL_OUTPUTFOLDER}
|
||||
|
||||
# Step 2. Create universal binary file using lipo
|
||||
|
||||
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}" "${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}" "${SIMULATOR_LIBRARY_PATH}/${C_PROJECT_NAME}"
|
||||
|
||||
mv ${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME} ${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}
|
||||
|
||||
# For Swift framework, Swiftmodule needs to be copied in the universal framework
|
||||
if [ -d "${SIMULATOR_LIBRARY_PATH}/Modules/${C_PROJECT_NAME}.swiftmodule/" ]; then
|
||||
cp -a "${SIMULATOR_LIBRARY_PATH}/Modules/${C_PROJECT_NAME}.swiftmodule/" "${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}.framework/Modules/${C_PROJECT_NAME}.swiftmodule/"
|
||||
fi
|
||||
23
Scripts/download_dependencies.sh
Executable file
23
Scripts/download_dependencies.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# download_dependencies.sh
|
||||
#
|
||||
# Downloads all compiled framework flavors in from Artifactory.
|
||||
#
|
||||
|
||||
# Create new aggregate builds
|
||||
|
||||
if [ -z $ARTIFACTORY_URL ]; then
|
||||
ARTIFACTORY_URL="https://oneartifactoryprod.verizon.com/artifactory"
|
||||
fi
|
||||
|
||||
BUILD_DIR=$(xcodebuild -showBuildSettings -project ./MVMCoreUI.xcodeproj | grep -w -o 'BUILD_DIR = .*' | cut -d\ -f3-)
|
||||
FRAMEWORKS_DIR=$BUILD_DIR/Frameworks
|
||||
|
||||
if [ ! -d $FRAMEWORKS_DIR ]; then
|
||||
mkdir $FRAMEWORKS_DIR
|
||||
fi
|
||||
|
||||
./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/MVMCore.framework" BPHV_MobileFirst_IOS/com/vzw/hss/myverizon/MVMCore/1.0/MVMCore-1.0-Debug-SNAPSHOT.zip
|
||||
|
||||
./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/MVMAnimationFramework.framework" BPHV_MobileFirst_IOS/com/vzw/hss/myverizon/MVMAnimationFramework.framework/1.9/MVMAnimationFramework.framework-1.9.zip
|
||||
86
Scripts/download_framework.sh
Executable file
86
Scripts/download_framework.sh
Executable file
@ -0,0 +1,86 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# upload_framework.sh
|
||||
#
|
||||
# Downloads an iOS framework from Artificatory.
|
||||
#
|
||||
# An API key from Artifcatory is required in the api_key.private file before uploading.
|
||||
#
|
||||
|
||||
URL=$1
|
||||
LOCALPATH="${2}"
|
||||
REMOTEPATH="${3}"
|
||||
LOGFILE=$3
|
||||
LOCALDIR=$(dirname "${LOCALPATH}")
|
||||
LOCALBASE=$(basename "${LOCALPATH}")
|
||||
NEWFILEPATH="${LOCALDIR}"/$(basename "${REMOTEPATH}")
|
||||
VERSIONFILE=$LOCALDIR/../Checksums/"${LOCALBASE}".txt
|
||||
|
||||
if [ -z $URL ]; then
|
||||
echo "The artifactory instance url must be specified as the first argument!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#first argument is error message.
|
||||
exit_with_error () {
|
||||
echo "Error: $1"
|
||||
if [ -f "${NEWFILEPATH}" ]; then
|
||||
rm -rf "${NEWFILEPATH}" 2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "----------------------------------------------------------"
|
||||
echo "Logs for ${LOCALBASE}"
|
||||
|
||||
echo -e "Local Target: ${LOCALPATH}"
|
||||
echo -e "Remote Source: ${REMOTEPATH}"
|
||||
|
||||
if [ -z "$LOCALPATH" ]; then
|
||||
exit_with_error "Missing local path argument"
|
||||
fi
|
||||
|
||||
if [ -z "$REMOTEPATH" ]; then
|
||||
exit_with_error "Missing filename path argument"
|
||||
fi
|
||||
|
||||
#get local and remote checksums for comparison
|
||||
echo -e "Getting checksums..."
|
||||
echo -e "URL: ${URL}/api/storage/${REMOTEPATH}"
|
||||
JSON=$(curl --header "X-JFrog-Art-Api: ${ARTIFACTORY_APIKEY}" -X GET "${URL}/api/storage/${REMOTEPATH}")
|
||||
CHECKSUM=$(echo "$JSON" | python -c 'import sys, json; print json.load(sys.stdin)["checksums"]["sha1"]')
|
||||
if [[ -z "$CHECKSUM" ]]; then
|
||||
exit_with_error "No Checksum found in json: ${JSON}"
|
||||
fi
|
||||
echo "Remote checksum ${CHECKSUM}"
|
||||
if [[ -f "${VERSIONFILE}" ]]; then
|
||||
OLDCHECKSUM=$(cat "${VERSIONFILE}")
|
||||
else
|
||||
OLDCHECKSUM="none"
|
||||
mkdir -p $(dirname ${VERSIONFILE}) && touch "$VERSIONFILE"
|
||||
fi
|
||||
echo "Local checksum ${OLDCHECKSUM}"
|
||||
|
||||
#get new framework if no original framework, no local checksum, or remote checksum is different from local.
|
||||
if [ ! -e "${LOCALPATH}" ] || [ -z "$OLDCHECKSUM" ] || [ "$CHECKSUM" != "$OLDCHECKSUM" ]; then
|
||||
echo "Downloading..."
|
||||
echo -e "URL: ${URL}/${REMOTEPATH}"
|
||||
curl --header "X-JFrog-Art-Api: ${ARTIFACTORY_APIKEY}" -f -X GET "$URL/$REMOTEPATH" --output "${NEWFILEPATH}"
|
||||
if [ $? -eq 0 ] && [ -e "${NEWFILEPATH}" ]; then
|
||||
echo "Finished Downloading, begin unzip"
|
||||
unzip -q -o "${NEWFILEPATH}" -d "${LOCALDIR}"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Finished unzipping, remove zip"
|
||||
rm -rf "${NEWFILEPATH}"
|
||||
echo "Writing new checksum to file"
|
||||
echo "${CHECKSUM}" > "${VERSIONFILE}"
|
||||
echo "Successfully downloaded and unzipped archive."
|
||||
else
|
||||
exit_with_error "Error unzipping"
|
||||
fi
|
||||
else
|
||||
exit_with_error "Failed to download"
|
||||
fi
|
||||
else
|
||||
echo "Successful, No New Version"
|
||||
fi
|
||||
24
Scripts/upload_core_ui_frameworks.sh
Executable file
24
Scripts/upload_core_ui_frameworks.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# upload_core_ui_frameworks.sh
|
||||
#
|
||||
# Uploads all compiled framework flavors in MVMCoreUI to Artifactory with the SNAPSHOT classifier. This is to avoid accidently clobbering a release build of a particular version. Remove the classifier in Artificatory to make a release.
|
||||
#
|
||||
# Copied from Hedden, Kyle Matthew on 3/2/18.
|
||||
#
|
||||
|
||||
FRAMEWORK_VERSION=$(cd .. && agvtool vers -terse)
|
||||
if [ $(git tag --list | grep "v${FRAMEWORK_VERSION}") ]; then
|
||||
echo This version tag has already been committed! Aborting!
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create new aggregate builds
|
||||
|
||||
if [ -z $ARTIFACTORY_URL ]; then
|
||||
ARTIFACTORY_URL="https://oneartifactoryprod.verizon.com/artifactory"
|
||||
fi
|
||||
|
||||
# Upload
|
||||
BUILD_DIR=$(xcodebuild -showBuildSettings -project ../MVMCoreUI.xcodeproj | grep -w -o 'BUILD_DIR = .*' | cut -d\ -f3-)
|
||||
./upload_framework.sh $ARTIFACTORY_URL "${BUILD_DIR}/universal/MVMCoreUI.framework" BPHV_MobileFirst_IOS/com/vzw/hss/myverizon/MVMCoreUI/[VER]/MVMCoreUI-[VER]-Debug-SNAPSHOT
|
||||
89
Scripts/upload_framework.sh
Executable file
89
Scripts/upload_framework.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# upload_framework.sh
|
||||
#
|
||||
# Uploads an iOS framework to Artificatory given the local path as the first argument and the remote project name in Verizon OneArtifactory for the second argument.
|
||||
#
|
||||
# An API key from Artifcatory is required in the api_key.private file before uploading.
|
||||
#
|
||||
# The script will replace [VER] in the provided remote path with the version found in the framework bundle.
|
||||
#
|
||||
# Copied from Hedden, Kyle Matthew on 3/2/18.
|
||||
# Copyright © 2018 Verizon. All rights reserved.
|
||||
|
||||
URL=$1
|
||||
LOCALPATH=$2
|
||||
REMOTEPATH=$3
|
||||
|
||||
if [ -z $URL ]; then
|
||||
echo "The artifactory instance url must be specified as the first argument!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ">>> UPLOAD START <<<"
|
||||
echo "Local path: ${LOCALPATH}"
|
||||
echo "Remote path: ${REMOTEPATH}"
|
||||
|
||||
cat "${LOCALPATH}/Info.plist"
|
||||
|
||||
LOCALBASE=$(basename "${LOCALPATH}")
|
||||
LOCALDIR=$(dirname "${LOCALPATH}")
|
||||
|
||||
# Grab the framework version from the bundled Info.plist.
|
||||
FRAMEWORKVER=$(/usr/libexec/plistbuddy -c "Print :CFBundleShortVersionString" "${LOCALPATH}/Info.plist")
|
||||
echo -e "\nFramework version: \t${FRAMEWORKVER}"
|
||||
|
||||
# Replace the [VER] placeholders with the found version.
|
||||
REMOTEPATH="${REMOTEPATH//\[VER\]/$FRAMEWORKVER}"
|
||||
echo -e "Resolved path: \t\t${REMOTEPATH}"
|
||||
|
||||
if [ -z $ARTIFACTORY_APIKEY ]; then
|
||||
# Read the API key from a private file.
|
||||
read -r APIKEY < "api_key.private"
|
||||
else
|
||||
APIKEY=$ARTIFACTORY_APIKEY
|
||||
fi
|
||||
|
||||
if [ -z $APIKEY ]; then
|
||||
read -p "Artifactory API Key:" APIKEY
|
||||
echo $APIKEY >> api_key.private
|
||||
fi
|
||||
|
||||
echo -e "API Key: \t\t${APIKEY}"
|
||||
|
||||
# Zip the framework & DSYM for uploading.
|
||||
pushd $LOCALDIR
|
||||
echo -e "---------\nZipping: \t\t${LOCALBASE}.zip"
|
||||
zip -r -X "${LOCALBASE}.zip" $LOCALBASE
|
||||
# Generate framework's SHA-1 checksum.
|
||||
CHECKSUM=$(shasum -a 1 "${LOCALBASE}.zip" | cut -d " " -f 1)
|
||||
echo -e "SHA-1 Checksum: \t${CHECKSUM}"
|
||||
if [ -e ${LOCALBASE}.dSYM ]; then
|
||||
echo -e "---------\nZipping: \t\t${LOCALBASE}.dSYM.zip"
|
||||
zip -r -X "${LOCALBASE}.dSYM.zip" $LOCALBASE.dSYM
|
||||
# Generate its SHA-1 checksum for dsym.
|
||||
DSYM_CHECKSUM=$(shasum -a 1 "${LOCALBASE}.dSYM.zip" | cut -d " " -f 1)
|
||||
echo -e "SHA-1 Checksum: \t${DSYM_CHECKSUM}"
|
||||
fi
|
||||
popd
|
||||
mv ${LOCALPATH}.zip .
|
||||
if [ -e ${LOCALPATH}.dSYM.zip ]; then
|
||||
mv ${LOCALPATH}.dSYM.zip .
|
||||
fi
|
||||
|
||||
# Upload framework to Artifactory.
|
||||
echo -e "---------\nUploading to: \t\t${URL}/${REMOTEPATH}.zip"
|
||||
curl --header "X-JFrog-Art-Api: ${APIKEY}" --header "X-Checksum-Sha1: ${CHECKSUM}" -X PUT "${URL}/${REMOTEPATH}.zip" -T "${LOCALBASE}.zip"
|
||||
|
||||
# Cleanup.
|
||||
rm "${LOCALBASE}.zip"
|
||||
|
||||
if [ -e ${LOCALBASE}.dSYM.zip ]; then
|
||||
# Upload dsym Artifactory.
|
||||
echo -e "---------\nUploading to: \t\t${URL}/${REMOTEPATH}.dSYM.zip"
|
||||
curl --header "X-JFrog-Art-Api: ${APIKEY}" --header "X-Checksum-Sha1: ${DSYM_CHECKSUM}" -X PUT "${URL}/${REMOTEPATH}.dSYM.zip" -T "${LOCALBASE}.dSYM.zip"
|
||||
# Cleanup dsym.
|
||||
rm ${LOCALBASE}.dSYM.zip
|
||||
fi
|
||||
|
||||
echo -e "\n\n<<< UPLOAD COMPLETE >>>\n\n"
|
||||
Loading…
Reference in New Issue
Block a user