diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 0d37793fd3..b8d048d805 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -46,7 +46,7 @@ jobs: - run: sh -x build.sh verify-osx osx-16: - runs-on: macos-14 + runs-on: macos-15 name: Test osx on Xcode 16 env: DEVELOPER_DIR: '/Applications/Xcode_16.app/Contents/Developer' @@ -55,7 +55,7 @@ jobs: - run: sh -x build.sh verify-osx osx-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test osx on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -64,7 +64,7 @@ jobs: - run: sh -x build.sh verify-osx osx-encryption-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test osx-encryption on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -82,7 +82,7 @@ jobs: - run: sh -x build.sh verify-swiftpm swiftpm-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test swiftpm on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -109,7 +109,7 @@ jobs: - run: sh -x build.sh verify-swiftpm-debug swiftpm-debug-16: - runs-on: macos-14 + runs-on: macos-15 name: Test swiftpm-debug on Xcode 16 env: DEVELOPER_DIR: '/Applications/Xcode_16.app/Contents/Developer' @@ -118,7 +118,7 @@ jobs: - run: sh -x build.sh verify-swiftpm-debug swiftpm-debug-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test swiftpm-debug on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -127,7 +127,7 @@ jobs: - run: sh -x build.sh verify-swiftpm-debug swiftpm-address-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test swiftpm-address on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -136,7 +136,7 @@ jobs: - run: sh -x build.sh verify-swiftpm-address swiftpm-thread-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test swiftpm-thread on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -154,7 +154,7 @@ jobs: - run: sh -x build.sh verify-ios-static ios-static-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test ios-static on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -172,7 +172,7 @@ jobs: - run: sh -x build.sh verify-ios ios-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test ios on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -190,7 +190,7 @@ jobs: - run: sh -x build.sh verify-watchos watchos-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test watchos on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -208,7 +208,7 @@ jobs: - run: sh -x build.sh verify-tvos tvos-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test tvos on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -226,7 +226,7 @@ jobs: - run: sh -x build.sh verify-visionos visionos-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test visionos on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -253,7 +253,7 @@ jobs: - run: sh -x build.sh verify-osx-swift osx-swift-16: - runs-on: macos-14 + runs-on: macos-15 name: Test osx-swift on Xcode 16 env: DEVELOPER_DIR: '/Applications/Xcode_16.app/Contents/Developer' @@ -262,7 +262,7 @@ jobs: - run: sh -x build.sh verify-osx-swift osx-swift-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test osx-swift on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -280,7 +280,7 @@ jobs: - run: sh -x build.sh verify-ios-swift ios-swift-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test ios-swift on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -298,7 +298,7 @@ jobs: - run: sh -x build.sh verify-tvos-swift tvos-swift-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test tvos-swift on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -307,7 +307,7 @@ jobs: - run: sh -x build.sh verify-tvos-swift osx-swift-evolution-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test osx-swift-evolution on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -316,7 +316,7 @@ jobs: - run: sh -x build.sh verify-osx-swift-evolution ios-swift-evolution-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test ios-swift-evolution on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -325,7 +325,7 @@ jobs: - run: sh -x build.sh verify-ios-swift-evolution tvos-swift-evolution-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test tvos-swift-evolution on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -343,7 +343,7 @@ jobs: - run: sh -x build.sh verify-catalyst catalyst-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test catalyst on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -361,7 +361,7 @@ jobs: - run: sh -x build.sh verify-catalyst-swift catalyst-swift-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test catalyst-swift on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -370,7 +370,7 @@ jobs: - run: sh -x build.sh verify-catalyst-swift xcframework-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test xcframework on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -397,7 +397,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-osx cocoapods-osx-16: - runs-on: macos-14 + runs-on: macos-15 name: Test cocoapods-osx on Xcode 16 env: DEVELOPER_DIR: '/Applications/Xcode_16.app/Contents/Developer' @@ -406,7 +406,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-osx cocoapods-osx-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test cocoapods-osx on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -415,7 +415,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-osx cocoapods-ios-static-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test cocoapods-ios-static on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -424,7 +424,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-ios-static cocoapods-ios-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test cocoapods-ios on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -433,7 +433,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-ios cocoapods-watchos-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test cocoapods-watchos on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -442,7 +442,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-watchos cocoapods-tvos-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test cocoapods-tvos on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -451,7 +451,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-tvos cocoapods-catalyst-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test cocoapods-catalyst on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' @@ -460,7 +460,7 @@ jobs: - run: sh -x build.sh verify-cocoapods-catalyst ios-swiftui-16_1_beta_2: - runs-on: macos-14 + runs-on: macos-15 name: Test ios-swiftui on Xcode 16.1_beta_2 env: DEVELOPER_DIR: '/Applications/Xcode_16.1_beta_2.app/Contents/Developer' diff --git a/.github/workflows/master-push.yml b/.github/workflows/master-push.yml index 1f4a666c78..3bb0d22c47 100644 --- a/.github/workflows/master-push.yml +++ b/.github/workflows/master-push.yml @@ -8,8 +8,8 @@ on: env: XCODE_VERSION: "['15.3', '15.4', '16', '16.1_beta_2']" PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']" - DOC_VERSION: '15.4' RELEASE_VERSION: '15.4' + DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer jobs: prepare: runs-on: ubuntu-latest @@ -38,8 +38,6 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ env.DOC_VERSION }}.app - name: Prepare docs for packaging run: bundle exec sh -x build.sh release-package-docs - name: Upload docs to artifacts library @@ -61,15 +59,22 @@ jobs: name: realm-examples path: realm-examples.zip build-product: # Creates framework for each platform, xcode version, target and configuration - runs-on: macos-14 name: Package framework needs: prepare strategy: - max-parallel: 20 # Blocks of 20, therefore if any of the build fails, we don't get a lot of XCode Clouds builds hanging, which are expensive. + max-parallel: 20 matrix: platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }} - xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }} configuration: [swift, static] + include: + - xcode-version: 15.3 + os: macos-14 + - xcode-version: 15.4 + os: macos-14 + - xcode-version: 16 + os: macos-15 + - xcode-version: 16.1_beta_2 + os: macos-15 exclude: - platform: osx configuration: static @@ -81,12 +86,16 @@ jobs: configuration: static - platform: catalyst configuration: static - - platform: visionos - xcode-version: 15.1 + runs-on: ${{ matrix.os }} + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer steps: - uses: actions/checkout@v4 + - name: Download visionOS + if: matrix.platform == 'visionos' && matrix.os == 'macos-14' + run: xcodebuild -downloadPlatform visionOS - name: Build ${{ matrix.platform }} with Xcode ${{ matrix.xcode-version }} - run: DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer sh build.sh ${{ matrix.platform }}-${{matrix.configuration}} + run: sh build.sh ${{ matrix.platform }}-${{matrix.configuration}} - run: rm -r build/DerivedData - name: Upload framework uses: actions/upload-artifact@v4 @@ -95,27 +104,34 @@ jobs: path: build compression-level: 1 package-xcframework-platform: # Creates xcframework for each platform and xcode version - runs-on: macos-14 name: Package xcframework for platform needs: [build-product, prepare] strategy: matrix: platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }} - xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }} - exclude: - - platform: visionos - xcode-version: 15.1 + include: + - xcode-version: 15.3 + os: macos-14 + - xcode-version: 15.4 + os: macos-14 + - xcode-version: 16 + os: macos-15 + - xcode-version: 16.1_beta_2 + os: macos-15 + runs-on: ${{ matrix.os }} + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer steps: - uses: actions/checkout@v4 - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app - name: Install the Apple certificate and provisioning profile env: DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.DEVELOPMENT_CERTIFICATE_BASE64 }} P12_PASSWORD: ${{ secrets.P12_PASSWORD }} KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - run: | - sh -x build.sh install-apple-certificates + run: sh -x build.sh install-apple-certificates + - name: Download visionOS + if: matrix.platform == 'visionos' && matrix.os == 'macos-14' + run: xcodebuild -downloadPlatform visionOS - name: Restore frameworks uses: actions/download-artifact@v4 with: @@ -123,8 +139,7 @@ jobs: - name: Create xcframework env: SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }} - run: | - sh -x build.sh release-create-xcframework-${{ matrix.xcode-version }} ${{ matrix.platform }} + run: sh -x build.sh release-create-xcframework-${{ matrix.xcode-version }} ${{ matrix.platform }} - name: Upload xcframework uses: actions/upload-artifact@v4 with: @@ -136,15 +151,12 @@ jobs: needs: [package-xcframework-platform, prepare] steps: - uses: actions/checkout@v4 - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app - name: Install the Apple certificate and provisioning profile env: DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.DEVELOPMENT_CERTIFICATE_BASE64 }} P12_PASSWORD: ${{ secrets.P12_PASSWORD }} KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - run: | - sh -x build.sh install-apple-certificates + run: sh -x build.sh install-apple-certificates - name: Restore packages xcframeworks uses: actions/download-artifact@v4 with: @@ -152,8 +164,7 @@ jobs: - name: Create release env: SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }} - run: | - sh -x build.sh release-package + run: sh -x build.sh release-package - name: Upload release artifactss uses: actions/upload-artifact@v4 with: @@ -170,8 +181,6 @@ jobs: needs: [package-release, prepare] steps: - uses: actions/checkout@v4 - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app - name: Restore release uses: actions/download-artifact@v4 with: @@ -184,8 +193,6 @@ jobs: needs: package-release steps: - uses: actions/checkout@v4 - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app - name: Test ios static run: sh -x build.sh test-ios-static test-osx-static: @@ -194,8 +201,6 @@ jobs: needs: package-release steps: - uses: actions/checkout@v4 - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app - name: Test osx static run: | export REALM_DISABLE_METADATA_ENCRYPTION=1 @@ -226,8 +231,9 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app + - name: Download visionOS + if: matrix.platform == 'visionos' && matrix.os == 'macos-14' + run: xcodebuild -downloadPlatform visionOS - name: Restore release uses: actions/download-artifact@v4 if: ${{ matrix.installation == 'xcframework' }} @@ -244,21 +250,28 @@ jobs: cd examples/installation bundle exec ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }} test-installation-xcframework: - runs-on: macos-14 name: Run installation test for xcframework needs: [package-release, prepare] - env: - PLATFORM: 'osx' strategy: matrix: - xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }} + include: + - xcode-version: 15.3 + os: macos-14 + - xcode-version: 15.4 + os: macos-14 + - xcode-version: 16 + os: macos-15 + - xcode-version: 16.1_beta_2 + os: macos-15 + env: + PLATFORM: 'osx' + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Select Xcode Version - run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode-version }}.app - name: Restore release uses: actions/download-artifact@v4 with: diff --git a/build.sh b/build.sh index d4e32654d1..194e2987db 100755 --- a/build.sh +++ b/build.sh @@ -310,6 +310,14 @@ plist_get() { /usr/libexec/PlistBuddy -c "Print :$2" "$1" 2> /dev/null } +iphone_name() { + if (( $(xcode_version_major) < 16 )); then + echo 'iPhone 14' + else + echo 'iPhone 16' + fi +} + ###################################### # Device Test Helper ###################################### @@ -519,11 +527,7 @@ case "$COMMAND" in "xcframework") # Build all of the requested frameworks shift - if (( $(xcode_version_major) < 15 )); then - PLATFORMS="${*:-osx ios watchos tvos catalyst}" - else - PLATFORMS="${*:-osx ios watchos tvos catalyst visionos}" - fi + PLATFORMS="${*:-osx ios watchos tvos catalyst visionos}" for platform in $PLATFORMS; do sh build.sh "$platform-swift" done @@ -591,12 +595,12 @@ case "$COMMAND" in ;; "test-ios") - xctest Realm -configuration "$CONFIGURATION" -sdk iphonesimulator -destination 'name=iPhone 14' + xctest Realm -configuration "$CONFIGURATION" -sdk iphonesimulator -destination "name=$(iphone_name)" exit 0 ;; "test-ios-swift") - xctest RealmSwift -configuration "$CONFIGURATION" -sdk iphonesimulator -destination 'name=iPhone 14' + xctest RealmSwift -configuration "$CONFIGURATION" -sdk iphonesimulator -destination "name=$(iphone_name)" exit 0 ;; @@ -665,7 +669,7 @@ case "$COMMAND" in ;; "test-ios-swiftui") - xctest 'SwiftUITestHost' -configuration "$CONFIGURATION" -sdk iphonesimulator -destination 'name=iPhone 14' + xctest 'SwiftUITestHost' -configuration "$CONFIGURATION" -sdk iphonesimulator -destination "name=$(iphone_name)" exit 0 ;; @@ -1062,6 +1066,10 @@ case "$COMMAND" in export sha="$BRANCH" export REALM_EXTRA_BUILD_ARGUMENTS='GCC_GENERATE_DEBUGGING_SYMBOLS=NO -allowProvisioningUpdates' target=$(echo "$CI_WORKFLOW" | cut -f1 -d_) + if [[ "$target" == visionos ]] && (( $(xcode_version_major) < 16 )); then + echo 'Installing visionOS' + xcodebuild -downloadPlatform visionOS + fi sh build.sh "verify-$target" ;; diff --git a/scripts/pr-ci-matrix.rb b/scripts/pr-ci-matrix.rb index 491c4360dc..c3c42c5bbb 100755 --- a/scripts/pr-ci-matrix.rb +++ b/scripts/pr-ci-matrix.rb @@ -82,9 +82,10 @@ def minimum_version(major) if not filter.call(version) next end - output_file << """ + image = version.start_with?('16') ? 'macos-15' : 'macos-14' + output_file << """ #{name}-#{version.gsub(' ', '_').gsub('.', '_')}: - runs-on: macos-14 + runs-on: #{image} name: Test #{name} on Xcode #{version} env: DEVELOPER_DIR: '/Applications/Xcode_#{version}.app/Contents/Developer'