Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug fixes and race conditions #424

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/build-and-quality-checks-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ on:
jobs:
build:
name: Code Quality Checks(v2)
runs-on: macOS-latest
runs-on: macos-latest

steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install xcpretty
run: gem install xcpretty

- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'
# - name: Select Xcode version
# run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'

- name: Build SDK(iOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 13' | xcpretty
xcodebuild build -scheme Rudder-iOS -workspace Rudder.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 14' | xcpretty

- name: Build SDK(watchOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 - 45mm' | xcpretty
xcodebuild build -scheme Rudder-watchOS -workspace Rudder.xcworkspace -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)' | xcpretty

- name: Build SDK(tvOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty
xcodebuild build -scheme Rudder-tvOS -workspace Rudder.xcworkspace -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty

- name: Build SDK(macOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=macOS,variant=Mac Catalyst' | xcpretty
# - name: Build SDK(macOS)
# run: |
# xcodebuild build -scheme Rudder-macOS -workspace Rudder.xcworkspace -destination 'platform=macOS,variant=Mac Catalyst' | xcpretty

- name: Install Cocoapods
run: gem install cocoapods
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-pr-title-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check PR title
uses: rudderlabs/[email protected]
8 changes: 4 additions & 4 deletions .github/workflows/deploy-cocoapods-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
jobs:
build:
name: Deploy to Cocoapods
runs-on: macOS-latest
runs-on: macos-latest
steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'
# - name: Select Xcode version
# run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'

- name: Install Cocoapods
run: gem install cocoapods
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/draft-new-beta-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Draft new Beta release

on:
workflow_dispatch:
inputs:
beta_version:
description: "Beta version(Only single digit, example: 1)"
required: true

jobs:
draft-new-beta-release:
name: Draft a new Beta release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/fix/') || startsWith(github.ref, 'refs/heads/feat/')
steps:
- name: Checkout source branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Node 16
uses: actions/setup-node@v3
with:
node-version: 16

# In order to make a commit, we need to initialize a user.
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email [email protected]

# Calculate the next release version based on conventional semantic release
- name: Create release branch
id: create-release
env:
HUSKY: 0
run: |
source_branch_name=${GITHUB_REF##*/}
release_type=beta-release
git fetch origin master-v2
git fetch --tags origin
git merge origin/master-v2
current_version=$(jq -r .version package.json)

npx standard-version --skip.commit --skip.tag --skip.changelog
new_version="$(jq -r .version package.json).beta.${{ github.event.inputs.beta_version }}"
git reset --hard

branch_name="${release_type}/${new_version}"

echo "Source branch for new release is $source_branch_name"
echo "Current version is $current_version"
echo "Release type is $release_type"
echo "New version is $new_version"
echo "New release branch name is $branch_name"
git checkout -b "$branch_name"
git push --set-upstream origin "$branch_name"

echo "source_branch_name=$source_branch_name" >> $GITHUB_OUTPUT
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
echo "new_version=$new_version" >> $GITHUB_OUTPUT
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
echo "NEW_VERSION_VALUE=$new_version" >> $GITHUB_ENV

- name: Bump version
id: finish-release
env:
HUSKY: 0
run: |
echo "Current version: $CURRENT_VERSION_VALUE"
echo "New version: $NEW_VERSION_VALUE"
npx replace $CURRENT_VERSION_VALUE $NEW_VERSION_VALUE package.json
git add package.json
echo ${{ steps.create-release.outputs.new_version }}
echo "commit_summary=$SUMMARY" >> $GITHUB_OUTPUT
git commit -m "chore(beta-relase): $NEW_VERSION_VALUE"
git tag -a "v$NEW_VERSION_VALUE" -m "chore: release v$NEW_VERSION_VALUE"
git push origin "v$NEW_VERSION_VALUE"

- name: Push new version in release branch & tag
run: |
git push

- name: Checkout
uses: actions/checkout@v4
with:
ref: '${{ steps.create-release.outputs.branch_name }}'

- name: Install Cocoapods
run: gem install cocoapods

- name: 'Convert podspec to podspec.json'
run: |
pod ipc spec Rudder.podspec > Rudder.podspec.json

- name: Add Private Spec Repo to CocoaPods installation
run: |
pod repo add rudderlabs https://${{secrets.PAT_USERNAME}}:${{secrets.PAT}}@github.com/rudderlabs/Specs.git

- name: Add Podspec to repo
run: |
pod repo push rudderlabs Rudder.podspec.json
2 changes: 1 addition & 1 deletion .github/workflows/draft-new-release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: startsWith(github.ref, 'refs/heads/develop-v2') || startsWith(github.ref, 'refs/heads/hotfix-v2/')
steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-new-release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
echo "release_version=$VERSION" >> $GITHUB_OUTPUT

- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
50 changes: 28 additions & 22 deletions .github/workflows/test-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,42 @@ on:
jobs:
build:
name: 'Tests & Coverage(v2)'
runs-on: macOS-latest

runs-on: macos-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2

- name: Install xcpretty
run: gem install xcpretty

# - name: Run tests(suite)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' | xcpretty

# - name: Run tests(1)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -only-testing "Tests/Tests" | xcpretty

# - name: Run tests(2)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -only-testing "Tests/Tests2" | xcpretty

# - name: Run tests(3)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -only-testing "Tests/Tests3" | xcpretty

- name: Install SonarCloud
run: npm install -g sonarqube-scanner

- name: Run tests(iOS)
run: |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -enableCodeCoverage YES -derivedDataPath build | xcpretty

- name: Run tests(tvOS)
run: |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-tvOS test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' -enableCodeCoverage YES -derivedDataPath build | xcpretty

- name: Run tests(watchOS)
run: |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-watchOS test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)' -enableCodeCoverage YES -derivedDataPath build | xcpretty

- name: Collect coverage into one XML report
run: |
bash xccov-to-generic.sh build/Logs/Test/*.xcresult/ > generic-coverage.xml

- name: SonarCloud Scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner -Dsonar.host.url=https://sonarcloud.io

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
Configuration.json
.DS_Store
.scannerwork
.scannerwork

# Sonar
relative_or_absolute_path_to_cache_location
compile_commands.json
GoogleService-Info.plist
RudderConfig.plist
configuration.json
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- Examples

- RudderTests
analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
- explicit_self

Expand Down
30 changes: 30 additions & 0 deletions Examples/RudderConfig/RudderConfig.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// RudderConfig.swift
// RudderOneTrust
//
// Created by Pallab Maiti on 26/01/23.
//

import Foundation

@objc
class RudderConfig: NSObject, Codable {
@objc let WRITE_KEY: String
@objc let PROD_DATA_PLANE_URL: String
@objc let PROD_CONTROL_PLANE_URL: String
@objc let LOCAL_DATA_PLANE_URL: String
@objc let LOCAL_CONTROL_PLANE_URL: String
@objc let DEV_DATA_PLANE_URL: String
@objc let DEV_CONTROL_PLANE_URL: String
@objc let STORAGE_LOCATION: String
@objc let DOMAIN_IDENTIFIER: String

@objc
class func create(from url: URL) -> RudderConfig? {
if let data = try? Data(contentsOf: url),
let rudderConfig = try? PropertyListDecoder().decode(RudderConfig.self, from: data) {
return rudderConfig
}
return nil
}
}
24 changes: 24 additions & 0 deletions Examples/RudderConfig/SampleRudderConfig.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>WRITE_KEY</key>
<string></string>
<key>PROD_DATA_PLANE_URL</key>
<string></string>
<key>PROD_CONTROL_PLANE_URL</key>
<string></string>
<key>LOCAL_DATA_PLANE_URL</key>
<string></string>
<key>LOCAL_CONTROL_PLANE_URL</key>
<string></string>
<key>DEV_DATA_PLANE_URL</key>
<string></string>
<key>DEV_CONTROL_PLANE_URL</key>
<string></string>
<key>STORAGE_LOCATION</key>
<string></string>
<key>DOMAIN_IDENTIFIER</key>
<string></string>
</dict>
</plist>
1 change: 1 addition & 0 deletions Examples/SampleObjC-tvOS/SampleObjC-tvOS/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[config dataPlaneURL:DATA_PLANE_URL];
[config trackLifecycleEvents:YES];
[config recordScreenViews:YES];
[config loglevel:RSLogLevelDebug];
client = [RSClient sharedInstance];
[client configureWith:config];
[client track:@"track 1"];
Expand Down
Loading
Loading