added scripts for creating frameworks
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
87703edf8d
commit
9ad55d523e
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_vds_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
|
||||
53
Scripts/build_aggregate.sh
Executable file
53
Scripts/build_aggregate.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash -3
|
||||
|
||||
unset TOOLCHAINS #Xcode 7.3 BUG FIX http://stackoverflow.com/questions/36184930/xcodebuild-7-3-cant-enable-bitcode
|
||||
|
||||
# define variables
|
||||
C_PROJECT_NAME="VDS"
|
||||
PHONE_CONFIGURATION="Release"
|
||||
BUILD_DIR=$(xcodebuild -showBuildSettings -project ./${C_PROJECT_NAME}.xcodeproj | grep -w -o 'BUILD_DIR = .*' | cut -d\ -f3-)
|
||||
PHONE_ARCHIVE_PATH="${BUILD_DIR}/${PHONE_CONFIGURATION}-iphoneos/${C_PROJECT_NAME}.xcarchive"
|
||||
SIMULATOR_CONFIGURATION="Debug"
|
||||
SIMULATOR_ARCHIVE_PATH="${BUILD_DIR}/${SIMULATOR_CONFIGURATION}-iphonesimulator/${C_PROJECT_NAME}.xcarchive"
|
||||
FRAMEWORKS_DIR=$BUILD_DIR/../../../Frameworks/VDS
|
||||
UNIVERSAL_OUTPUTFOLDER="${BUILD_DIR}/universal"
|
||||
|
||||
# Build device archive
|
||||
xcodebuild archive \
|
||||
-scheme "${C_PROJECT_NAME}" \
|
||||
-configuration ${PHONE_CONFIGURATION} \
|
||||
-archivePath "${PHONE_ARCHIVE_PATH}" \
|
||||
-sdk iphoneos \
|
||||
-destination 'generic/platform=iOS' \
|
||||
-quiet \
|
||||
SKIP_INSTALL=NO \
|
||||
ONLY_ACTIVE_ARCH=NO \
|
||||
FRAMEWORK_SEARCH_PATHS="$FRAMEWORKS_DIR" \
|
||||
ALWAYS_SEARCH_USER_PATHS=true
|
||||
|
||||
# Build simulator archive
|
||||
xcodebuild archive \
|
||||
-scheme "${C_PROJECT_NAME}" \
|
||||
-configuration ${SIMULATOR_CONFIGURATION} \
|
||||
-archivePath "${SIMULATOR_ARCHIVE_PATH}" \
|
||||
-sdk iphonesimulator \
|
||||
-destination 'generic/platform=iOS Simulator' \
|
||||
-quiet \
|
||||
SKIP_INSTALL=NO \
|
||||
ONLY_ACTIVE_ARCH=NO \
|
||||
FRAMEWORK_SEARCH_PATHS=$FRAMEWORKS_DIR \
|
||||
ALWAYS_SEARCH_USER_PATHS=true
|
||||
|
||||
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
|
||||
|
||||
# Remove any existing xc framework.
|
||||
rm -rf ${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}.xcframework
|
||||
|
||||
# Create the xcframework in the universal output folder.
|
||||
xcodebuild -create-xcframework \
|
||||
-framework "${PHONE_ARCHIVE_PATH}/Products/Library/Frameworks/${C_PROJECT_NAME}.framework" \
|
||||
-framework "${SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${C_PROJECT_NAME}.framework" \
|
||||
-output ${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}.xcframework
|
||||
|
||||
# Copy the dSYM file as well.
|
||||
ditto "${PHONE_ARCHIVE_PATH}/dSYMs/${C_PROJECT_NAME}.framework.dSYM" "${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}.xcframework.dSYM"
|
||||
25
Scripts/download_dependencies.sh
Executable file
25
Scripts/download_dependencies.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/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 ./VDS.xcodeproj | grep -w -o 'BUILD_DIR = .*' | cut -d\ -f3-)
|
||||
FRAMEWORKS_DIR=$BUILD_DIR/../../../Frameworks/VDS
|
||||
|
||||
if [ ! -d $FRAMEWORKS_DIR ]; then
|
||||
mkdir -p $FRAMEWORKS_DIR
|
||||
fi
|
||||
|
||||
./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/VDSColorTokens.xcframework" GVJV_VDS_Maven/@vds-tokens/ios/VDSColorTokens.1.0.6.xcframework.zip
|
||||
|
||||
./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/VDSFormControlsTokens.xcframework" GVJV_VDS_Maven/@vds-tokens/ios/VDSFormControlsTokens.1.0.7.xcframework.zip
|
||||
|
||||
./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/VDSTypographyTokens.xcframework" GVJV_VDS_Maven/@vds-tokens/ios/VDSTypographyTokens.2.0.0.xcframework.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" | python3 -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
|
||||
86
Scripts/upload_framework.sh
Executable file
86
Scripts/upload_framework.sh
Executable file
@ -0,0 +1,86 @@
|
||||
#!/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
|
||||
FRAMEWORKVER=$4
|
||||
|
||||
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}")
|
||||
|
||||
# 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"
|
||||
25
Scripts/upload_vds_frameworks.sh
Executable file
25
Scripts/upload_vds_frameworks.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/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.
|
||||
#
|
||||
|
||||
BUILD_SETTINGS=$(xcodebuild -showBuildSettings -project ../VDS.xcodeproj)
|
||||
FRAMEWORK_VERSION=$(echo "$BUILD_SETTINGS" | grep -w -o 'MARKETING_VERSION = .*' | cut -d\ -f3-)
|
||||
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=$(echo "$BUILD_SETTINGS" | grep -w -o 'BUILD_DIR = .*' | cut -d\ -f3-)
|
||||
./upload_framework.sh $ARTIFACTORY_URL "${BUILD_DIR}/universal/VDS.xcframework" BPHV_MobileFirst_IOS/com/vzw/hss/myverizon/VDS/[VER]/VDS-[VER]-Debug-SNAPSHOT $FRAMEWORK_VERSION
|
||||
Loading…
Reference in New Issue
Block a user