Browse Source

Update Github workflow build & run destinations, fix respective integration tests (#545)

All tests are updated to use macOS 15, Xcode 16.4, and iOS 18.6. This also requires an update to the integration tests, which were looking for a different title on the Password Manager field.

Ordinarily, I would see "breakage due to macos-latest/default sims/default xcode" changing as a useful reminder to update our repo. Due to [an unfixed bug in the iOS 18.4 simulators](https://developer.apple.com/forums/thread/777999?page=4) and https://github.com/actions/runner-images/issues/12758, using macOS-latest and the default simulators does not work.

More on Github runtime updates:
Github has https://github.com/actions/runner-images/issues/12541 the latest three versions of the platform tools for Xcode. If the default Xcode runtime for a macOS image is not one of those, simulators won't be available. This is currently true of macOS-15, where Xcode 16.0 is the default. As such, we need to specify the Xcode version. I've specified the macOS version as well to ensure that version of Xcode is available.
w-goog 7 months ago
parent
commit
8062b4c323

+ 3 - 1
.github/workflows/builds.yml

@@ -15,10 +15,12 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-latest]
+        os: [macos-15]
   
     steps:
     - uses: actions/checkout@v3
+    - name: Select Xcode
+      run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
     - name: Archive for iOS
       run: |
         xcodebuild \

+ 8 - 9
.github/workflows/integration_tests.yml

@@ -47,7 +47,7 @@ jobs:
         fi
 
   swift-button-functional-test:
-    runs-on: macos-latest
+    runs-on: macos-15
     needs: check-pr-body-for-key
     # Don't run if triggered by a PR from a fork since our Secrets won't be provided to the runner.
     if: ${{ needs.check-pr-body-for-key.outputs.RUN_INTEGRATION == 'yes' && !github.event.pull_request.head.repo.fork }}
@@ -57,6 +57,8 @@ jobs:
     steps:
     - name: Checkout
       uses: actions/checkout@v3
+    - name: Select Xcode
+      run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
     - name: Build test target for Google Sign-in button for Swift
       run: |
         xcodebuild \
@@ -64,7 +66,6 @@ jobs:
           build-for-testing \
           -scheme DaysUntilBirthday\ \(iOS\) \
           -sdk iphonesimulator \
-          -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.4'
     - name: Run test target for Google Sign-in button for Swift
       env:
         EMAIL_SECRET : ${{ secrets.EMAIL_SECRET }}
@@ -75,12 +76,12 @@ jobs:
           test-without-building \
           -scheme DaysUntilBirthday\ \(iOS\) \
           -sdk iphonesimulator \
-          -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.4' \
+          -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.6' \
           EMAIL_SECRET=$EMAIL_SECRET \
           PASSWORD_SECRET=$PASSWORD_SECRET
 
   app-check-api-token-tests:
-    runs-on: macOS-13
+    runs-on: macos-15
     # Don't run if triggered by a PR from a fork since our Secrets won't be provided to the runner.
     if: "!github.event.pull_request.head.repo.fork"
     defaults:
@@ -89,9 +90,8 @@ jobs:
     steps:
     - name: Checkout
       uses: actions/checkout@v3
-    - name: Use Xcode 15.0.1
-      run: |
-        sudo xcode-select -s /Applications/Xcode_15.0.1.app
+    - name: Select Xcode
+      run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
     - name: Build test target for App Check Example
       run: |
         xcodebuild \
@@ -99,7 +99,6 @@ jobs:
           build-for-testing \
           -scheme AppAttestExample \
           -sdk iphonesimulator \
-          -destination 'platform=iOS Simulator,name=iPhone 15'
     - name: Run test target for App Check Example
       env:
         AppCheckDebugToken : ${{ secrets.APP_CHECK_DEBUG_TOKEN }}
@@ -110,6 +109,6 @@ jobs:
           test-without-building \
           -scheme AppAttestExample \
           -sdk iphonesimulator \
-          -destination 'platform=iOS Simulator,name=iPhone 15' \
+          -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.6' \
           AppCheckDebugToken=$AppCheckDebugToken \
           APP_CHECK_WEB_API_KEY=$APP_CHECK_WEB_API_KEY

+ 4 - 2
.github/workflows/unit_tests.yml

@@ -39,15 +39,17 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-latest]
+        os: [macos-15]
         sdk: ['macosx', 'iphonesimulator']
         include:
           - sdk: 'macosx'
             destination: '"platform=OS X,arch=x86_64"'
           - sdk: 'iphonesimulator'
