From 62f97e4ec39b8a738066f9b33ab21666e522bdac Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Tue, 1 Feb 2022 20:59:09 -0700 Subject: [PATCH 01/13] Remove CircleCI --- .circleci/cache-version | 2 - .circleci/config.yml | 298 ---------------------------------------- README.md | 2 +- Rakefile | 5 +- fastlane/Fastfile | 21 ++- 5 files changed, 10 insertions(+), 318 deletions(-) delete mode 100644 .circleci/cache-version delete mode 100644 .circleci/config.yml diff --git a/.circleci/cache-version b/.circleci/cache-version deleted file mode 100644 index 76dd971a84de..000000000000 --- a/.circleci/cache-version +++ /dev/null @@ -1,2 +0,0 @@ -# To invalidate the cache, generate a new UUID using `uuidgen` on the command line then paste it here -D557401C-64E1-4BE6-B525-3E0CAF51B452 diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 1cc7a70542e3..000000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,298 +0,0 @@ -version: 2.1 - -orbs: - # Using 1.0 of the Orbs means it will use the latest 1.0.x version from https://github.com/wordpress-mobile/circleci-orbs - ios: wordpress-mobile/ios@1.0 - git: wordpress-mobile/git@1.0 - slack: circleci/slack@3.4.2 - -parameters: - beta_build: - type: boolean - default: false - release_build: - type: boolean - default: false - -xcode_version: &xcode_version - xcode-version: "13.0.0" - -iphone_test_device: &iphone_test_device - device: iPhone 12 - ios-version: "15.0" - -ipad_test_device: &ipad_test_device - device: iPad Air (4th generation) - ios-version: "15.0" - -commands: - fix-image: - steps: - - run: - name: Fix CI Image - command: | - # Add `/usr/local/bin` to the Xcode 11.2 image's $PATH in order to be able to use dependencies - - if [ $(echo $PATH | ruby -e "puts Kernel.gets.include?('/usr/local/bin')") != "true" ]; then - echo 'export PATH=/usr/local/bin:$PATH' >> $BASH_ENV - echo "Manually added `/usr/local/bin` to the $PATH:" - echo $PATH - fi - - chruby ruby-$(cat .ruby-version) - gem install bundler - - # Prevent fastlane from checking for updates, also removing the verbose fastlane changelog at the end of each invocation. - echo "export FASTLANE_SKIP_UPDATE_CHECK=1" >> $BASH_ENV - - run: - name: Fix SSH setup to fetch Swift packages from GitHub - command: | - for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true - -jobs: - Build Tests: - parameters: - device: - type: string - description: The device (e.g. "iPhone 11") to use when compiling the build. - ios-version: - description: The iOS deployment target (e.g. "13.0") used to compile the build that will be used for testing. - type: string - executor: - name: ios/default - <<: *xcode_version - steps: - - fix-image - - git/shallow-checkout - - ios/install-dependencies: - bundle-install: true - pod-install: true - cache-prefix: cache-prefix-{{ checksum ".circleci/cache-version" }} - - run: - name: Install Dependencies - command: rake dependencies - - run: - name: Build for Testing - command: bundle exec fastlane build_for_testing device:'<< parameters.device >>' ios-version:'<< parameters.ios-version >>' - - persist_to_workspace: - root: ./ - paths: - - DerivedData/Build/Products - - Pods/WordPressMocks - - vendor/bundle - Unit Tests: - parameters: - device: - type: string - description: The device (e.g. "iPhone 11") to use when running unit tests. - ios-version: - description: The iOS version (e.g. "14.0") of the device used to run tests. - type: string - executor: - name: ios/default - <<: *xcode_version - steps: - - fix-image - - git/shallow-checkout - - attach_workspace: - at: ./ - - run: - name: Prepare Bundle - command: bundle --path vendor/bundle - - run: - name: Run Unit Tests - command: bundle exec fastlane test_without_building name:WordPressUnitTests device:'<< parameters.device >>' ios-version:'<< parameters.ios-version >>' - - ios/save-xcodebuild-artifacts: - result-bundle-path: build/results - UI Tests: - parameters: - device: - type: string - description: The device (e.g. "iPhone 11") to use when running tests. - ios-version: - description: The iOS version (e.g. "14.0") of the device used to run tests. - type: string - post-to-slack: - description: Post to Slack when tests fail. SLACK_WEBHOOK ENV variable must be set. - type: boolean - default: false - executor: - name: ios/default - <<: *xcode_version - steps: - - fix-image - - git/shallow-checkout - - attach_workspace: - at: ./ - - run: - name: Prepare Bundle - command: bundle --path vendor/bundle - - run: - name: Run mocks - command: ./Pods/WordPressMocks/scripts/start.sh 8282 - background: true - - run: - name: Run UI Tests - command: bundle exec fastlane test_without_building name:WordPressUITests device:'<< parameters.device >>' ios-version:'<< parameters.ios-version >>' - - ios/save-xcodebuild-artifacts: - result-bundle-path: build/results - - when: - condition: << parameters.post-to-slack >> - steps: - - run: - name: Prepare Slack message - when: always - command: | - # Get the name of the device that is running. - echo "export SLACK_FAILURE_MESSAGE=':red_circle: WordPress iOS UI tests failed on << parameters.device >> in \`${CIRCLE_BRANCH}\` branch by ${CIRCLE_USERNAME}.\n\nPlease reach out in #platform9 if you think this failure is not caused by your changes, so we can investigate.'" >> $BASH_ENV - - slack/status: - fail_only: true - include_job_number_field: false - include_project_field: false - failure_message: '${SLACK_FAILURE_MESSAGE}' - Release Build: - executor: - name: ios/default - <<: *xcode_version - environment: - HOMEBREW_NO_AUTO_UPDATE: 1 - steps: - - fix-image - - run: - name: Setup Notifications - command: | - echo "export SLACK_FAILURE_MESSAGE=':red_circle: Build for WordPress iOS failed!'" >> $BASH_ENV - - git/shallow-checkout - - ios/install-dependencies: - bundle-install: true - pod-install: true - cache-prefix: cache-prefix-{{ checksum ".circleci/cache-version" }} - - run: - name: Copy Secrets - command: bundle exec fastlane run configure_apply - - run: - name: Install other tools - command: | - brew update # Update homebrew to temporarily fix a bintray issue - brew install imagemagick - brew install ghostscript - curl -sL https://sentry.io/get-cli/ | bash - - run: - name: Setup notifications - command: | - APP_VERSION=$(cat config/Version.Public.xcconfig | grep "^VERSION_LONG" | cut -d "=" -f2) - echo "export SLACK_FAILURE_MESSAGE=':red_circle: Build for WordPress iOS $APP_VERSION failed!'" >> $BASH_ENV - echo "export SLACK_SUCCESS_MESSAGE=':tada: WordPress iOS $APP_VERSION has been deployed!'" >> $BASH_ENV - - when: - condition: << pipeline.parameters.beta_build >> - steps: - - run: - name: Build - command: | - bundle exec fastlane build_and_upload_beta_release skip_confirm:true create_gh_release:true - bundle exec fastlane build_and_upload_jetpack_for_app_store - no_output_timeout: 60m - - when: - condition: << pipeline.parameters.release_build >> - steps: - - run: - name: Build - command: | - bundle exec fastlane build_and_upload_stable_release skip_confirm:true create_gh_release:true - bundle exec fastlane build_and_upload_jetpack_for_app_store - no_output_timeout: 60m - - slack/status: - include_job_number_field: false - include_project_field: false - include_visit_job_action: false - webhook: '${SLACK_BUILD_WEBHOOK}' - failure_message: '${SLACK_FAILURE_MESSAGE}' - success_message: '${SLACK_SUCCESS_MESSAGE}' - Build Jetpack: - executor: - name: ios/default - <<: *xcode_version - environment: - HOMEBREW_NO_AUTO_UPDATE: 1 - steps: - - fix-image - - git/shallow-checkout - - ios/install-dependencies: - bundle-install: true - pod-install: true - cache-prefix: cache-prefix-{{ checksum ".circleci/cache-version" }} - - run: - name: Copy Secrets - command: bundle exec fastlane run configure_apply - - run: - name: Install other tools - command: | - brew update # Update homebrew to temporarily fix a bintray issue - brew install imagemagick - brew install ghostscript - curl -sL https://sentry.io/get-cli/ | bash - - run: - name: Build - command: bundle exec fastlane build_jetpack_for_testing - no_output_timeout: 60m -workflows: - wordpress_ios: - when: - and: - - not: << pipeline.parameters.beta_build >> - - not: << pipeline.parameters.release_build >> - jobs: - - Build Tests: - <<: *iphone_test_device - - Unit Tests: - <<: *iphone_test_device - requires: [ "Build Tests" ] - # Always run UI tests on trunk and release branches - - UI Tests: - name: UI Tests (iPhone) - <<: *iphone_test_device - post-to-slack: true - requires: [ "Build Tests" ] - filters: - branches: - only: - - trunk - - /^release.*/ - - /^gutenberg\/integrate_release_.*/ - - UI Tests: - name: UI Tests (iPad) - <<: *ipad_test_device - post-to-slack: true - requires: [ "Build Tests" ] - filters: - branches: - only: - - trunk - - /^release.*/ - - /^gutenberg\/integrate_release_.*/ - - Build Jetpack: - name: Build Jetpack (without testing) - #Optionally run UI tests on PRs - - Optional Tests: - type: approval - requires: [ "Build Tests" ] - filters: - branches: - ignore: - - trunk - - /^release.*/ - - /^gutenberg\/integrate_release_.*/ - - UI Tests: - name: UI Tests (iPhone) - <<: *iphone_test_device - requires: [ "Optional Tests" ] - - UI Tests: - name: UI Tests (iPad) - <<: *ipad_test_device - requires: [ "Optional Tests" ] - - Release Build: - when: - or: [ << pipeline.parameters.beta_build >>, << pipeline.parameters.release_build >> ] - jobs: - - Release Build diff --git a/README.md b/README.md index 33a44b5a1fc8..e47b44f63846 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # WordPress for iOS # -[![CircleCI](https://circleci.com/gh/wordpress-mobile/WordPress-iOS.svg?style=svg)](https://circleci.com/gh/wordpress-mobile/WordPress-iOS) +[![Build status](https://badge.buildkite.com/2f3fbb17bfbb5bba508efd80f1ea8d640db5ca2465a516a457.svg)](https://buildkite.com/automattic/wordpress-ios) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) ## Build Instructions diff --git a/Rakefile b/Rakefile index 1a35ee5c7707..18e83000ae30 100644 --- a/Rakefile +++ b/Rakefile @@ -345,10 +345,7 @@ namespace :install do end def get_ci_xcode_version - ci_config = File.read(".circleci/config.yml") - specs = YAML.load(ci_config) - - ci_version = specs["jobs"]["Build Tests"]["executor"]["xcode-version"] + ci_version = File.read(".xcversion") end end diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 2afdc3a51cdf..6a84fe4402e7 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -65,11 +65,6 @@ before_all do |lane| unless File.file?(PROJECT_ENV_FILE_PATH) UI.user_error!("project.env not found at #{PROJECT_ENV_FILE_PATH}: Make sure your configuration is up to date with `rake dependencies`") end - - # This allows code signing to work on CircleCI - # It is skipped if this isn't running on CI - # See https://circleci.com/docs/2.0/ios-codesigning/ - setup_circle_ci end platform :ios do @@ -847,11 +842,11 @@ platform :ios do # ##################################################################################### lane :trigger_beta_build do |options| - circleci_trigger_job( - circle_ci_token: ENV['CIRCLE_CI_AUTH_TOKEN'], - repository: REPOSITORY_NAME, + buildkite_trigger_build( + buildkite_organization: 'automattic', + buildkite_pipeline: 'wordpress-ios', branch: options[:branch_to_build], - job_params: { 'beta_build' => true } + pipeline_file: 'release-builds.yml' ) end @@ -865,11 +860,11 @@ platform :ios do # ##################################################################################### lane :trigger_release_build do |options| - circleci_trigger_job( - circle_ci_token: ENV['CIRCLE_CI_AUTH_TOKEN'], - repository: REPOSITORY_NAME, + buildkite_trigger_build( + buildkite_organization: 'automattic', + buildkite_pipeline: 'wordpress-ios', branch: options[:branch_to_build], - job_params: { 'release_build' => true } + pipeline_file: 'release-builds.yml' ) end From 5e32ed7eb154affb3f5b8b578866d8621d7cf54d Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Thu, 3 Feb 2022 19:24:49 -0700 Subject: [PATCH 02/13] Remove CircleCI Token from user.env-example --- fastlane/env/user.env-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/env/user.env-example b/fastlane/env/user.env-example index 763c920ccaf1..f75ebe246bc8 100644 --- a/fastlane/env/user.env-example +++ b/fastlane/env/user.env-example @@ -5,4 +5,4 @@ GHHELPER_ACCESS= APPCENTER_API_TOKEN= SENTRY_AUTH_TOKEN= -CIRCLE_CI_AUTH_TOKEN= +BUILDKITE_TOKEN= From 7f5bee1928d9a755d49d797bf973f1b2312da658 Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Thu, 3 Feb 2022 19:28:27 -0700 Subject: [PATCH 03/13] Remove deprecated lane --- fastlane/Fastfile | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 6a84fe4402e7..588993a90d6b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -481,11 +481,8 @@ platform :ios do ##################################################################################### desc 'Builds and uploads a beta release for distribution' lane :build_and_upload_beta_release do |options| - build_and_upload_release( - skip_confirm: options[:skip_confirm], - create_gh_release: options[:create_gh_release], - beta_release: true - ) + build_and_upload_app_center(options) + build_and_upload_app_store_connect(options) end ##################################################################################### @@ -505,31 +502,6 @@ platform :ios do ##################################################################################### desc 'Builds and uploads a stable release for distribution' lane :build_and_upload_stable_release do |options| - build_and_upload_release( - skip_confirm: options[:skip_confirm], - create_gh_release: options[:create_gh_release], - beta_release: false - ) - end - - ##################################################################################### - # build_and_upload_release [Deprecated - Can be removed once CircleCI is no longer in use] - # ----------------------------------------------------------------------------------- - # This lane builds the app and uploads it for both internal and external distribution - # ----------------------------------------------------------------------------------- - # Usage: - # bundle exec fastlane build_and_upload_release [skip_confirm:] - # [create_gh_release:] [beta_release:] - # - # Example: - # bundle exec fastlane build_and_upload_release - # bundle exec fastlane build_and_upload_release skip_confirm:true - # bundle exec fastlane build_and_upload_release create_gh_release:true - # bundle exec fastlane build_and_upload_release beta_release:true - ##################################################################################### - desc 'Builds and uploads for distribution' - lane :build_and_upload_release do |options| - build_and_upload_app_center(options) if options[:beta_release] build_and_upload_app_store_connect(options) end From b9ad2580883b02778056a112acbbad80dd6e8983 Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Thu, 3 Feb 2022 19:46:03 -0700 Subject: [PATCH 04/13] Fix keychain issues --- fastlane/Fastfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 588993a90d6b..5add429f81aa 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -57,6 +57,9 @@ before_all do |lane| # Ensure we use the latest version of the toolkit check_for_toolkit_updates unless is_ci || ENV['FASTLANE_SKIP_TOOLKIT_UPDATE_CHECK'] + # Fixes weird Keychain bugs + setup_ci + # Check that the env files exist unless is_ci || File.file?(USER_ENV_FILE_PATH) example_path = 'fastlane/env/user.env-example ' From 3eeef7f618b7a2fb9e6ab488c7a19b6853e79389 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 10:59:28 +0100 Subject: [PATCH 05/13] Point release toolkit to `trunk` to get `buildkite_trigger_build` action --- Gemfile.lock | 39 ++++++++++++++++++++++++--------------- fastlane/Pluginfile | 4 ++-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index eea70de2c368..936daeaadd76 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,23 @@ +GIT + remote: git@github.com:wordpress-mobile/release-toolkit + revision: c198441d2050c52714d40c8791d0020bd1c4f752 + branch: trunk + specs: + fastlane-plugin-wpmreleasetoolkit (2.3.0) + activesupport (~> 5) + bigdecimal (~> 1.4) + buildkit (~> 1.4) + chroma (= 0.2.0) + diffy (~> 3.3) + git (~> 1.3) + jsonlint (~> 0.3) + nokogiri (~> 1.11) + octokit (~> 4.18) + parallel (~> 1.14) + progress_bar (~> 1.3) + rake (>= 12.3, < 14.0) + rake-compiler (~> 1.0) + GEM remote: https://rubygems.org/ specs: @@ -33,6 +53,8 @@ GEM aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) bigdecimal (1.4.4) + buildkit (1.4.5) + sawyer (>= 0.6) chroma (0.2.0) claide (1.1.0) cocoapods (1.11.2) @@ -161,19 +183,6 @@ GEM xcpretty-travis-formatter (>= 0.0.3) fastlane-plugin-appcenter (1.11.0) fastlane-plugin-sentry (1.8.1) - fastlane-plugin-wpmreleasetoolkit (2.3.0) - activesupport (~> 5) - bigdecimal (~> 1.4) - chroma (= 0.2.0) - diffy (~> 3.3) - git (~> 1.3) - jsonlint (~> 0.3) - nokogiri (~> 1.11) - octokit (~> 4.18) - parallel (~> 1.14) - progress_bar (~> 1.3) - rake (>= 12.3, < 14.0) - rake-compiler (~> 1.0) ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) @@ -245,7 +254,7 @@ GEM nokogiri (1.13.1) mini_portile2 (~> 2.7.0) racc (~> 1.4) - octokit (4.21.0) + octokit (4.22.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) oj (3.13.11) @@ -331,7 +340,7 @@ DEPENDENCIES fastlane (~> 2.174) fastlane-plugin-appcenter (~> 1.8) fastlane-plugin-sentry - fastlane-plugin-wpmreleasetoolkit (~> 2.3) + fastlane-plugin-wpmreleasetoolkit! octokit (~> 4.0) rake rmagick (~> 3.2.0) diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index bb5c3d1e3d20..4c78f66c4ba9 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -7,8 +7,8 @@ group :screenshots, optional: true do end # This comment avoids typing to switch to a development version for testing. -# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'trunk' -gem 'fastlane-plugin-wpmreleasetoolkit', '~> 2.3' +gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'trunk' +# gem 'fastlane-plugin-wpmreleasetoolkit', '~> 2.3' gem 'fastlane-plugin-sentry' gem 'fastlane-plugin-appcenter', '~> 1.8' From ea7bdb7e8ec42653fe46ebe1f1b3bda255aa780f Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:04:14 +0100 Subject: [PATCH 06/13] Remove `build_and_upload_beta_release` lane, recently become unused --- fastlane/Fastfile | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5add429f81aa..5da4e1c7329f 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -467,27 +467,6 @@ platform :ios do download_jetpack_localized_app_store_metadata end - ##################################################################################### - # build_and_upload_beta_release - # ----------------------------------------------------------------------------------- - # This lane builds a beta release of the app and optionally uploads - # it for both internal and external distribution - # ----------------------------------------------------------------------------------- - # Usage: - # bundle exec fastlane build_and_upload_beta_release [skip_confirm:] - # [create_gh_release:] - # - # Example: - # bundle exec fastlane build_and_upload_beta_release - # bundle exec fastlane build_and_upload_beta_release skip_confirm:true - # bundle exec fastlane build_and_upload_beta_release create_gh_release:true - ##################################################################################### - desc 'Builds and uploads a beta release for distribution' - lane :build_and_upload_beta_release do |options| - build_and_upload_app_center(options) - build_and_upload_app_store_connect(options) - end - ##################################################################################### # build_and_upload_stable_release # ----------------------------------------------------------------------------------- From 3c593f24f8897a3f37893507f279c2ab60ce92e2 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:05:25 +0100 Subject: [PATCH 07/13] Remove `build_and_upload_stable_release` lane, recently become unused --- fastlane/Fastfile | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5da4e1c7329f..cd22c5f877b5 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -467,26 +467,6 @@ platform :ios do download_jetpack_localized_app_store_metadata end - ##################################################################################### - # build_and_upload_stable_release - # ----------------------------------------------------------------------------------- - # This lane builds a stable release of the app and optionally uploads - # it for distribution - # ----------------------------------------------------------------------------------- - # Usage: - # bundle exec fastlane build_and_upload_stable_release [skip_confirm:] - # [create_gh_release:] - # - # Example: - # bundle exec fastlane build_and_upload_stable_release - # bundle exec fastlane build_and_upload_stable_release skip_confirm:true - # bundle exec fastlane build_and_upload_stable_release create_gh_release:true - ##################################################################################### - desc 'Builds and uploads a stable release for distribution' - lane :build_and_upload_stable_release do |options| - build_and_upload_app_store_connect(options) - end - ##################################################################################### # build_and_upload_app_store_connect # ----------------------------------------------------------------------------------- From 7a946039f2408c1136e385b274de17f665662bcb Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:15:49 +0100 Subject: [PATCH 08/13] DRY calls to Buildkite action in `Fastfile` This will also make the addition of a parameter to differentiate between beta and stable builds cleaner. --- fastlane/Fastfile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index cd22c5f877b5..d8be943ab1fe 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -776,12 +776,7 @@ platform :ios do # ##################################################################################### lane :trigger_beta_build do |options| - buildkite_trigger_build( - buildkite_organization: 'automattic', - buildkite_pipeline: 'wordpress-ios', - branch: options[:branch_to_build], - pipeline_file: 'release-builds.yml' - ) + trigger_buildkite_release_build(branch: options[:branch_to_build]) end ##################################################################################### @@ -794,12 +789,7 @@ platform :ios do # ##################################################################################### lane :trigger_release_build do |options| - buildkite_trigger_build( - buildkite_organization: 'automattic', - buildkite_pipeline: 'wordpress-ios', - branch: options[:branch_to_build], - pipeline_file: 'release-builds.yml' - ) + trigger_buildkite_release_build(branch: options[:branch_to_build]) end ######################################################################## @@ -978,6 +968,15 @@ def generate_installable_build_number end end +def trigger_buildkite_release_build(branch:) + buildkite_trigger_build( + buildkite_organization: 'automattic', + buildkite_pipeline: 'wordpress-ios', + branch: branch, + pipeline_file: 'release-builds.yml' + ) +end + # Application-agnostic settings for the `upload_to_app_store` action, also # known as `deliver`. UPLOAD_TO_APP_STORE_COMMON_PARAMS = { From f8087cd37d21e32820f8831fd670c29e57c45daa Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:19:13 +0100 Subject: [PATCH 09/13] Move each parameter in `release-build-wordpress.sh` to dedicate line We'll add another one next, and the line length would have gotten too long --- .buildkite/commands/release-build-wordpress.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.buildkite/commands/release-build-wordpress.sh b/.buildkite/commands/release-build-wordpress.sh index f82acbe8b2e5..2330b2bc1de3 100644 --- a/.buildkite/commands/release-build-wordpress.sh +++ b/.buildkite/commands/release-build-wordpress.sh @@ -19,4 +19,6 @@ echo "--- :closed_lock_with_key: Installing Secrets" bundle exec fastlane run configure_apply echo "--- :hammer_and_wrench: Building" -bundle exec fastlane build_and_upload_app_store_connect skip_confirm:true create_gh_release:true +bundle exec fastlane build_and_upload_app_store_connect \ + skip_confirm:true \ + create_gh_release:true From ac614d56829ea14b412ba4db7de72d6a7f92924c Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:28:56 +0100 Subject: [PATCH 10/13] Allow `release-build-wordpress.sh` to specify whether to build a beta --- .buildkite/commands/release-build-wordpress.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/commands/release-build-wordpress.sh b/.buildkite/commands/release-build-wordpress.sh index 2330b2bc1de3..f05f86f65253 100644 --- a/.buildkite/commands/release-build-wordpress.sh +++ b/.buildkite/commands/release-build-wordpress.sh @@ -21,4 +21,5 @@ bundle exec fastlane run configure_apply echo "--- :hammer_and_wrench: Building" bundle exec fastlane build_and_upload_app_store_connect \ skip_confirm:true \ - create_gh_release:true + create_gh_release:true \ + beta_release:${1:-true} # use first call param, default to true for safety From a29811423d4b549b72299e460c7b39b7e3f7011a Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:30:48 +0100 Subject: [PATCH 11/13] Forward beta release parameter from Fastlane to Buildkite --- .buildkite/release-builds.yml | 2 +- fastlane/Fastfile | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.buildkite/release-builds.yml b/.buildkite/release-builds.yml index 0fa25a6f7742..4638aebe612c 100644 --- a/.buildkite/release-builds.yml +++ b/.buildkite/release-builds.yml @@ -15,7 +15,7 @@ common_params: steps: - label: "🛠 WordPress Release Build (App Store Connect)" - command: ".buildkite/commands/release-build-wordpress.sh" + command: ".buildkite/commands/release-build-wordpress.sh $BETA_RELEASE" env: *common_env plugins: *common_plugins notify: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d8be943ab1fe..722d469df8b1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -776,7 +776,7 @@ platform :ios do # ##################################################################################### lane :trigger_beta_build do |options| - trigger_buildkite_release_build(branch: options[:branch_to_build]) + trigger_buildkite_release_build(branch: options[:branch_to_build], beta: true) end ##################################################################################### @@ -789,7 +789,7 @@ platform :ios do # ##################################################################################### lane :trigger_release_build do |options| - trigger_buildkite_release_build(branch: options[:branch_to_build]) + trigger_buildkite_release_build(branch: options[:branch_to_build], beta: false) end ######################################################################## @@ -968,11 +968,12 @@ def generate_installable_build_number end end -def trigger_buildkite_release_build(branch:) +def trigger_buildkite_release_build(branch:, beta:) buildkite_trigger_build( buildkite_organization: 'automattic', buildkite_pipeline: 'wordpress-ios', branch: branch, + environment: { BETA_RELEASE: beta }, pipeline_file: 'release-builds.yml' ) end From ac4208120bde29b025c3debf813e609285532bac Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:38:01 +0100 Subject: [PATCH 12/13] Make `release-build-*` Buildkite scripts executable After adding a parameter to the `release-build-wordpress.sh` call, I got a permission denied error. See https://buildkite.com/automattic/wordpress-ios/builds/4907#226a7e18-7592-4e95-9064-2829b4cb7f12/381-383 I guess if the path to a script is the only value in the `command` node, then Buildkite calls it via `sh` (or maybe `$SHELL`), otherwise it runs it as an actual command within its shell, in which case if the script is not executable, it fails. --- .buildkite/commands/release-build-jetpack.sh | 0 .buildkite/commands/release-build-wordpress-internal.sh | 0 .buildkite/commands/release-build-wordpress.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .buildkite/commands/release-build-jetpack.sh mode change 100644 => 100755 .buildkite/commands/release-build-wordpress-internal.sh mode change 100644 => 100755 .buildkite/commands/release-build-wordpress.sh diff --git a/.buildkite/commands/release-build-jetpack.sh b/.buildkite/commands/release-build-jetpack.sh old mode 100644 new mode 100755 diff --git a/.buildkite/commands/release-build-wordpress-internal.sh b/.buildkite/commands/release-build-wordpress-internal.sh old mode 100644 new mode 100755 diff --git a/.buildkite/commands/release-build-wordpress.sh b/.buildkite/commands/release-build-wordpress.sh old mode 100644 new mode 100755 From f1728ddd50d3cacbf4aa10618a6f78bf790950e1 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Wed, 9 Feb 2022 22:33:41 +0100 Subject: [PATCH 13/13] Update release toolkit to version 3.0.0 to get `buildkite_trigger_build` --- Gemfile.lock | 38 ++++++++++++++++---------------------- fastlane/Pluginfile | 4 ++-- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 936daeaadd76..d7075f55f106 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,23 +1,3 @@ -GIT - remote: git@github.com:wordpress-mobile/release-toolkit - revision: c198441d2050c52714d40c8791d0020bd1c4f752 - branch: trunk - specs: - fastlane-plugin-wpmreleasetoolkit (2.3.0) - activesupport (~> 5) - bigdecimal (~> 1.4) - buildkit (~> 1.4) - chroma (= 0.2.0) - diffy (~> 3.3) - git (~> 1.3) - jsonlint (~> 0.3) - nokogiri (~> 1.11) - octokit (~> 4.18) - parallel (~> 1.14) - progress_bar (~> 1.3) - rake (>= 12.3, < 14.0) - rake-compiler (~> 1.0) - GEM remote: https://rubygems.org/ specs: @@ -183,6 +163,20 @@ GEM xcpretty-travis-formatter (>= 0.0.3) fastlane-plugin-appcenter (1.11.0) fastlane-plugin-sentry (1.8.1) + fastlane-plugin-wpmreleasetoolkit (3.0.0) + activesupport (~> 5) + bigdecimal (~> 1.4) + buildkit (~> 1.4) + chroma (= 0.2.0) + diffy (~> 3.3) + git (~> 1.3) + jsonlint (~> 0.3) + nokogiri (~> 1.11) + octokit (~> 4.18) + parallel (~> 1.14) + progress_bar (~> 1.3) + rake (>= 12.3, < 14.0) + rake-compiler (~> 1.0) ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) @@ -340,11 +334,11 @@ DEPENDENCIES fastlane (~> 2.174) fastlane-plugin-appcenter (~> 1.8) fastlane-plugin-sentry - fastlane-plugin-wpmreleasetoolkit! + fastlane-plugin-wpmreleasetoolkit (~> 3.0) octokit (~> 4.0) rake rmagick (~> 3.2.0) xcpretty-travis-formatter BUNDLED WITH - 2.2.33 + 2.3.6 diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index 4c78f66c4ba9..098c8f2fd31a 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -7,8 +7,8 @@ group :screenshots, optional: true do end # This comment avoids typing to switch to a development version for testing. -gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'trunk' -# gem 'fastlane-plugin-wpmreleasetoolkit', '~> 2.3' +# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: '' +gem 'fastlane-plugin-wpmreleasetoolkit', '~> 3.0' gem 'fastlane-plugin-sentry' gem 'fastlane-plugin-appcenter', '~> 1.8'