From 55466ae0fb29c5f21866792f05c1fc0c590d7c29 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 12 Feb 2024 12:14:40 -0800 Subject: [PATCH 1/6] Preserve symlinks when creating the release package actions/upload-artifact follows symlinks when asked to archive a directory, which results in the release package having three copies of each macos/catalyst library. To fix this, skip extracting the zip before archiving even though it results in an awkward nested zip. --- .github/workflows/master-push.yml | 102 +++++------------------- build.sh | 124 ++++++++++-------------------- scripts/xcode_cloud_helper.rb | 30 ++++---- 3 files changed, 73 insertions(+), 183 deletions(-) diff --git a/.github/workflows/master-push.yml b/.github/workflows/master-push.yml index c6c4b90345..5c97ffc6ec 100644 --- a/.github/workflows/master-push.yml +++ b/.github/workflows/master-push.yml @@ -3,14 +3,15 @@ on: push: branches: - "master" + - "tg/release-symlink" env: XCODE_VERSION: "['14.2', '14.3.1', '15.1', '15.2']" PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']" BUILD_PLATFORM: "['ios', 'iossimulator', 'osx', 'watchos', 'watchossimulator', 'tvos', 'tvossimulator', 'catalyst', 'visionos', 'visionossimulator']" - DOC_VERSION: '15.1' + DOC_VERSION: '15.2' JAZZY_VERSION: '0.14.4' RELEASE_VERSION: '15.2' - TEST_VERSION: '15.1' + TEST_VERSION: '15.2' jobs: cleanup: # Clean-up XCode cloud workflows, before running the pipeline runs-on: ubuntu-latest @@ -21,7 +22,7 @@ jobs: id: token run: | token=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --issuer-id ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} --key-id ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} --pk "${{ secrets.APPLE_STORE_CONNECT_API_KEY }}" get-token)) - echo "TOKEN=$token" >> $GITHUB_OUTPUT + echo "TOKEN=$token" >> $GITHUB_OUTPUT - name: Clean up release-packages xcode cloud workflows run: | ruby ./scripts/xcode_cloud_helper.rb clean-up-release-workflows -t ${{ steps.token.outputs.TOKEN }} @@ -81,13 +82,12 @@ jobs: name: realm-examples build-product: # Creates framework for each platform, xcode version, target and configuration runs-on: macos-13 - name: Package framework + 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. matrix: platform: ${{ fromJSON(needs.prepare.outputs.BUILD_PLATFORM_MATRIX) }} - target: [RealmSwift, Realm] xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }} configuration: [release, static] exclude: @@ -107,8 +107,6 @@ jobs: configuration: static - platform: visionossimulator configuration: static - - target: RealmSwift - configuration: static - platform: visionos xcode-version: 14.2 - platform: visionossimulator @@ -136,13 +134,13 @@ jobs: timeout_minutes: 10 max_attempts: 3 command: | - workflow_id=$(ruby ./scripts/xcode_cloud_helper.rb create-workflow release-package-build ${{ matrix.platform }} ${{ matrix.xcode-version }} ${{ matrix.target }} ${{ matrix.configuration }} -t ${{ steps.token.outputs.TOKEN }}) + workflow_id=$(ruby ./scripts/xcode_cloud_helper.rb create-workflow release-package-build ${{ matrix.platform }} ${{ matrix.xcode-version }} RealmSwift ${{ matrix.configuration }} -t ${{ steps.token.outputs.TOKEN }}) echo "WORKFLOW_ID=$workflow_id" >> $GITHUB_OUTPUT - name: Runs the XCode Cloud workflow created by the previous step id: build-run uses: nick-fields/retry@v2 with: - timeout_minutes: 10 + timeout_minutes: 15 max_attempts: 3 command: | build_run_id=$(ruby ./scripts/xcode_cloud_helper.rb build-workflow ${{ steps.create-workflow.outputs.WORKFLOW_ID }} ${{ github.ref_name }} -t ${{ steps.token.outputs.TOKEN }}) @@ -150,7 +148,7 @@ jobs: - name: Check build status and wait for it to finish uses: nick-fields/retry@v2 with: - timeout_minutes: 10 + timeout_minutes: 15 max_attempts: 3 command: | while [ "$status" != 'COMPLETE' ] @@ -176,76 +174,12 @@ jobs: command: | token=$(ruby ./scripts/xcode_cloud_helper.rb --issuer-id ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} --key-id ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} --pk "${{ secrets.APPLE_STORE_CONNECT_API_KEY }}" get-token) ruby ./scripts/xcode_cloud_helper.rb download-artifact ${{ steps.build-run.outputs.BUILD_RUN_ID }} -t $token - - name: Prepare product folder - uses: nick-fields/retry@v2 - with: - timeout_minutes: 10 - max_attempts: 3 - command: | - sh -x build.sh release-package-product - name: Upload framework uses: actions/upload-artifact@v4 with: - name: product-${{ matrix.platform }}-${{ matrix.xcode-version }}-${{ matrix.target }}-${{ matrix.configuration }} - path: product-package - # build-product: # Creates framework for each platform, xcode version, target and configuration - # runs-on: macos-13 - # name: Package framework - # needs: prepare - # strategy: - # matrix: - # platform: ${{ fromJSON(needs.prepare.outputs.BUILD_PLATFORM_MATRIX) }} - # target: [RealmSwift, Realm] - # xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }} - # configuration: [release, static] - # exclude: - # - platform: osx - # configuration: static - # - platform: tvos - # configuration: static - # - platform: watchos - # configuration: static - # - platform: visionos - # configuration: static - # - platform: catalyst - # configuration: static - # - platform: tvossimulator - # configuration: static - # - platform: watchossimulator - # configuration: static - # - platform: visionossimulator - # configuration: static - # - target: RealmSwift - # configuration: static - # - platform: visionos - # xcode-version: 14.2 - # - platform: visionossimulator - # xcode-version: 14.2 - # - platform: visionos - # xcode-version: 14.3.1 - # - platform: visionossimulator - # xcode-version: 14.3.1 - # - platform: visionos - # xcode-version: 15.1 - # - platform: visionossimulator - # xcode-version: 15.1 - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # - name: Select Xcode Version - # run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode-version }}.app - # - name: Download visionOS, only for 15.2 - # if: ${{ matrix.platform == 'visionos' || matrix.platform == 'visionossimulator' }} - # run: xcodebuild -downloadPlatform visionOS - # - name: Create framework - # run: sh -x build.sh release-package-build_${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.configuration }} - # - name: Prepare product folder - # run: sh -x build.sh release-package-product - # - name: Upload build product - # uses: actions/upload-artifact@v4 - # with: - # name: product-${{ matrix.platform }}-${{ matrix.xcode-version }}-${{ matrix.target }}-${{ matrix.configuration }} - # path: product-package + name: build-${{ matrix.platform }}-${{ matrix.xcode-version }}-${{ matrix.configuration }} + path: xcode-cloud-build-${{ steps.build-run.outputs.BUILD_RUN_ID }}.zip + compression-level: 0 package-xcframework-platform: # Creates xcframework for each platform and xcode version runs-on: macos-13 name: Package xcframework for platform @@ -254,7 +188,7 @@ jobs: matrix: platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }} xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }} - exclude: + exclude: - platform: visionos xcode-version: 14.2 - platform: visionos @@ -269,10 +203,10 @@ jobs: - name: Restore frameworks uses: actions/download-artifact@v4 with: - pattern: product-${{ matrix.platform }}*-${{ matrix.xcode-version }}-* + pattern: build-${{ matrix.platform }}*-${{ matrix.xcode-version }}-* - name: Create xcframework - run: sh -x build.sh release-create-xcframework_${{ matrix.xcode-version }} ${{ matrix.platform }} - - name: Upload xcframework + run: sh -x build.sh release-create-xcframework-${{ matrix.xcode-version }} ${{ matrix.platform }} + - name: Upload xcframework uses: actions/upload-artifact@v4 with: name: realm-${{ matrix.platform }}-${{ matrix.xcode-version }} @@ -301,7 +235,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: realm-swift-${{ needs.prepare.outputs.VERSION }} - path: pkg/realm-swift-${{ needs.prepare.outputs.VERSION }}.zip + path: pkg/realm-swift-${{ needs.prepare.outputs.VERSION }}.zip test-package-examples: runs-on: macos-13 name: Test examples @@ -380,7 +314,7 @@ jobs: mkdir -p build unzip realm-${{ matrix.platform }}-${{ env.TEST_VERSION }}.zip -d build - name: Run installation test - run: | + run: | echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT cd examples/installation ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }} @@ -413,4 +347,4 @@ jobs: echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT cd examples/installation ./build.rb osx xcframework dynamic - \ No newline at end of file + diff --git a/build.sh b/build.sh index ffb231ca55..f363d17165 100755 --- a/build.sh +++ b/build.sh @@ -88,7 +88,7 @@ command: release-package-docs: build release package the docs release-package-*: build release package for the given platform, configuration and target (this is executed in XCode Cloud) release-create-xcframework_[xcode-version] [platform]: creates an xcframework from the framework build by the previous step - release-package: creates the final packages + release-package: creates the final packages release-package-test-examples: test a built examples release package test-package-release: locally build a complete release package for all platforms @@ -264,7 +264,7 @@ build_platform() { if [[ "$platform" = *"simulator" ]]; then xc -destination "$destination Simulator" "${build_args[@]}" - else + else xc -destination "$destination" "${build_args[@]}" fi @@ -282,63 +282,14 @@ build_platform() { create_xcframework() { local product="$1" - local platform="$2" - local config="$3" - local xcode_version="$4" - - config_name="$(tr [A-Z] [a-z] <<< "$config")" - - local destination build_args config_suffix simulator_suffix - case "$platform" in - osx) - config_suffix= - ;; - ios) - config_suffix=-iphoneos - simulator_suffix=iphonesimulator - ;; - watchos) - config_suffix=-watchos - simulator_suffix=watchsimulator - ;; - tvos) - config_suffix=-appletvos - simulator_suffix=appletvsimulator - ;; - visionos) - config_suffix=-xros - simulator_suffix=xrsimulator - ;; - catalyst) - config_suffix=-maccatalyst - ;; - esac - - product_name="$product.framework" - out_path="$ROOT_WORKSPACE/$config/$platform" - xcframework_path="$out_path/$product.xcframework" - os_path="$ROOT_WORKSPACE/product-$platform-$xcode_version-$product-$config_name/$config${config_suffix}/$product_name" - simulator_path="$ROOT_WORKSPACE/product-${platform}simulator-$xcode_version-$product-$config_name/$config-$simulator_suffix/$product_name" - - simulator_framework=() - if [[ -n "$simulator_suffix" ]]; then - simulator_framework+=(-framework "$simulator_path") - fi - - echo "Creating xcframework from paths $os_path, $simulator_path" - xcodebuild -create-xcframework -allow-internal-distribution -output "$xcframework_path" \ - -framework "$os_path" "${simulator_framework[@]}" -} - -unzip_product() { - file_name="$1" - new_file_name="$2" - - unzip "$file_name.zip" -d $file_name - find product -maxdepth 1 -type d -name "RealmSwift Build*" -exec mv {} $new_file_name \; - - rm $file_name.zip - rm -rf $file_name + local config="$2" + local platform="$3" + + local out_path="$ROOT_WORKSPACE/$config/$platform/$product.xcframework" + # find "$ROOT_WORKSPACE" -maxdepth 5 + find "$ROOT_WORKSPACE" -path "*/$config*/$product.framework" \ + | sed 's/.*/-framework &/' \ + | xargs xcodebuild -create-xcframework -allow-internal-distribution -output "$out_path" } # Artifacts are zipped by the artifacts store so they're endup nested zipped, so we need to unzip this zip. @@ -804,7 +755,7 @@ case "$COMMAND" in REALM_TEST_BRANCH="$sha" ./build.rb "$PLATFORM" cocoapods "$LINKAGE" ;; - "verify-docs") + "verify-docs") sh build.sh docs for lang in swift objc; do undocumented="docs/${lang}_output/undocumented.json" @@ -1130,21 +1081,26 @@ case "$COMMAND" in zip -r docs/realm-docs.zip docs/objc_output docs/swift_output ;; - "release-package-product") - unzip_product product product-package - ;; - - (release-create-xcframework_*) + release-create-xcframework-*) platform="$2" - xcode_version=$(echo "$COMMAND" | cut -d_ -f2 ) + xcode_version=$(echo "$COMMAND" | cut -d- -f4 ) + + # Artifacts are nested zips so need to be extracted twice + find . -name 'build-*.zip' -exec unzip {} \; + find . -name 'xcode-cloud-build-*.zip' -exec unzip {} \; + + # Spaces with xargs are complicated so get rid of them + for dir in "RealmSwift Build "*; do + mv "$dir" build-$(echo "$dir" | cut -d' ' -f3) + done - create_xcframework Realm "$platform" Release "$xcode_version" - create_xcframework RealmSwift "$platform" Release "$xcode_version" + create_xcframework Realm Release "$platform" + create_xcframework RealmSwift Release "$platform" - if [ "$platform" = "ios" ] ; then - create_xcframework Realm "$platform" Static "$xcode_version" + if [ "$platform" = "ios" ]; then + create_xcframework Realm Static "$platform" else - mkdir -p "Static" + mkdir -p "Static/$platform" fi zip --symlinks -r "realm-$platform-$xcode_version.zip" "Release/$platform" "Static/$platform" @@ -1167,7 +1123,7 @@ case "$COMMAND" in cp "$0" "${filename}" cp -r "${source_root}/scripts" "${filename}" cp "dependencies.list" "${filename}" - + cd "${filename}" sh build.sh examples-ios sh build.sh examples-tvos @@ -1187,10 +1143,10 @@ case "$COMMAND" in # Should select xcode version `xcode-select` first. # Pass xcode version as argument # This simulates what is done in XCode Cloud - ("test-create-frameworks") + "test-create-frameworks") xcode_version="$2" targets="Realm RealmSwift" - + platforms=("ios" "iossimulator" "osx" "tvos" "tvossimulator" "watchos" "watchossimulator" "catalyst") if [ "$xcode_version" == "15.2" ]; then platforms+=("visionos" "visionossimulator") @@ -1202,7 +1158,7 @@ case "$COMMAND" in ./build.sh "release-package-$platform-$xcode_version-$target-release" ./build.sh "release-build_$platform-$xcode_version-$target-release" - # Only generates Realm framework for Static configuration and ios platform + # Only generates Realm framework for Static configuration and ios platform if [[ "$platform" == "ios" || "$platform" == "iossimulator" ]] && [[ "$target" == "Realm" ]]; then echo "Building $platform and $target static" ./build.sh "release-package-$platform-$xcode_version-$target-static" @@ -1212,7 +1168,7 @@ case "$COMMAND" in done ;; - ("test-build-product-workflow-xcode-cloud") + "test-build-product-workflow-xcode-cloud") issuer_id="" key_id="" pk_path="" @@ -1220,7 +1176,7 @@ case "$COMMAND" in token=$(ruby ./scripts/xcode_cloud_helper.rb --issuer-id $issuer_id --key-id $key_id --pk-path $pk_path get-token) echo "Authentication token -> $token" - # Test parameters + # Test parameters platform="ios" target="RealmSwift" xcode_version="15.2" @@ -1252,9 +1208,9 @@ case "$COMMAND" in # Pass xcode version as argument # For this to work, product builds should be located in the root of the project - ("test-create-platform-xcframeworks") + "test-create-platform-xcframeworks") xcode_version="$2" - + platforms=("ios" "osx" "tvos" "watchos" "catalyst") if [ "$xcode_version" == "15.1" ]; then platforms+=("visionos") @@ -1268,7 +1224,7 @@ case "$COMMAND" in done ;; - ("test-package-examples") + "test-package-examples") VERSION="$(sed -n 's/^VERSION=\(.*\)$/\1/p' "${source_root}/dependencies.list")" dir="realm-swift-${VERSION}" @@ -1285,7 +1241,7 @@ case "$COMMAND" in cp -r "${ROOT_WORKSPACE}/dependencies.list" "${dir}" cd "${dir}" - # Test Examples + # Test Examples sh build.sh examples-ios sh build.sh examples-tvos sh build.sh examples-osx @@ -1294,7 +1250,7 @@ case "$COMMAND" in ;; # This is used for test or if we want to use Github Actions to build each framework - (release-package-build_*) + release-package-build_*) filename="Configuration/Release.xcconfig" sed -i '' "s/REALM_HIDE_SYMBOLS = NO;/REALM_HIDE_SYMBOLS = YES;/" "$filename" @@ -1327,11 +1283,11 @@ case "$COMMAND" in "publish-docs") sha="$2" - + ./scripts/github_release.rb download-artifacts realm-docs "${sha}" unzip_artifact realm-docs.zip unzip realm-docs.zip - + VERSION="$(sed -n 's/^VERSION=\(.*\)$/\1/p' "${source_root}/dependencies.list")" PRERELEASE_REGEX='alpha|beta|rc|preview' if [[ $VERSION =~ $PRERELEASE_REGEX ]]; then diff --git a/scripts/xcode_cloud_helper.rb b/scripts/xcode_cloud_helper.rb index 10a3cd506a..064c36a85b 100755 --- a/scripts/xcode_cloud_helper.rb +++ b/scripts/xcode_cloud_helper.rb @@ -132,7 +132,7 @@ def get_git_references repository_id = get_realm_repository_id get("/scmRepositories/#{repository_id}/gitReferences?limit=200") end - + def get_workflow_info(id) get("ciWorkflows/#{id}") end @@ -341,9 +341,9 @@ def get_logs_for_build(build_run) actions = get_build_actions(build_run) artifacts = get_artifacts(actions[0][:id]) # we are only running one action, so we use the first one in the list artifact_url = '' - artifacts.each { |artifact| + artifacts.each { |artifact| artifact_info = get_artifact_info(artifact[:id]) - if artifact_info["data"]["attributes"]["fileName"].include? 'Logs' + if artifact_info["data"]["attributes"]["fileName"].include? 'Logs' artifact_url = artifact_info["data"]["attributes"]["downloadUrl"] end } @@ -352,26 +352,26 @@ def get_logs_for_build(build_run) def print_logs(url) sh 'curl', '--output', 'logs.zip', "#{url}" - sh 'unzip', "logs.zip" + sh 'unzip', '-o', 'logs.zip' log_files = Dir["RealmSwift*/*.log"] - log_files.each { |log_file| + log_files.each { |log_file| text = File.readlines("#{log_file}").map do |line| puts line end - } + } end def find_git_reference_for_branch(branch) next_page = '' references = get_git_references - branch_reference = references["data"].find { |reference| - reference["attributes"]["kind"] == "BRANCH" && reference["attributes"]["name"] == branch - } + branch_reference = references["data"].find { |reference| + reference["attributes"]["kind"] == "BRANCH" && reference["attributes"]["name"] == branch + } while branch_reference == nil || next_page == nil next_page = references["links"]["next"] next_page.slice!(APP_STORE_URL) references = get(next_page) - branch_reference = references["data"].find { |reference| reference["attributes"]["kind"] == "BRANCH" && reference["attributes"]["name"] == branch } + branch_reference = references["data"].find { |reference| reference["attributes"]["kind"] == "BRANCH" && reference["attributes"]["name"] == branch } end return branch_reference["id"] end @@ -380,21 +380,21 @@ def download_artifact_for_build(build_id_run) actions = get_build_actions(build_id_run) artifacts = get_artifacts(actions[0][:id]) # One actions per workflow artifact_url = '' - artifacts.each { |artifact| + artifacts.each { |artifact| artifact_info = get_artifact_info(artifact[:id]) - if artifact_info["data"]["attributes"]["fileName"].include? 'Products' + if artifact_info["data"]["attributes"]["fileName"].include? 'Products' artifact_url = artifact_info["data"]["attributes"]["downloadUrl"] end } - sh 'curl', '--output', "product.zip", "#{artifact_url}" + sh 'curl', '--output', "xcode-cloud-build-#{build_id_run}.zip", "#{artifact_url}" end def clean_up_release_workflows() workflows_to_remove = get_workflows.filter_map { |workflow| if workflow['attributes']['name'].start_with?('release-package-build') {name: workflow['attributes']['name'], id: workflow['id']} - end + end } workflows_to_remove.each { |w| delete_workflow(w[:id]) @@ -585,4 +585,4 @@ def usage() get_logs_for_build(build_id) when 'get-token' puts JWT_TOKEN -end \ No newline at end of file +end From da45778fcc8a004fd17c3c83d88ab475213f81ed Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 13 Feb 2024 07:46:29 -0800 Subject: [PATCH 2/6] Wait for CocoaPods publish before running installation tests --- .github/workflows/publish-release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index ab64d9313d..cf549cdd7e 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -48,7 +48,7 @@ jobs: run: | gem install octokit gem install pathname - gem install fileutils + gem install fileutils - name: Export GITHUB_TOKEN to workspace run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV - name: Publish docs @@ -65,7 +65,7 @@ jobs: run: | gem install octokit gem install pathname - gem install fileutils + gem install fileutils - name: Export GITHUB_TOKEN to workspace run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV - name: Create Github release @@ -84,7 +84,7 @@ jobs: with: ruby-version: '3.1.2' bundler-cache: true - - name: Publish + - name: Publish run: ./build.sh publish-cocoapods v${{ needs.prepare.outputs.VERSION }} update-checker: runs-on: macos-latest @@ -106,7 +106,7 @@ jobs: test-installation: runs-on: macos-13 name: Run installation test for ${{ matrix.platform }}, ${{ matrix.installation }} and ${{ matrix.linkage }} - needs: [create-release, prepare] + needs: [create-release, prepare, publish-cocoapods] strategy: matrix: platform: [ios, osx, watchos, tvos, catalyst, visionos] @@ -166,7 +166,7 @@ jobs: run: | gem install octokit gem install pathname - gem install fileutils + gem install fileutils - name: Prepare Changelog run: ./build.sh prepare-publish-changelog - name: 'Post to #realm-releases' From a86f2d2f71588d78d395e26570973d0a86925d17 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 13 Feb 2024 07:55:04 -0800 Subject: [PATCH 3/6] Install missing dependencies for publish jobs --- .github/workflows/master-push.yml | 72 ++++++------- .github/workflows/publish-release.yml | 84 ++++++--------- .ruby-version | 1 + Gemfile | 7 ++ Gemfile.lock | 149 ++++++++++++++++++++++++++ 5 files changed, 221 insertions(+), 92 deletions(-) create mode 100644 .ruby-version create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/.github/workflows/master-push.yml b/.github/workflows/master-push.yml index 5c97ffc6ec..1b82370f09 100644 --- a/.github/workflows/master-push.yml +++ b/.github/workflows/master-push.yml @@ -3,7 +3,6 @@ on: push: branches: - "master" - - "tg/release-symlink" env: XCODE_VERSION: "['14.2', '14.3.1', '15.1', '15.2']" PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']" @@ -16,8 +15,7 @@ jobs: cleanup: # Clean-up XCode cloud workflows, before running the pipeline runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Get Token id: token run: | @@ -41,8 +39,7 @@ jobs: echo "XCODE_VERSIONS_MATRIX=${{ env.XCODE_VERSION }}" >> $GITHUB_OUTPUT echo "PLATFORM_MATRIX=${{ env.PLATFORM }}" >> $GITHUB_OUTPUT echo "BUILD_PLATFORM_MATRIX=${{ env.BUILD_PLATFORM }}" >> $GITHUB_OUTPUT - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Read SDK version id: get-version run: | @@ -53,14 +50,14 @@ jobs: name: Package docs needs: prepare steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Jazzy - run: gem install jazzy -v ${{ env.JAZZY_VERSION }} # This is only used once, no need to cache this + - uses: actions/checkout@v4 + - 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: sh -x build.sh release-package-docs + run: bundle exec sh -x build.sh release-package-docs - name: Upload docs to artifacts library uses: actions/upload-artifact@v4 with: @@ -71,15 +68,14 @@ jobs: name: Package examples needs: prepare steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Prepare examples for packaging - run: sh -x build.sh release-package-examples - - name: Upload examples to artifacts library - uses: actions/upload-artifact@v4 - with: - path: realm-examples.zip - name: realm-examples + - uses: actions/checkout@v4 + - name: Prepare examples for packaging + run: sh -x build.sh release-package-examples + - name: Upload examples to artifacts library + uses: actions/upload-artifact@v4 + with: + path: realm-examples.zip + name: realm-examples build-product: # Creates framework for each platform, xcode version, target and configuration runs-on: macos-13 name: Package framework @@ -120,8 +116,7 @@ jobs: - platform: visionossimulator xcode-version: 15.1 steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Get Token id: token run: | @@ -196,8 +191,7 @@ jobs: - platform: visionos xcode-version: 15.1 steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode-version }}.app - name: Restore frameworks @@ -216,8 +210,7 @@ jobs: name: Package release file needs: [package-xcframework-platform, prepare] steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select -switch /Applications/Xcode_${{ env.RELEASE_VERSION }}.app - name: Restore packages xcframeworks @@ -241,8 +234,7 @@ jobs: name: Test examples needs: [package-release, prepare] steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app - name: Restore release @@ -256,8 +248,7 @@ jobs: name: Run tests on iOS with configuration Static needs: package-release steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app - name: Test ios static @@ -267,8 +258,7 @@ jobs: name: Run tests on macOS needs: package-release steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Select Xcode Version run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app - name: Test osx static @@ -297,12 +287,12 @@ jobs: installation: xcframework linkage: static steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true - name: Select Xcode Version run: sudo xcode-select -switch /Applications/Xcode_${{ env.TEST_VERSION }}.app - - name: Install FileUtils - run: gem install fileutils - name: Restore release uses: actions/download-artifact@v4 if: ${{ matrix.installation == 'xcframework' }} @@ -317,7 +307,7 @@ jobs: run: | echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT cd examples/installation - ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }} + bundle exec ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }} test-installation-xcframework: runs-on: macos-13 name: Run installation test for xcframework @@ -328,10 +318,10 @@ jobs: matrix: xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }} steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install FileUtils - run: gem install fileutils + - 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 @@ -346,5 +336,5 @@ jobs: run: | echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT cd examples/installation - ./build.rb osx xcframework dynamic + bundle exec ./build.rb osx xcframework dynamic diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index cf549cdd7e..36961bff85 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -11,8 +11,7 @@ jobs: XCODE_VERSIONS_MATRIX: ${{ env.XCODE_VERSION }} VERSION: ${{ steps.get-version.outputs.VERSION }} steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Compute outputs run: | echo "XCODE_VERSIONS_MATRIX=${{ env.XCODE_VERSION }}" >> $GITHUB_OUTPUT @@ -26,8 +25,7 @@ jobs: name: Tag Release needs: prepare steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - uses: rickstaa/action-create-tag@v1 id: "tag_create" with: @@ -41,35 +39,28 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Gem install - run: | - gem install octokit - gem install pathname - gem install fileutils - - name: Export GITHUB_TOKEN to workspace - run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - run: brew install s3cmd - name: Publish docs - run: | - sh -x build.sh publish-docs ${{ github.sha }} + run: bundle exec sh -x build.sh publish-docs ${{ github.sha }} create-release: runs-on: macos-latest name: Create github release needs: [tag-release, prepare] + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Gem install - run: | - gem install octokit - gem install pathname - gem install fileutils - - name: Export GITHUB_TOKEN to workspace - run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true - name: Create Github release - run: ./build.sh publish-github ${{ github.sha }} + run: bundle exec ./build.sh publish-github ${{ github.sha }} publish-cocoapods: runs-on: macos-latest name: Publish Cocoapods specs @@ -77,15 +68,12 @@ jobs: env: COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install ruby - uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.1.2' bundler-cache: true - name: Publish - run: ./build.sh publish-cocoapods v${{ needs.prepare.outputs.VERSION }} + run: bundle exec ./build.sh publish-cocoapods v${{ needs.prepare.outputs.VERSION }} update-checker: runs-on: macos-latest name: Update to latest version update checker file @@ -94,15 +82,12 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.UPDATE_CHECKER_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.UPDATE_CHECKER_SECRET_KEY }} steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install ruby - uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.1.2' bundler-cache: true - - name: Create Github release - run: ./build.sh publish-update-checker + - run: brew install s3cmd + - run: bundle exec ./build.sh publish-update-checker test-installation: runs-on: macos-13 name: Run installation test for ${{ matrix.platform }}, ${{ matrix.installation }} and ${{ matrix.linkage }} @@ -140,10 +125,10 @@ jobs: - platform: visionos installation: cocoapods steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install FileUtils - run: gem install fileutils + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: ${{ env.TEST_XCODE_VERSION }} @@ -152,7 +137,7 @@ jobs: - name: Run installation test run: | cd examples/installation - ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }} + bundle exec ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }} post-slack-release: runs-on: macos-latest name: Publish to release Slack channel @@ -160,15 +145,12 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK }} steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Gem install - run: | - gem install octokit - gem install pathname - gem install fileutils + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true - name: Prepare Changelog - run: ./build.sh prepare-publish-changelog + run: bundle exec ./build.sh prepare-publish-changelog - name: 'Post to #realm-releases' uses: realm/ci-actions/release-to-slack@v3 with: diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000000..0aec50e6ed --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.1.4 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..46479e192a --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" + +gem 'cocoapods' +gem 'fileutils' +gem 'jazzy' +gem 'octokit' +gem 'pathname' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..7680647e13 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,149 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.6) + rexml + activesupport (7.1.3) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + base64 (0.2.0) + bigdecimal (3.1.6) + claide (1.1.0) + cocoapods (1.15.2) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.15.2) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.15.2) + activesupport (>= 5.0, < 8) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (2.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) + drb (2.2.0) + ruby2_keywords + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-net_http (3.1.0) + net-http + ffi (1.16.3) + fileutils (1.7.2) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + jazzy (0.14.4) + cocoapods (~> 1.5) + mustache (~> 1.1) + open4 (~> 1.3) + redcarpet (~> 3.4) + rexml (~> 3.2) + rouge (>= 2.0.6, < 5.0) + sassc (~> 2.1) + sqlite3 (~> 1.3) + xcinvoke (~> 0.3.0) + json (2.7.1) + liferaft (0.0.6) + minitest (5.22.2) + molinillo (0.8.0) + mustache (1.1.1) + mutex_m (0.2.0) + nanaimo (0.3.0) + nap (1.1.0) + net-http (0.4.1) + uri + netrc (0.11.0) + octokit (8.1.0) + base64 + faraday (>= 1, < 3) + sawyer (~> 0.9) + open4 (1.3.4) + pathname (0.2.0) + public_suffix (4.0.7) + redcarpet (3.6.0) + rexml (3.2.6) + rouge (4.2.0) + ruby-macho (2.5.1) + ruby2_keywords (0.0.5) + sassc (2.4.0) + ffi (~> 1.9) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + sqlite3 (1.7.2-arm64-darwin) + sqlite3 (1.7.2-x86_64-darwin) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uri (0.13.0) + xcinvoke (0.3.0) + liferaft (~> 0.0.6) + xcodeproj (1.24.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + +PLATFORMS + arm64-darwin-23 + x86_64-darwin-20 + +DEPENDENCIES + cocoapods + fileutils + jazzy + octokit + pathname + +BUNDLED WITH + 2.3.26 From f6c447472a4ad4400230a153d53df456b4917386 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 13 Feb 2024 10:06:34 -0800 Subject: [PATCH 4/6] Enable mime type guessing when publishing docs --- .github/workflows/publish-release.yml | 4 ++-- build.sh | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 36961bff85..b5f817031a 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -37,8 +37,8 @@ jobs: name: Publish docs to S3 Bucket needs: tag-release env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.UPDATE_CHECKER_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPDATE_CHECKER_SECRET_KEY }} GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 diff --git a/build.sh b/build.sh index f363d17165..698fcfe378 100755 --- a/build.sh +++ b/build.sh @@ -1295,11 +1295,11 @@ case "$COMMAND" in exit 0 fi - s3cmd put --recursive --acl-public --access_key=${AWS_ACCESS_KEY_ID} --secret_key=${AWS_SECRET_ACCESS_KEY} docs/swift_output/ s3://realm-sdks/docs/realm-sdks/swift/${VERSION}/ - s3cmd put --recursive --acl-public --access_key=${AWS_ACCESS_KEY_ID} --secret_key=${AWS_SECRET_ACCESS_KEY} docs/swift_output/ s3://realm-sdks/docs/realm-sdks/swift/latest/ + s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/swift_output/ s3://realm-sdks/docs/realm-sdks/swift/${VERSION}/ + s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/swift_output/ s3://realm-sdks/docs/realm-sdks/swift/latest/ - s3cmd put --recursive --acl-public --access_key=${AWS_ACCESS_KEY_ID} --secret_key=${AWS_SECRET_ACCESS_KEY} docs/objc_output/ s3://realm-sdks/docs/realm-sdks/objc/${VERSION}/ - s3cmd put --recursive --acl-public --access_key=${AWS_ACCESS_KEY_ID} --secret_key=${AWS_SECRET_ACCESS_KEY} docs/objc_output/ s3://realm-sdks/docs/realm-sdks/objc/latest/ + s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/objc_output/ s3://realm-sdks/docs/realm-sdks/objc/${VERSION}/ + s3cmd put --no-mime-magic --guess-mime-type --recursive --acl-public docs/objc_output/ s3://realm-sdks/docs/realm-sdks/objc/latest/ ;; "publish-update-checker") @@ -1311,7 +1311,7 @@ case "$COMMAND" in # update static.realm.io/update/cocoa printf "%s" "${VERSION}" > cocoa - s3cmd put --recursive --acl-public --access_key=${AWS_ACCESS_KEY_ID} --secret_key=${AWS_SECRET_ACCESS_KEY} cocoa s3://static.realm.io/update/ + s3cmd put --acl-public cocoa s3://static.realm.io/update/ exit 0 ;; From 06f8bc96cbd26e61b6726393b0407ebc9930205c Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 14 Feb 2024 08:43:50 -0800 Subject: [PATCH 5/6] Switch to using a docs-specific aws key for publishing docs --- .github/workflows/master-push.yml | 2 +- .github/workflows/publish-release.yml | 4 ++-- build.sh | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/master-push.yml b/.github/workflows/master-push.yml index 1b82370f09..885784142f 100644 --- a/.github/workflows/master-push.yml +++ b/.github/workflows/master-push.yml @@ -74,8 +74,8 @@ jobs: - name: Upload examples to artifacts library uses: actions/upload-artifact@v4 with: - path: realm-examples.zip name: realm-examples + path: realm-examples.zip build-product: # Creates framework for each platform, xcode version, target and configuration runs-on: macos-13 name: Package framework diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index b5f817031a..a6d45a084d 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -37,8 +37,8 @@ jobs: name: Publish docs to S3 Bucket needs: tag-release env: - AWS_ACCESS_KEY_ID: ${{ secrets.UPDATE_CHECKER_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.UPDATE_CHECKER_SECRET_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DOCS_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DOCS_SECRET_ACCESS_KEY }} GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 diff --git a/build.sh b/build.sh index 698fcfe378..ee79814740 100755 --- a/build.sh +++ b/build.sh @@ -286,7 +286,6 @@ create_xcframework() { local platform="$3" local out_path="$ROOT_WORKSPACE/$config/$platform/$product.xcframework" - # find "$ROOT_WORKSPACE" -maxdepth 5 find "$ROOT_WORKSPACE" -path "*/$config*/$product.framework" \ | sed 's/.*/-framework &/' \ | xargs xcodebuild -create-xcframework -allow-internal-distribution -output "$out_path" @@ -1083,7 +1082,7 @@ case "$COMMAND" in release-create-xcframework-*) platform="$2" - xcode_version=$(echo "$COMMAND" | cut -d- -f4 ) + xcode_version=$(echo "$COMMAND" | cut -d- -f4) # Artifacts are nested zips so need to be extracted twice find . -name 'build-*.zip' -exec unzip {} \; From 1679fd1ec3527ccf252efd65d80d8e08e8dcc96f Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 14 Feb 2024 09:36:05 -0800 Subject: [PATCH 6/6] Align the PR testing version of ruby with the release pipeline version --- ci_scripts/ci_post_clone.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/ci_scripts/ci_post_clone.sh b/ci_scripts/ci_post_clone.sh index 41bc8cb8a6..82bd376c7f 100755 --- a/ci_scripts/ci_post_clone.sh +++ b/ci_scripts/ci_post_clone.sh @@ -6,21 +6,16 @@ set -eo pipefail # Dependency Installer ###################################### -JAZZY_VERSION="0.14.4" -RUBY_VERSION="3.1.2" -COCOAPODS_VERSION="1.14.2" - +USE_BUNDLE_EXEC='' install_dependencies() { echo ">>> Installing dependencies for ${CI_WORKFLOW}" if [[ "$CI_WORKFLOW" == "docs"* ]]; then install_ruby - gem install jazzy -v ${JAZZY_VERSION} --no-document elif [[ "$CI_WORKFLOW" == "swiftlint"* ]]; then brew install swiftlint elif [[ "$CI_WORKFLOW" == "cocoapods"* ]]; then install_ruby - gem install cocoapods -v ${COCOAPODS_VERSION} --no-document elif [[ "$CI_WORKFLOW" == "objectserver"* ]] || [[ "$target" == "swiftpm"* ]]; then sh build.sh setup-baas sh build.sh download-core @@ -36,17 +31,14 @@ install_dependencies() { install_ruby() { echo ">>> Installing new Version of ruby" brew install rbenv ruby-build - rbenv install ${RUBY_VERSION} - rbenv global ${RUBY_VERSION} + rbenv install eval "$(rbenv init -)" + bundle install + USE_BUNDLE_EXEC=true } env -# Setup environment -export GEM_HOME="$HOME/gems" -export PATH="$GEM_HOME/bin:$PATH" - cd "$(dirname "$0")"/.. install_dependencies @@ -90,5 +82,9 @@ fi # step on the CI target as that results in nested invocations of xcodebuild, # which doesn't work. if [[ "$CI_XCODE_SCHEME" == CI ]]; then - sh build.sh ci-pr + if [[ -n "$USE_BUNDLE_EXEC" ]]; then + bundle exec sh build.sh ci-pr + else + sh build.sh ci-pr + fi fi