-            destination: '"platform=iOS Simulator,name=iPhone 15"'
+            destination: '"platform=iOS Simulator,name=iPhone 16,OS=18.6"'
     steps:
     - uses: actions/checkout@v3
+    - name: Select Xcode
+      run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
     - name: Build unit test target
       run: |
         xcodebuild \

+ 8 - 6
Samples/Swift/DaysUntilBirthday/DaysUntilBirthdayUITests(iOS)/DaysUntilBirthdayUITests_iOS.swift

@@ -20,13 +20,13 @@ class DaysUntilBirthdayUITests_iOS: XCTestCase {
   private let signInStaticText =
     "“DaysUntilBirthday (iOS)” Wants to Use “google.com” to Sign In"
   private let passwordManagerPrompt =
-    "Would you like to save this password to use with apps and websites?"
+    "Save Password?"
   private let signInDisclaimerHeaderText =
-    "Sign in to Days Until Birthday"
+    "Sign in to DaysUntilBirthday (iOS)"
   private let returningUserSignInDisclaimerHeaderText =
-    "You’re signing back in to Days Until Birthday"
-  private let additionalAccessHeaderText = "Days Until Birthday wants additional access to your Google Account"
-  private let appTrustWarningText = "Make sure you trust Days Until Birthday"
+    "You’re signing back in to DaysUntilBirthday (iOS)"
+  private let additionalAccessHeaderText = "DaysUntilBirthday (iOS) wants additional access to your Google Account"
+  private let appTrustWarningText = "Make sure you trust DaysUntilBirthday (iOS)"
   private let chooseAnAccountHeaderText = "Choose an account"
   private let notNowText = "Not Now"
   private let timeout: TimeInterval = 30
@@ -177,6 +177,7 @@ extension DaysUntilBirthdayUITests_iOS {
     // Proceed through sign-in disclaimer and/or access request view(s) if needed
     handleSignInDisclaimerIfNeeded()
     handleAccessRequestIfNeeded()
+    handleReturningUserSignInDisclaimerIfNeeded()
 
     return true
   }
@@ -191,8 +192,9 @@ extension DaysUntilBirthdayUITests_iOS {
       return false
     }
 
-    handleReturningUserSignInDisclaimerIfNeeded()
+    handleSignInDisclaimerIfNeeded()
     handleAccessRequestIfNeeded()
+    handleReturningUserSignInDisclaimerIfNeeded()
 
     return true
   }

+ 11 - 3
Samples/Swift/DaysUntilBirthday/README.md

@@ -35,6 +35,14 @@ The email and password that we use are defined as
 [secrets](https://docs.github.com/en/actions/learn-github-actions/contexts#secrets-context)
 on our GitHub repo, and we retrieve these from the workflow environment.
 
-Locally, both the email and password need to be passed to `xcodebuild` as
-arguments: `xcodebuild <other args> EMAIL_SECRET=... PASSWORD_SECRET=...`.
-Refer to the repo's Secrets for these values.
+When run locally, both the email and password need to be passed to `xcodebuild`.
+
+In Xcode, you can add arguments by selecting "Edit Scheme > Run > Environment Variables", and
+replace the variables with your test account. Alternatively, edit `Credential.swift` directly.
+WARNING: Don't check these into the repo!
+
+From the command line, you can do this as arguments:
+`xcodebuild <other args> EMAIL_SECRET=... PASSWORD_SECRET=...`.
+
+For Googlers, refer to CSI internal Workflow documentation for how to access these values, or access
+them via the repo's Secrets.