Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite/commands/prototype-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply

echo "--- :hammer_and_wrench: Building"
bundle exec fastlane build_and_upload_prototype_build
bundle exec fastlane build_for_prototype_build
10 changes: 10 additions & 0 deletions .buildkite/commands/prototype-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -eu

echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply

echo "--- :firebase: Uploading to Firebase"
bundle exec fastlane upload_prototype_build
41 changes: 33 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,52 @@ steps:
#################
# Create Prototype Build
#################
- label: ":hammer_and_wrench: Prototype Build"
command: .buildkite/commands/prototype-build.sh
plugins: [$CI_TOOLKIT]
- group: ":hammer_and_wrench: Prototype Build"
if: build.pull_request.id != null
notify:
- github_commit_status:
context: Prototype Build
steps:
- label: ":hammer_and_wrench: Prototype Build - Build"
key: build_prototype
command: .buildkite/commands/prototype-build.sh
plugins: [$CI_TOOLKIT]
artifact_paths:
- artifacts/*.ipa
- artifacts/*.app.dSYM.zip
notify:
- github_commit_status:
context: Prototype Build - Build

- label: ":firebase: Prototype Build - Upload"
depends_on: build_prototype
command: .buildkite/commands/prototype-upload.sh
plugins: [$CI_TOOLKIT]
notify:
- github_commit_status:
context: Prototype Build - Upload

- group: ":rocket: Prototype Build"
if: build.branch == "trunk"
steps:
- input: Deploy Prototype Build?
prompt: Share a Prototype Build via Firebase App Distribution?
key: prototype_triggered
- label: Prototype Build
- label: ":hammer_and_wrench: Prototype Build - Build"
depends_on: prototype_triggered
key: build_prototype_trunk
command: .buildkite/commands/prototype-build.sh
plugins: [$CI_TOOLKIT]
artifact_paths:
- artifacts/*.ipa
- artifacts/*.app.dSYM.zip
notify:
- github_commit_status:
context: Prototype Build From Trunk - Build
- label: ":firebase: Prototype Build - Upload"
depends_on: build_prototype_trunk
command: .buildkite/commands/prototype-upload.sh
plugins: [$CI_TOOLKIT]
notify:
- github_commit_status:
context: Prototype Build From Trunk
context: Prototype Build From Trunk - Upload

#################
# Run Unit Tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
build/
DerivedData/
WooCommerce/DerivedSources/
artifacts/

## Various settings
*.pbxuser
Expand Down
77 changes: 49 additions & 28 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ DERIVED_DATA_DIR = File.join(FASTLANE_DIR, 'DerivedData')
SCREENSHOTS_DIR = File.join(FASTLANE_DIR, 'screenshots')
FASTLANE_METADATA_FOLDER = File.join(FASTLANE_DIR, 'metadata')
WORKSPACE_PATH = File.join(PROJECT_ROOT_FOLDER, 'WooCommerce.xcworkspace')
ARTIFACTS_FOLDER = File.join(PROJECT_ROOT_FOLDER, 'artifacts')
PROTOTYPE_BUILD_IPA_NAME = 'WooCommerce'

# Firebase App Distribution
FIREBASE_APP_ID = '1:124902176124:ios:02259de1e7c42b291620f9'
Expand Down Expand Up @@ -778,6 +780,51 @@ platform :ios do
xcversion # Ensure we're using the right version of Xcode, defined in `.xcode-version` file

build_for_prototype_build
upload_prototype_build
end

desc 'Builds a prototype build (Enterprise build)'
lane :build_for_prototype_build do |fetch_code_signing: true|
update_certs_and_profiles_enterprise if fetch_code_signing

pr_prefix = pull_request_number&.then { |num| "pr#{num}" }
commit_short_hash = ENV.fetch('BUILDKITE_COMMIT', '0')[0...7]
build_number = [pr_prefix, commit_short_hash].compact.join('-')

gym(
scheme: 'WooCommerce Alpha',
configuration: 'Release-Alpha',
workspace: WORKSPACE_PATH,
export_method: 'enterprise',
clean: true,
# Note that we don't want to override the `VERSION_SHORT` (with `PR #nn` or something) because that's the `.marketingVersion` and is used in API calls
# so we need to keep it unchanged; we still update the `VERSION_LONG` (build number) to make it easy to associate it with the right PR and commit in Firebase.
xcargs: { BUILD_CODE_KEY => build_number }.compact,
output_directory: ARTIFACTS_FOLDER,
output_name: PROTOTYPE_BUILD_IPA_NAME,
export_team_id: get_required_env('INT_EXPORT_TEAM_ID'),
export_options: {
**COMMON_EXPORT_OPTIONS,
method: 'enterprise',
iCloudContainerEnvironment: 'Production'
}
)
end

#####################################################################################
# upload_prototype_build
# -----------------------------------------------------------------------------------
# This lane uploads a prototype build to Firebase App Distribution
# -----------------------------------------------------------------------------------
# Usage:
# bundle exec fastlane upload_prototype_build
#
# Example:
# bundle exec fastlane upload_prototype_build
#####################################################################################
desc 'Uploads a prototype build to Firebase App Distribution'
lane :upload_prototype_build do
ensure_sentry_installed

release_notes = <<~NOTES
Branch: `#{ENV.fetch('BUILDKITE_BRANCH', 'N/A')}`
Expand All @@ -787,6 +834,7 @@ platform :ios do

firebase_app_distribution(
app: FIREBASE_APP_ID,
ipa_path: File.join(ARTIFACTS_FOLDER, "#{PROTOTYPE_BUILD_IPA_NAME}.ipa"),
service_credentials_json_data: get_required_env('FIREBASE_APP_DISTRIBUTION_ACCOUNT_KEY'),
release_notes: release_notes,
groups: FIREBASE_TESTERS_GROUP
Expand All @@ -796,7 +844,7 @@ platform :ios do
auth_token: get_required_env('SENTRY_AUTH_TOKEN'),
org_slug: 'a8c',
project_slug: 'woocommerce-ios',
dsym_path: './build/WooCommerce.app.dSYM.zip'
dsym_path: File.join(ARTIFACTS_FOLDER, "#{PROTOTYPE_BUILD_IPA_NAME}.app.dSYM.zip")
)

next if pull_request_number.nil?
Expand All @@ -811,33 +859,6 @@ platform :ios do
)
end

desc 'Builds a prototype build (Enterprise build)'
lane :build_for_prototype_build do |fetch_code_signing: true|
update_certs_and_profiles_enterprise if fetch_code_signing

pr_prefix = pull_request_number&.then { |num| "pr#{num}" }
commit_short_hash = ENV.fetch('BUILDKITE_COMMIT', '0')[0...7]
build_number = [pr_prefix, commit_short_hash].compact.join('-')

gym(
scheme: 'WooCommerce Alpha',
configuration: 'Release-Alpha',
workspace: WORKSPACE_PATH,
export_method: 'enterprise',
clean: true,
# Note that we don't want to override the `VERSION_SHORT` (with `PR #nn` or something) because that's the `.marketingVersion` and is used in API calls
# so we need to keep it unchanged; we still update the `VERSION_LONG` (build number) to make it easy to associate it with the right PR and commit in Firebase.
xcargs: { BUILD_CODE_KEY => build_number }.compact,
output_directory: 'build',
export_team_id: get_required_env('INT_EXPORT_TEAM_ID'),
export_options: {
**COMMON_EXPORT_OPTIONS,
method: 'enterprise',
iCloudContainerEnvironment: 'Production'
}
)
end

desc 'Build for Testing'
lane :build_for_testing do |device: nil, ios_version: nil| # with nil, Fastlane will find the first best compatible match
xcversion # Ensure we're using the right version of Xcode, defined in `.xcode-version` file
Expand Down