1+ name : iOS Release Build and GPTDriver Tests
2+
3+ on :
4+ push :
5+ branches :
6+ - ' Release-*' # Trigger for branches starting with "Release-"
7+
8+ jobs :
9+ BuildAndTestAppOnGPTDriver : # Updated job name
10+ runs-on : macos-latest # macOS runner is required for iOS builds
11+ steps :
12+ # --- Step 1: Extract version from branch name ---
13+ - name : Extract version from branch name
14+ id : extract_version_step
15+ run : |
16+ BRANCH_NAME="${{ github.ref }}"
17+ # Remove 'refs/heads/' prefix (e.g., refs/heads/Release-0.0.0 -> Release-0.0.0)
18+ BRANCH_NAME_WITHOUT_PREFIX="${BRANCH_NAME#refs/heads/}"
19+ # Extract version after "Release-" (e.g., Release-0.0.0 -> 0.0.0)
20+ VERSION=$(echo "$BRANCH_NAME_WITHOUT_PREFIX" | sed -n 's/^Release-\([0-9]*\.[0-9]*\.[0-9]*\)$/\1/p')
21+
22+ if [ -z "$VERSION" ]; then
23+ echo "Error: Could not extract version from branch name '$BRANCH_NAME_WITHOUT_PREFIX'. Expected format: Release-X.Y.Z"
24+ exit 1
25+ fi
26+
27+ echo "Extracted versionName: $VERSION"
28+ echo "VERSION_STRING=$VERSION" >> $GITHUB_ENV
29+
30+ # Convert semantic version to an integer for CFBundleVersion (versionCode equivalent)
31+ # Example: 1.2.3 -> 102003 (assuming max 2 digits for minor/patch)
32+ # This should be adjusted based on the maximum expected values for major/minor/patch
33+ MAJOR=$(echo "$VERSION" | cut -d. -f1)
34+ MINOR=$(echo "$VERSION" | cut -d. -f2)
35+ PATCH=$(echo "$VERSION" | cut -d. -f3)
36+
37+ # Calculate versionCode (CFBundleVersion) - ensure this fits in a 32-bit integer
38+ # Standard Android-like conversion: Major * 10000 + Minor * 100 + Patch
39+ # This provides sufficient uniqueness for most common versioning schemes.
40+ VERSION_CODE_INT=$(( MAJOR * 10000 + MINOR * 100 + PATCH ))
41+ echo "Calculated versionCode: $VERSION_CODE_INT"
42+ echo "VERSION_CODE_INT=$VERSION_CODE_INT" >> $GITHUB_ENV
43+
44+
45+ # --- Step 2: Checkout the iOS Branch SDK repository ---
46+ - name : Checkout BranchMetrics/ios-branch-deep-linking-attribution (SDK)
47+ uses : actions/checkout@v4
48+ with :
49+ repository : BranchMetrics/ios-branch-deep-linking-attribution
50+ ref : ${{ github.ref }} # Use the same branch that triggered the workflow
51+ path : ./branch-ios-sdk-repo # Checkout into a subdirectory
52+
53+ # --- Step 3: Build the iOS Branch SDK Framework ---
54+ - name : Build Branch SDK Framework
55+ run : |
56+ # Build for simulator. Adjust scheme if necessary.
57+ # The output framework will be in build/Debug-iphonesimulator/BranchSDK.framework
58+ xcodebuild build -project Branch-SDK/Branch-SDK.xcodeproj \
59+ -scheme BranchSDK \
60+ -configuration Debug \
61+ -sdk iphonesimulator \
62+ BUILD_DIR="${{ github.workspace }}/branch-ios-sdk-repo/build" \
63+ SKIP_INSTALL=NO
64+ working-directory : ./branch-ios-sdk-repo # Run xcodebuild from the SDK's checkout directory
65+
66+ # --- Step 4: Checkout the iOS Branch Link Simulator App repository ---
67+ - name : Checkout BranchMetrics/BranchLinkSimulator (App)
68+ uses : actions/checkout@v4
69+ with :
70+ repository : BranchMetrics/BranchLinkSimulator
71+ ref : gptdriver/linkingTests # Checkout the specific app branch
72+ path : ./ios-app-repo # Checkout into another subdirectory
73+
74+ # --- Step 5: Copy the generated SDK Framework to the App's project ---
75+ - name : Copy generated SDK Framework to App's project
76+ run : |
77+ # Create a 'Frameworks' directory within the app repo for the local SDK
78+ mkdir -p ./ios-app-repo/Frameworks
79+ # Copy the built framework
80+ cp -R ./branch-ios-sdk-repo/build/Debug-iphonesimulator/BranchSDK.framework ./ios-app-repo/Frameworks/
81+ working-directory : ${{ github.workspace }} # Run from the root of the GITHUB_WORKSPACE
82+
83+ # --- Step 6: Build the iOS Branch Link Simulator App using the local SDK Framework ---
84+ - name : Build iOS App with local SDK
85+ run : |
86+ # Build the app. Adjust project/workspace, scheme, and destination if necessary.
87+ # We're passing MARKETING_VERSION (versionName) and CURRENT_PROJECT_VERSION (versionCode)
88+ xcodebuild build -project BranchLinkSimulator.xcodeproj \
89+ -scheme BranchLinkSimulator \
90+ -configuration Debug \
91+ -sdk iphonesimulator \
92+ -destination 'platform=iOS Simulator,name=iPhone 15' \
93+ MARKETING_VERSION=${{ env.VERSION_STRING }} \
94+ CURRENT_PROJECT_VERSION=${{ env.VERSION_CODE_INT }} \
95+ FRAMEWORK_SEARCH_PATHS="$(SRCROOT)/Frameworks" \
96+ # You might also need LD_RUNPATH_SEARCH_PATHS if it's an embedded framework
97+ # LD_RUNPATH_SEARCH_PATHS="@loader_path/../Frameworks"
98+ working-directory : ./ios-app-repo # Run xcodebuild from the App's checkout directory
99+
100+ # --- Step 7: Echo the location of the generated .app bundle ---
101+ - name : Echo .app bundle location
102+ run : |
103+ APP_PATH="./ios-app-repo/build/Debug-iphonesimulator/BranchLinkSimulator.app"
104+ echo "Generated .app bundle location: $APP_PATH"
105+
106+ # --- Step 8: Upload Build Artifacts ---
107+ - name : Upload Build Artifacts
108+ uses : actions/upload-artifact@v4
109+ with :
110+ name : BranchLinkSimulator-iOS-Debug-Build
111+ path : ./ios-app-repo/build/Debug-iphonesimulator/BranchLinkSimulator.app
112+
113+ # --- Step 9: Upload and run tests on GPTDriver service. ---
114+ - name : Run GPTDriver tests
115+ run : |
116+ # Ensure the script is executable
117+ chmod +x ./branch-ios-sdk-repo/.github/gptdriverrunscript.sh
118+ # Execute the script, passing the .app path and platform
119+ bash ./branch-ios-sdk-repo/.github/gptdriverrunscript.sh ./ios-app-repo/build/Debug-iphonesimulator/BranchLinkSimulator.app ios
120+ env :
121+ API_ORG_KEY : ${{ secrets.MOBILEBOOST_API_ORG_KEY }}
122+ API_KEY : ${{ secrets.MOBILEBOOST_API_ORG_KEY }}
123+ TEST_TAGS : Release
0 commit comments