Skip to content

Commit a1948c2

Browse files
Update gptdriverscript.yml
1 parent 995b302 commit a1948c2

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

.github/workflows/gptdriverscript.yml

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ jobs:
5353
# --- Step 3: Build the iOS Branch SDK Framework ---
5454
- name: Build Branch SDK Framework
5555
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..."
6056
xcodebuild build -project BranchSDK.xcodeproj \
6157
-scheme BranchSDK \
6258
-configuration Debug \
@@ -85,49 +81,66 @@ jobs:
8581
# --- Step 6: Build the iOS Branch Link Simulator App using the local SDK Framework ---
8682
- name: Build iOS App with local SDK
8783
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 \
9190
-scheme BranchLinkSimulator \
9291
-configuration Debug \
9392
-sdk iphonesimulator \
9493
-destination 'platform=iOS Simulator,name=iPhone 15' \
9594
MARKETING_VERSION=${{ env.VERSION_STRING }} \
9695
CURRENT_PROJECT_VERSION=${{ env.VERSION_CODE_INT }} \
9796
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
100119
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 "-------------------------------------------------------------"
105120
working-directory: ./ios-app-repo # Run xcodebuild from the App's checkout directory
106121

107122
# --- Step 7: Echo the location of the generated .app bundle ---
108123
- name: Echo .app bundle location
109124
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"
112127
echo "Generated .app bundle location: $APP_PATH"
113128
114129
# --- Step 8: Upload Build Artifacts ---
115130
- name: Upload Build Artifacts
116131
uses: actions/upload-artifact@v4
117132
with:
118133
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"
122136

123137
# --- Step 9: Upload and run tests on GPTDriver service. ---
124138
- name: Run GPTDriver tests
125139
run: |
126140
# Ensure the script is executable
127141
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
131144
env:
132145
API_ORG_KEY: ${{ secrets.MOBILEBOOST_API_ORG_KEY }}
133146
API_KEY: ${{ secrets.MOBILEBOOST_API_ORG_KEY }}

0 commit comments

Comments
 (0)