|
53 | 53 | # --- Step 3: Build the iOS Branch SDK Framework --- |
54 | 54 | - name: Build Branch SDK Framework |
55 | 55 | run: | |
56 | | - echo "--- Listing contents of the SDK repo directory for debugging ---" |
57 | | - ls -R . # List contents recursively from the current working directory |
58 | | - echo "-------------------------------------------------------------" |
59 | | - echo "Attempting to build the SDK framework..." |
60 | 56 | xcodebuild build -project BranchSDK.xcodeproj \ |
61 | 57 | -scheme BranchSDK \ |
62 | 58 | -configuration Debug \ |
@@ -85,49 +81,66 @@ jobs: |
85 | 81 | # --- Step 6: Build the iOS Branch Link Simulator App using the local SDK Framework --- |
86 | 82 | - name: Build iOS App with local SDK |
87 | 83 | run: | |
88 | | - # Build the app. Adjust project/workspace, scheme, and destination if necessary. |
89 | | - # We're passing MARKETING_VERSION (versionName) and CURRENT_PROJECT_VERSION (versionCode) |
90 | | - xcodebuild build -project BranchLinkSimulator.xcodeproj \ |
| 84 | + # The -project flag defines the project root from which SRCROOT is relative. |
| 85 | + # The `BUILD_DIR` is where products are placed. We'll rely on xcodebuild's default DerivedData location, |
| 86 | + # and then capture the specific path to the .app bundle using `xcodebuild -showBuildSettings`. |
| 87 | + # This command ensures the build output variables are available. |
| 88 | + set -o pipefail # Fail if any part of the pipe fails |
| 89 | + XCODEBUILD_OUTPUT=$(xcodebuild build -project BranchLinkSimulator.xcodeproj \ |
91 | 90 | -scheme BranchLinkSimulator \ |
92 | 91 | -configuration Debug \ |
93 | 92 | -sdk iphonesimulator \ |
94 | 93 | -destination 'platform=iOS Simulator,name=iPhone 15' \ |
95 | 94 | MARKETING_VERSION=${{ env.VERSION_STRING }} \ |
96 | 95 | CURRENT_PROJECT_VERSION=${{ env.VERSION_CODE_INT }} \ |
97 | 96 | FRAMEWORK_SEARCH_PATHS="$(SRCROOT)/Frameworks" \ |
98 | | - # You might also need LD_RUNPATH_SEARCH_PATHS if it's an embedded framework |
99 | | - # LD_RUNPATH_SEARCH_PATHS="@loader_path/../Frameworks" |
| 97 | + ONLY_ACTIVE_ARCH=YES \ |
| 98 | + | xcpretty # xcpretty makes xcodebuild output readable, install it if not present |
| 99 | +
|
| 100 | + # Extract BUILT_PRODUCTS_DIR from xcodebuild output |
| 101 | + # This command must be run AFTER the build, and often requires parsing |
| 102 | + # a successful build log for the definitive path. |
| 103 | + # A more robust way is to query build settings directly: |
| 104 | + BUILT_PRODUCTS_DIR=$(xcodebuild -project BranchLinkSimulator.xcodeproj \ |
| 105 | + -scheme BranchLinkSimulator \ |
| 106 | + -configuration Debug \ |
| 107 | + -sdk iphonesimulator \ |
| 108 | + -showBuildSettings \ |
| 109 | + | grep -m 1 "BUILT_PRODUCTS_DIR =" \ |
| 110 | + | sed 's/.*BUILT_PRODUCTS_DIR = //') |
| 111 | +
|
| 112 | + if [ -z "$BUILT_PRODUCTS_DIR" ]; then |
| 113 | + echo "Error: Could not determine BUILT_PRODUCTS_DIR." |
| 114 | + exit 1 |
| 115 | + fi |
| 116 | +
|
| 117 | + echo "Detected BUILT_PRODUCTS_DIR: $BUILT_PRODUCTS_DIR" |
| 118 | + echo "BUILT_PRODUCTS_DIR=$BUILT_PRODUCTS_DIR" >> $GITHUB_ENV # Set as environment variable |
100 | 119 |
|
101 | | - echo "--- Listing contents of the app's build output directory for debugging ---" |
102 | | - # List the contents of the 'build' directory relative to the app's repo root |
103 | | - ls -R "${{ github.workspace }}/ios-app-repo/build/" || true # '|| true' prevents step from failing if dir doesn't exist |
104 | | - echo "-------------------------------------------------------------" |
105 | 120 | working-directory: ./ios-app-repo # Run xcodebuild from the App's checkout directory |
106 | 121 |
|
107 | 122 | # --- Step 7: Echo the location of the generated .app bundle --- |
108 | 123 | - name: Echo .app bundle location |
109 | 124 | run: | |
110 | | - # Renamed from APK_PATH to APP_PATH for iOS clarity |
111 | | - APP_PATH="./ios-app-repo/build/Debug-iphonesimulator/BranchLinkSimulator.app" |
| 125 | + # Use the dynamically determined BUILT_PRODUCTS_DIR |
| 126 | + APP_PATH="${{ env.BUILT_PRODUCTS_DIR }}/BranchLinkSimulator.app" |
112 | 127 | echo "Generated .app bundle location: $APP_PATH" |
113 | 128 |
|
114 | 129 | # --- Step 8: Upload Build Artifacts --- |
115 | 130 | - name: Upload Build Artifacts |
116 | 131 | uses: actions/upload-artifact@v4 |
117 | 132 | with: |
118 | 133 | name: BranchLinkSimulator-iOS-Debug-Build |
119 | | - # Path uses the new APP_PATH variable if you decide to define it globally, |
120 | | - # or simply the direct path as shown. |
121 | | - path: ./ios-app-repo/build/Debug-iphonesimulator/BranchLinkSimulator.app |
| 134 | + # Use the dynamically determined BUILT_PRODUCTS_DIR |
| 135 | + path: "${{ env.BUILT_PRODUCTS_DIR }}/BranchLinkSimulator.app" |
122 | 136 |
|
123 | 137 | # --- Step 9: Upload and run tests on GPTDriver service. --- |
124 | 138 | - name: Run GPTDriver tests |
125 | 139 | run: | |
126 | 140 | # Ensure the script is executable |
127 | 141 | chmod +x ./branch-ios-sdk-repo/.github/gptdriverrunscript.sh |
128 | | - # Execute the script, passing the .app path and platform |
129 | | - # Uses the APP_PATH variable defined in Step 7 |
130 | | - bash ./branch-ios-sdk-repo/.github/gptdriverrunscript.sh ./ios-app-repo/build/Debug-iphonesimulator/BranchLinkSimulator.app ios |
| 142 | + # Use the dynamically determined BUILT_PRODUCTS_DIR |
| 143 | + bash ./branch-ios-sdk-repo/.github/gptdriverrunscript.sh "${{ env.BUILT_PRODUCTS_DIR }}/BranchLinkSimulator.app" ios |
131 | 144 | env: |
132 | 145 | API_ORG_KEY: ${{ secrets.MOBILEBOOST_API_ORG_KEY }} |
133 | 146 | API_KEY: ${{ secrets.MOBILEBOOST_API_ORG_KEY }} |
|
0 commit comments