Skip to content

Commit

Permalink
Release 3.10.3 (#525)
Browse files Browse the repository at this point in the history
* 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
muzahidul-opti authored Dec 1, 2023
1 parent c8e854e commit cdd7ecf
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 85 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Swift

on:
push:
branches: [ master ]
branches: [ 'master' ]
pull_request:
branches: [ master ]
branches: [ '*' ]
workflow_dispatch:
inputs:
PREP:
Expand All @@ -17,7 +17,7 @@ on:
description: release

env:
VERSION: 4.0.0-beta
VERSION: 3.10.3

jobs:

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Optimizely Swift SDK Changelog

## 3.10.3
December 1, 2023

### Bug Fixes
* Remove redundant post request body in upload task. ([#521](https://github.com/optimizely/swift-sdk/pull/521/)).

### Enhancement
* Add privacy manifest file ([#522](https://github.com/optimizely/swift-sdk/pull/522/)).
* Handle duplicate keys in experiment ([#523](https://github.com/optimizely/swift-sdk/pull/523/)).

## 3.10.2
March 14, 2023

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ Add the dependency on the Optimizely Swift SDK with Swift Package Manager in `Xc
#### CocoaPods
1. Add the following lines to the _Podfile_:<pre>
```use_frameworks!```
```pod 'OptimizelySwiftSDK', '~> 3.10.2'```
```pod 'OptimizelySwiftSDK', '~> 3.10.3'```
</pre>

2. Run the following command: <pre>``` pod install ```</pre>

Further installation instructions for Cocoapods: https://guides.cocoapods.org/using/getting-started.html

#### Carthage
1. Add the following lines to the _Cartfile_:<pre>```github "optimizely/swift-sdk" ~> 3.10.2```</pre>
1. Add the following lines to the _Cartfile_:<pre>```github "optimizely/swift-sdk" ~> 3.10.3```</pre>

2. Run the following command:<pre>```carthage update```</pre>

Expand Down
3 changes: 2 additions & 1 deletion Scripts/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ main() {

xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -configuration Release "${action}"
xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -configuration Release "${action}"
xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-macOS -configuration Release "${action}"
xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-watchOS -configuration Release "${action}"
}

main

14 changes: 14 additions & 0 deletions Scripts/prepare_coveralls_report.sh
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 ..
48 changes: 48 additions & 0 deletions Scripts/prepare_simulator.sh
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
53 changes: 36 additions & 17 deletions Scripts/run_prep.sh
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}
}
Expand All @@ -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
Expand All @@ -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 )
Expand All @@ -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}"
}
Expand Down
30 changes: 25 additions & 5 deletions Scripts/run_release.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
#!/usr/bin/env bash
set -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)

# COCOAPODS_TRUNK_TOKEN - should be defined in job settings so that we can `pod trunk push`

MYREPO=${HOME}/workdir/${REPO_SLUG}

function prep_workspace {
rm -rf ${MYREPO}
mkdir -p ${MYREPO}
git clone -b ${BRANCH} https://${GITHUB_TOKEN}@github.com/${REPO_SLUG} ${MYREPO}
cd ${MYREPO}
}

function release_github {
LAST_RELEASE=$(git describe --abbrev=0 --tags)

if [[ ${LAST_RELEASE} == "v${VERSION}" ]]; then
echo "${LAST_RELEASE} tag exists already (probably created while in the current release process). Skipping..."
return
fi

CHANGELOG="CHANGELOG.md"

# check that CHANGELOG.md has been updated
Expand All @@ -22,11 +38,14 @@ function release_github {

DESCRIPTION=$(awk "/^${NEW_VERSION}$/,/^${LAST_VERSION:-nothingmatched}$/" ${CHANGELOG} | grep -v "^${LAST_VERSION:-nothingmatched}$")

hub release create v${VERSION} -m "Release ${VERSION}" -m "${DESCRIPTION}" -t "${TRAVIS_BRANCH}"

hub release create v${VERSION} -m "Release ${VERSION}" -m "${DESCRIPTION}" -t "${BRANCH}"
}

function release_cocoapods {

# - cocoapods requires ENV['HOME'] with absolute path
HOME=$(pwd)
gem install cocoapods -v $COCOAPODS_VERSION

# ---- Optimizely's pods ----
pods=(OptimizelySwiftSDK);
Expand All @@ -39,13 +58,14 @@ function release_cocoapods {
do
podname=${pods[i]};
printf "Pushing the ${podname} pod to COCOAPODS.ORG .\n"
pod trunk push --allow-warnings ${podname}.podspec
pod update
pod _${COCOAPODS_VERSION}_ trunk push --allow-warnings ${podname}.podspec
pod _${COCOAPODS_VERSION}_ update
done

}

function main {
prep_workspace
release_github
release_cocoapods
}
Expand Down
4 changes: 2 additions & 2 deletions Scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -e

# run xcode unit tests
#
Expand All @@ -7,7 +7,7 @@
#

# unit tests for PR only
if [[ "$TRAVIS_BRANCH" == "master" ]]
if [[ "$BRANCH" == "master" ]]
then
xcodebuild test -derivedDataPath $COVERAGE_DIR -workspace OptimizelySwiftSDK.xcworkspace -scheme $SCHEME -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk $TEST_SDK -destination "platform=$PLATFORM,OS=$OS,name=$NAME" ONLY_ACTIVE_ARCH=YES | tee buildoutput | xcpretty && test ${PIPESTATUS[0]} -eq 0
fi
22 changes: 0 additions & 22 deletions Scripts/start_simulator.sh

This file was deleted.

36 changes: 24 additions & 12 deletions Scripts/test_all.sh
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
21 changes: 0 additions & 21 deletions Scripts/upload_coveralls.sh

This file was deleted.

0 comments on commit cdd7ecf

Please sign in to comment.