Update gptdriverscript.yml #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: iOS Release Build and GPTDriver Tests | ||
on: | ||
push: | ||
branches: | ||
- 'Release-*' # Trigger for branches starting with "Release-" | ||
jobs: | ||
BuildAndTestAppOnGPTDriver: | ||
runs-on: macos-latest | ||
steps: | ||
# --- Step 1: Extract version from branch name --- | ||
- name: Extract version from branch name | ||
id: extract_version_step | ||
run: | | ||
BRANCH_NAME="${{ github.ref }}" | ||
BRANCH_NAME_WITHOUT_PREFIX="${BRANCH_NAME#refs/heads/}" | ||
VERSION=$(echo "$BRANCH_NAME_WITHOUT_PREFIX" | sed -n 's/^Release-\([0-9]*\.[0-9]*\.[0-9]*\)$/\1/p') | ||
if [ -z "$VERSION" ]; then | ||
echo "Error: Could not extract version from branch name '$BRANCH_NAME_WITHOUT_PREFIX'. Expected format: Release-X.Y.Z" | ||
exit 1 | ||
fi | ||
echo "Extracted versionName: $VERSION" | ||
echo "VERSION_STRING=$VERSION" >> $GITHUB_ENV | ||
MAJOR=$(echo "$VERSION" | cut -d. -f1) | ||
MINOR=$(echo "$VERSION" | cut -d. -f2) | ||
PATCH=$(echo "$VERSION" | cut -d. -f3) | ||
VERSION_CODE_INT=$(( MAJOR * 10000 + MINOR * 100 + PATCH )) | ||
echo "Calculated versionCode: $VERSION_CODE_INT" | ||
echo "VERSION_CODE_INT=$VERSION_CODE_INT" >> $GITHUB_ENV | ||
# --- Step 2: Checkout the iOS Branch SDK repository --- | ||
- name: Checkout BranchMetrics/ios-branch-deep-linking-attribution (SDK) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: BranchMetrics/ios-branch-deep-linking-attribution | ||
ref: ${{ github.ref }} | ||
path: ./branch-ios-sdk-repo | ||
# --- Step 3: Build the iOS Branch SDK Framework --- | ||
- name: Build Branch SDK Framework | ||
run: | | ||
echo "--- Listing contents of the SDK repo directory for debugging ---" | ||
ls -R . | ||
echo "-------------------------------------------------------------" | ||
echo "Attempting to build the SDK framework..." | ||
xcodebuild build -project BranchSDK.xcodeproj \ | ||
-scheme BranchSDK \ | ||
-configuration Debug \ | ||
-sdk iphonesimulator \ | ||
BUILD_DIR="${{ github.workspace }}/branch-ios-sdk-repo/build" \ | ||
SKIP_INSTALL=NO | ||
working-directory: ./branch-ios-sdk-repo | ||
# --- Step 4: Checkout the iOS Branch Link Simulator App repository --- | ||
- name: Checkout BranchMetrics/BranchLinkSimulator (App) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: BranchMetrics/BranchLinkSimulator | ||
ref: gptdriver/linkingTests | ||
path: ./ios-app-repo | ||
# --- Step 5: Copy the generated SDK Framework to the App's project --- | ||
- name: Copy generated SDK Framework to App's project | ||
run: | | ||
mkdir -p ./ios-app-repo/Frameworks | ||
cp -R ./branch-ios-sdk-repo/build/Debug-iphonesimulator/BranchSDK.framework ./ios-app-repo/Frameworks/ | ||
working-directory: ${{ github.workspace }} | ||
# --- Step 6: Archive iOS App (to prepare for IPA export) --- | ||
- name: Archive iOS App | ||
run: | | ||
ARCHIVE_PATH="${{ github.workspace }}/ios-app-repo/build/BranchLinkSimulator.xcarchive" | ||
echo "Archiving app to: $ARCHIVE_PATH" | ||
# Use 'xcodebuild archive' to create the .xcarchive | ||
# For simulator builds, you typically don't need real code signing, | ||
# but `archive` still requires some identity for metadata. | ||
xcodebuild archive -project BranchLinkSimulator.xcodeproj \ | ||
-scheme BranchLinkSimulator \ | ||
-configuration Debug \ | ||
-sdk iphonesimulator \ | ||
-destination 'platform=iOS Simulator,name=iPhone 15' \ | ||
-archivePath "$ARCHIVE_PATH" \ | ||
MARKETING_VERSION=${{ env.VERSION_STRING }} \ | ||
CURRENT_PROJECT_VERSION=${{ env.VERSION_CODE_INT }} \ | ||
FRAMEWORK_SEARCH_PATHS="$(SRCROOT)/Frameworks" \ | ||
ONLY_ACTIVE_ARCH=YES \ | ||
SKIP_INSTALL=NO \ | ||
CODE_SIGN_IDENTITY="" \ | ||
CODE_SIGNING_REQUIRED=NO \ | ||
CODE_SIGNING_ALLOWED=NO \ | ||
| xcpretty || true # xcpretty for cleaner logs, || true to prevent failure if xcpretty is missing | ||
if [ ! -d "$ARCHIVE_PATH" ]; then | ||
echo "Error: Archive not created at $ARCHIVE_PATH" | ||
exit 1 | ||
fi | ||
echo "ARCHIVE_PATH=$ARCHIVE_PATH" >> $GITHUB_ENV | ||
working-directory: ./ios-app-repo | ||
# --- Step 7: Export IPA from Archive --- | ||
- name: Export IPA from Archive | ||
run: | | ||
IPA_OUTPUT_DIR="${{ github.workspace }}/ios-app-repo/build/IPA_Output" | ||
mkdir -p "$IPA_OUTPUT_DIR" | ||
# Create a simple ExportOptions.plist for 'development' method (suitable for debug/test IPAs) | ||
EXPORT_OPTIONS_PLIST_PATH="$IPA_OUTPUT_DIR/ExportOptions.plist" | ||
cat <<EOF > "$EXPORT_OPTIONS_PLIST_PATH" | ||
<?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>method</key> | ||
<string>development</string> | ||
<key>compileBitcode</key> | ||
<false/> | ||
<key>uploadSymbols</key> | ||
<false/> | ||
</dict> | ||
</plist> | ||
EOF | ||
echo "Exporting IPA to: $IPA_OUTPUT_DIR" | ||
xcodebuild -exportArchive \ | ||
-archivePath "${{ env.ARCHIVE_PATH }}" \ | ||
-exportPath "$IPA_OUTPUT_DIR" \ | ||
-exportOptionsPlist "$EXPORT_OPTIONS_PLIST_PATH" \ | ||
| xcpretty || true # xcpretty for cleaner logs | ||
# Find the generated IPA file dynamically, as its exact name might vary | ||
GENERATED_IPA=$(find "$IPA_OUTPUT_DIR" -name "*.ipa" -print -quit) | ||
if [ -z "$GENERATED_IPA" ]; then | ||
echo "Error: Could not find generated IPA file in $IPA_OUTPUT_DIR." | ||
exit 1 | ||
fi | ||
echo "Generated IPA path: $GENERATED_IPA" | ||
echo "APP_PATH=$GENERATED_IPA" >> $GITHUB_ENV # Overwrite APP_PATH to point to the IPA | ||
echo "--- Contents of IPA Output Directory ---" | ||
ls -R "$IPA_OUTPUT_DIR" # Show what was actually exported | ||
echo "----------------------------------------" | ||
working-directory: ./ios-app-repo # This step also runs from the app's checkout root. | ||
# --- Step 8: Echo the location of the generated .ipa file --- | ||
- name: Echo .ipa file location | ||
run: | | ||
# APP_PATH now holds the path to the .ipa file from the previous step | ||
echo "Generated .ipa file location: ${{ env.APP_PATH }}" | ||
# --- Step 9: Upload Build Artifacts (now the .ipa) --- | ||
- name: Upload Build Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: BranchLinkSimulator-iOS-Debug-Build-IPA | ||
path: "${{ env.APP_PATH }}" # This now points to the IPA | ||
# --- Step 10: Upload and run tests on GPTDriver service (using .ipa) --- | ||
- name: Run GPTDriver tests | ||
run: | | ||
# !!! IMPORTANT: ENSURE your gptdriverrunscript.sh can handle .ipa files directly !!! | ||
# It currently expects a .app bundle. You MUST verify with the service | ||
# if it accepts .ipa files directly, or if the script needs modification | ||
# to extract the .app from the .ipa before upload. | ||
chmod +x ./branch-ios-sdk-repo/.github/gptdriverrunscript.sh | ||
bash ./branch-ios-sdk-repo/.github/gptdriverrunscript.sh "${{ env.APP_PATH }}" ios | ||
env: | ||
API_ORG_KEY: ${{ secrets.MOBILEBOOST_API_ORG_KEY }} | ||
API_TOKEN: ${{ secrets.MOBILEBOOST_API_ORG_KEY }} | ||
TEST_TAGS: Release |