Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCiOS: Update Fastfile with version model #10807

Merged
merged 41 commits into from
Nov 8, 2023

Conversation

spencertransier
Copy link
Contributor

@spencertransier spencertransier commented Sep 28, 2023

Summary

  • This PR integrates the new version and build code models from Add Version Models and Formatter/Calculator Classes wordpress-mobile/release-toolkit#512
  • It currently points to a development version of the Release Toolkit so that I could test out the call site implementation before releasing a new version of the Release Toolkit.
  • Nearly all of the precheck actions from the Release Toolkit were tightly coupled with the existing version methods. To simplify things with the new version model, I took the relevant snippets from the precheck actions and added them directly here. This is something that I've discussed with Olivier and Jeremy before in the context of "no one knows what the precheck actions do unless you dive deep down into the RT". These changes are somewhat opposite of DRY, but I think it's worth it for transparency. We may also decide in the future to create smaller actions that do more specific things versus the existing precheck and version bump actions that combine many disparate methods.

Before Merging

  • Point the Release Toolkit to a stable version

@spencertransier spencertransier added the category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. label Sep 28, 2023
@spencertransier spencertransier added this to the 15.6 milestone Sep 28, 2023
@@ -1219,10 +1295,62 @@ def inject_buildkite_analytics_environment(xctestrun_path:)
File.write(xctestrun_path, Plist::Emit.dump(xctestrun))
end

# Returns the version of the app based on the specified xcconfig file

Copy link
Contributor Author

@spencertransier spencertransier Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a test lane that verified these values are being calculated and formatted as expected (given a VERSION_LONG of 15.5.2 and a VERSION_SHORT of 15.5.2.4):

Screenshot 2023-09-28 at 11 35 30 AM

# bundle exec fastlane build_and_upload_beta skip_confirm:true
#####################################################################################
desc 'Builds and uploads for distribution'
lane :build_and_upload_beta do |options|
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After searching the release scenario, Buildkite scripts, and Buildkite pipelines, I did not find any instances of this lane being used.

# bundle exec fastlane build_and_upload_release skip_confirm:true
#####################################################################################
desc 'Builds and uploads for distribution'
lane :build_and_upload_release do |options|
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After searching the release scenario, Buildkite scripts, and Buildkite pipelines, I did not find any instances of this lane being used.

Comment on lines +37 to +41
# Instanstiate versioning classes
VERSION_CALCULATOR = Fastlane::Wpmreleasetoolkit::Versioning::MarketingVersionCalculator.new
VERSION_FORMATTER = Fastlane::Wpmreleasetoolkit::Versioning::FourPartVersionFormatter.new
BUILD_CODE_FORMATTER = Fastlane::Wpmreleasetoolkit::Versioning::FourPartBuildCodeFormatter.new
VERSION_FILE = Fastlane::Wpmreleasetoolkit::Versioning::IOSVersionFile.new(xcconfig_path: PUBLIC_CONFIG_FILE)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the various version and build code formatters/calculators are instantiated to be used by the rest of the Fastfile.

Comment on lines 138 to 140
# Ensure we use the latest version of the toolkit
check_for_toolkit_updates unless is_ci || ENV['FASTLANE_SKIP_TOOLKIT_UPDATE_CHECK']

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this check to the top of the code_freeze lane instead of before_all. It hasn't been useful to have it run before every single lane during the course of a release.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 28, 2023

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr10807-97204c6
Version15.9
Bundle IDcom.automattic.alpha.woocommerce
Commit97204c6
App Center BuildWooCommerce - Prototype Builds #6666
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@spencertransier spencertransier changed the title Update Fastfile with version model WCiOS: Update Fastfile with version model Sep 29, 2023
@spencertransier spencertransier modified the milestones: 15.6, 15.7 Sep 29, 2023
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
@@ -542,7 +618,7 @@ platform :ios do
archive_zip_path = File.join(File.dirname(Dir.pwd), 'WooCommerce.xarchive.zip')
zip(path: lane_context[SharedValues::XCODEBUILD_ARCHIVE], output_path: archive_zip_path)

version = options[:beta_release] ? ios_get_build_version : app_version
version = options[:beta_release] ? current_build_code : current_release_version
create_release(
repository: GITHUB_REPO,
version:,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a value for this parameter here 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the Ruby 3 convention of not needing to include the argument if the name of the argument is the same as the name of the parameter.

fastlane/Fastfile Outdated Show resolved Hide resolved
@spencertransier spencertransier modified the milestones: 15.9, 16.0 Oct 20, 2023
@spencertransier spencertransier modified the milestones: 16.0 ❄️, 16.1 Oct 29, 2023
@spencertransier
Copy link
Contributor Author

@mokagio I've updated this one with the changes from WP/JPiOS, so it is ready to review again.

fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
@spencertransier
Copy link
Contributor Author

@mokagio Thank you for taking another look! Sorry, I thought I had already fixed most of those cases for WCiOS, but I think I was getting it mixed up with another app 🤪. All your comments are now addressed 👍

@spencertransier spencertransier modified the milestones: 16.1, 16.2 Nov 3, 2023
Copy link
Contributor

@mokagio mokagio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good. At this point, the best thing to do is to merge and see how we go on the next code freeze 👍

@spencertransier spencertransier merged commit 50c0e16 into trunk Nov 8, 2023
22 checks passed
@spencertransier spencertransier deleted the update/release-toolkit-version-model branch November 8, 2023 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants