-
Notifications
You must be signed in to change notification settings - Fork 319
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
re-enable customer center tests in main #4170
Conversation
Find.find(project_root) do |path| | ||
# process only Swift files | ||
next unless File.file?(path) && File.extname(path) == ".swift" | ||
|
||
content = File.read(path) | ||
|
||
updated_content = content.gsub('CUSTOMER_CENTER_ENABLED', 'true') | ||
|
||
File.write(path, updated_content) if content != updated_content | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would have been shorter as a find + sed, but this is much easier to read IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I guess the fastlane commands to run tests are only run through CI normally, so this is probably ok... We could also make a sort of "block" so we restore it once tests finish, but I don't think it's worth it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😚👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Find.find(project_root) do |path| | ||
# process only Swift files | ||
next unless File.file?(path) && File.extname(path) == ".swift" | ||
|
||
content = File.read(path) | ||
|
||
updated_content = content.gsub('CUSTOMER_CENTER_ENABLED', 'true') | ||
|
||
File.write(path, updated_content) if content != updated_content | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I guess the fastlane commands to run tests are only run through CI normally, so this is probably ok... We could also make a sort of "block" so we restore it once tests finish, but I don't think it's worth it 👍
@@ -472,6 +479,28 @@ platform :ios do | |||
} | |||
end | |||
|
|||
desc "Enable Customer Center" | |||
lane :enable_customer_center do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick but should we make this a private lane?
lane :enable_customer_center do | |
private_lane :enable_customer_center do |
closing in favor of #4171 |
Customer Center is currently `#ifdef`ed out via `CUSTOMER_CENTER_ENABLED` while it is under development, but we want to run its tests during development. This defines `CUSTOMER_CENTER_ENABLED` for `OTHER_SWIFT_FLAGS` via the command line build arguments for test lanes, which will override the project settings, so the tests are run. This PR can be reverted when the customer centre is released.‼️ This PR is not needed if we go for the [source-processing method](#4170) instead.
Customer Center is currently `#ifdef`ed out via `CUSTOMER_CENTER_ENABLED` while it is under development, but we want to run its tests during development. This defines `CUSTOMER_CENTER_ENABLED` for `OTHER_SWIFT_FLAGS` via the command line build arguments for test lanes, which will override the project settings, so the tests are run. This PR can be reverted when the customer centre is released.‼️ This PR is not needed if we go for the [source-processing method](#4170) instead.
We weren't running tests for Customer Center in PRs, since the
CUSTOMER_CENTER_ENABLED
flag is disabled.This could be dangerous, so this PR enables the flag in the absolutely dumbest way I could think of: just replace the instances where the flag is used with
true
, before running tests, i.e.:It's easy to extend to other test suites. It could also have been its own test suite but I felt like it wouldn't have added much, we would have ended up most tests twice for no real gain.