-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Version updated * Update CHANGELOG.md * Update CHANGELOG.md * Update README.md * Update CHANGELOG.md * Git action allow all PR * Github action trigger on push to master * Script updated * Version and date updated
- Loading branch information
1 parent
c8e854e
commit cdd7ecf
Showing
12 changed files
with
166 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash -e | ||
|
||
# prepare_coveralls_report.sh | ||
# | ||
# Usage: | ||
# $ ./prepare_coveralls_report.sh | ||
# | ||
|
||
# [coveralls] | ||
# - exclude coverage for Test codes by setting OptimizelySwiftSDK-iOS scheme > Test > Options > Gather coverage for selected targets | ||
mkdir xccov2lcov && cd xccov2lcov && git init && git fetch --depth=1 https://github.com/trax-retail/xccov2lcov.git && git checkout FETCH_HEAD | ||
xcrun xccov view --report --json ../$COVERAGE_DIR/Logs/Test/*.xcresult > coverage.json | ||
swift run xccov2lcov coverage.json > lcov.info | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash -e | ||
set -eou pipefail | ||
|
||
# expects the following environment variables defined | ||
# PLATFORM (eg. iOS Simulator) | ||
# OS (eg. 12.0) | ||
# NAME (eg. iPad Air) | ||
# OS_TYPE (eg. iOS) | ||
# SIMULATOR_XCODE_VERSION (Which Xcode's simulator to use) | ||
# Since github actions only provides limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. | ||
# We must use old simulators with current xcode since older xcode versions do not support swift 5 which is required by Swift SDK. | ||
# More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md | ||
# https://github.com/actions/virtual-environments/issues/551 | ||
|
||
# Older than Xcode 12 (12.4?) has different paths | ||
MAJOR_SIMULATOR_XCODE_VERSION=$(echo $SIMULATOR_XCODE_VERSION | cut -d. -f1) | ||
if [ "$MAJOR_SIMULATOR_XCODE_VERSION" -lt 12 ]; then | ||
os_folder="iPhoneOS" | ||
os="${OS/./-}" | ||
name="${NAME//[ ()]/-}" | ||
|
||
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes | ||
|
||
# Check if device is Apple tv, update os_folder for linking purposes | ||
if [[ "$NAME" = "Apple TV"* ]] | ||
then | ||
name="${name}-1080p" | ||
os_folder="AppleTVOS" | ||
fi | ||
|
||
# update os_folder as per xcode version | ||
if [ "$SIMULATOR_XCODE_VERSION" == 10.3 ] | ||
then | ||
os_folder="${os_folder}.platform/Developer/Library" | ||
else | ||
os_folder="${os_folder}.platform/Library/Developer" | ||
fi | ||
|
||
# Link and create simulators from older xcode versions which are not part of the current xcode version | ||
sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime | ||
xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" | ||
CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" | ||
else | ||
echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file | ||
CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) | ||
fi | ||
xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 | ||
xcrun simctl list | grep Booted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
#!/bin/bash -e | ||
|
||
# Because `hub` is used, this script expects the following environment variables defined in travis job settings: | ||
# Because `hub` is used, this script expects the following environment variables: | ||
# GITHUB_TOKEN - github api token with repo permissions (display value in build log setting: OFF) | ||
# GITHUB_USER - github username that GITHUB_TOKEN is associated with (display value in build log setting: ON) | ||
|
||
# Additionally, it needs the following environment variables: | ||
# VERSION - defined in .travis.yml | ||
|
||
# Variables starting with TRAVIS_ are default environment variables available to all Travis CI builds | ||
# VERSION - defined in swift.yml | ||
|
||
COLOR_RESET='\033[0m' | ||
COLOR_MAGENTA='\033[0;35m' | ||
COLOR_CYAN='\033[0;36m' | ||
MYREPO=${HOME}/workdir/${TRAVIS_REPO_SLUG} | ||
MYREPO=${HOME}/workdir/${REPO_SLUG} | ||
AUTOBRANCH=${GITHUB_USER}/prepareRelease${VERSION} | ||
BUILD_OUTPUT=/tmp/build.out | ||
touch $BUILD_OUTPUT | ||
|
||
function prep_workspace { | ||
rm -rf ${MYREPO} | ||
mkdir -p ${MYREPO} | ||
git clone -b ${TRAVIS_BRANCH} https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG} ${MYREPO} | ||
git clone -b ${BRANCH} https://${GITHUB_TOKEN}@github.com/${REPO_SLUG} ${MYREPO} | ||
cd ${MYREPO} | ||
git checkout -b ${AUTOBRANCH} | ||
} | ||
|
@@ -38,16 +35,27 @@ function error_handler() { | |
} | ||
|
||
function do_stuff { | ||
# keepalive for Travis | ||
while :; do sleep 10; echo -n .; done & | ||
trap "kill $!" EXIT | ||
trap 'error_handler' ERR | ||
|
||
# we need pod install or test_all.sh fails | ||
pod repo update | ||
pod install | ||
|
||
# we skip "test_all.sh" until we have a good reason to repeat it heere | ||
# 1. this test takes long and also flaky tests can interrupt release process | ||
# 2. this "test_all.sh" is supposed to pass before starting pre-release | ||
# 3. prep auto PRs will be tested in CI/CD before starting release process. | ||
|
||
# - cocoapods requires ENV['HOME'] with absolute path | ||
# | ||
# HOME=$(pwd) | ||
# gem install cocoapods -v $COCOAPODS_VERSION | ||
# pod _${COCOAPODS_VERSION}_ repo update | ||
# pod _${COCOAPODS_VERSION}_ install | ||
# | ||
# myscripts=( "update_version.sh ${VERSION}" "build_all.sh" "test_all.sh" ) | ||
myscripts=( "update_version.sh ${VERSION}" "build_all.sh" ) | ||
|
||
myscripts=( "update_version.sh ${VERSION}" "build_all.sh" "test_all.sh" ) | ||
for i in "${myscripts[@]}"; do | ||
echo -n "${i} " | ||
echo "===== ${i} =====" >> $BUILD_OUTPUT | ||
|
@@ -63,8 +71,18 @@ function push_changes { | |
git config user.email "[email protected]" | ||
git config user.name "${GITHUB_USER}" | ||
git add --all | ||
# this is like a try/catch | ||
git commit -m "ci(travis): auto release prep for $VERSION" || | ||
|
||
TITLE="ci(git-action): auto release prep for $VERSION" | ||
# an empty line required between title and description | ||
# a dummy ref (FSSDK-1234) for required FSSDK checking | ||
MESSAGE=$(cat <<END | ||
${TITLE} | ||
- [FSSDK-1234] | ||
END | ||
) | ||
|
||
git commit -m "${TITLE}" || | ||
{ | ||
case $? in | ||
1 ) | ||
|
@@ -77,10 +95,11 @@ function push_changes { | |
;; | ||
esac | ||
} | ||
git push https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG} ${AUTOBRANCH} | ||
PR_URL=$(hub pull-request --no-edit -b ${TRAVIS_BRANCH}) | ||
git push -f https://${GITHUB_TOKEN}@github.com/${REPO_SLUG} ${AUTOBRANCH} | ||
|
||
PR_URL=$(hub pull-request -b ${BRANCH} -h ${AUTOBRANCH} -m "${MESSAGE}") | ||
echo -e "${COLOR_CYAN}ATTENTION:${COLOR_RESET} review and merge ${COLOR_CYAN}${PR_URL}${COLOR_RESET}" | ||
echo "then to release to cocoapods use Travis CI's Trigger build with the following payload:" | ||
echo "then to release to cocoapods use Git action's Trigger build with the following payload:" | ||
echo -e "${COLOR_MAGENTA}env:${COLOR_RESET}" | ||
echo -e "${COLOR_MAGENTA} - RELEASE=true${COLOR_RESET}" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
echo 'Testing OptimizelySwiftSDK-iOS (iPhone 8,OS=12.1)' | ||
xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.1' test | ||
echo 'Testing OptimizelySwiftSDK-iOS (iPhone SE,OS=11.1)' | ||
xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone SE,OS=11.1' test | ||
echo 'Testing OptimizelySwiftSDK-iOS (iPhone XS,OS=13.2)' | ||
xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone XS,OS=13.2' test | ||
|
||
echo 'Testing OptimizelySwiftSDK-tvOS (Apple TV,OS=11.1)' | ||
xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV,OS=11.1' test | ||
echo 'Testing OptimizelySwiftSDK-tvOS (Apple TV,OS=12.1)' | ||
xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV,OS=12.1' test | ||
echo 'Testing OptimizelySwiftSDK-tvOS (Apple TV 4K,OS=13.2)' | ||
xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV 4K,OS=13.2' test | ||
#!/bin/bash -e | ||
# Since github actions only provides limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. | ||
# We must use old simulators with current xcode since older xcode versions do not support swift 5 which is required by Swift SDK. | ||
# More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md | ||
# https://github.com/actions/virtual-environments/issues/551 | ||
|
||
deviceModels=("iPhone 12" "iPhone 8" "iPad Air (4th generation)" "Apple TV") | ||
osVersions=("16.0" "14.4" "15.0" "16.0") | ||
xcodeVersions=("14.3" "14.3" "14.3" "14.3") | ||
platforms=("iOS" "iOS" "iOS" "tvOS") | ||
testSdks=("iphonesimulator" "iphonesimulator" "iphonesimulator" "appletvsimulator") | ||
|
||
for i in "${!deviceModels[@]}"; do | ||
export PLATFORM="${platforms[$i]} Simulator" | ||
export OS="${osVersions[$i]}" | ||
export NAME="${deviceModels[$i]}" | ||
export OS_TYPE="${platforms[$i]}" | ||
export SIMULATOR_XCODE_VERSION="${xcodeVersions[$i]}" | ||
|
||
Scripts/prepare_simulator.sh | ||
echo "Testing OptimizelySwiftSDK-${platforms[$i]} (${deviceModels[$i]},OS=${osVersions[$i]})" | ||
|
||
xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme "OptimizelySwiftSDK-${platforms[$i]}" -sdk "${testSdks[$i]}" -configuration Release -destination "platform=${platforms[$i]} Simulator,name=${deviceModels[$i]},OS=${osVersions[$i]}" test | ||
done |
This file was deleted.
Oops, something went wrong.