Revision control

Copy as Markdown

---
format_version: '8'
project_type: ios
trigger_map:
- push_branch: main
pipeline: pipeline_build_and_run_tests_focus
- push_branch: releases_v122
pipeline: pipeline_build_and_run_tests_focus
- pull_request_target_branch: main
pipeline: pipeline_build_and_run_tests_focus
- pull_request_target_branch: releases_v*
pipeline: pipeline_build_and_run_tests_focus
- pull_request_source_branch: "*"
pipeline: pipeline_build_and_run_tests_focus
- tag: "*"
workflow: focus_release
pipelines:
pipeline_build_and_run_tests_focus:
stages:
- stage_1_focus: {}
- stage_2_focus: {}
stages:
stage_1_focus:
workflows:
- configure_build_focus: {}
stage_2_focus:
workflows:
- focus_ui_test: {}
- klar_unit_test: {}
- focus_unit_test: {}
workflows:
configure_build_focus:
before_run:
- focus-clone-and-build-dependencies
steps:
- cache-pull@2: {}
- swiftlint-extended@1:
inputs:
- linting_path: "$BITRISE_SOURCE_DIR"
- script@1:
title: Set Default Web Browser Entitlement
inputs:
- content: |-
#!/usr/bin/env bash
set -x
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" Focus.entitlements
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" Klar.entitlements
- script@1.1:
title: Build for Testing Focus
inputs:
- content: |
set -euxo pipefail
echo "-- build-for-testing --"
mkdir DerivedData
#xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile
xcodebuild "-project" "/Users/vagrant/git/focus-ios/Blockzilla.xcodeproj" "-scheme" "Focus" -configuration "FocusDebug" "CODE_SIGNING_ALLOWED=NO" "-destination" "platform=iOS Simulator,name=iPhone 15,OS=17.2" "COMPILER_INDEX_STORE_ENABLE=NO" "build-for-testing" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO" -derivedDataPath "/Users/vagrant/git/DerivedData" | xcpretty | tee xcodebuild_test.log
- script@1.1:
title: Build for Testing Klar
inputs:
- content: |
set -euxo pipefail
echo "-- build-for-testing --"
xcodebuild "-project" "/Users/vagrant/git/focus-ios/Blockzilla.xcodeproj" "-scheme" "Klar" -configuration "KlarDebug" "CODE_SIGNING_ALLOWED=NO" "-destination" "platform=iOS Simulator,name=iPhone 15,OS=17.2" "COMPILER_INDEX_STORE_ENABLE=NO" "build-for-testing" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO" -derivedDataPath "/Users/vagrant/git/DerivedData" | xcpretty | tee xcodebuild_test.log
- script@1.1:
title: Compress Derived Data
is_always_run: true
inputs:
- content: |
set -euxo pipefail
echo "-- compress --"
# Add FocusDebug-iphonesimulator folder
# Add All .xctestrun files
# Add focuos-ios-test files and test plans
# Add KlarDebug-iphonesimulator folder
exec zip -0 -qr "${BITRISE_SOURCE_DIR}/DerivedData.zip" \
"${BITRISE_SOURCE_DIR}/focus-ios/Blockzilla.xcodeproj" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/FocusDebug-iphonesimulator/" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/KlarDebug-iphonesimulator/" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/" \
"$BITRISE_SOURCE_DIR/focus-ios/focus-ios-tests/" \
"$BITRISE_SOURCE_DIR/focus-ios/xcodebuild.log" \
"$BITRISE_SOURCE_DIR/focus-ios/Blockzilla/"
- deploy-to-bitrise-io@2:
inputs:
- deploy_path: "${BITRISE_SOURCE_DIR}/DerivedData.zip"
- slack@3:
run_if: ".IsBuildFailed"
inputs:
- channel: "#mobile-alerts-ios"
- message: "The build failed to build"
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
focus_ui_test:
before_run:
- focus-pull-and-unzip-dependencies
steps:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# Check if it is a scheduled or regular build
# to select the testPlan to run
if [[ $BITRISE_GIT_MESSAGE == Schedule* ]]
then
echo "Scheduled build, running Full Functional Tests"
envman add --key TEST_PLAN_NAME --value FullFunctionalTests
else
echo "Regular build, running Smoke Test"
envman add --key TEST_PLAN_NAME --value SmokeTest
fi
- title: Check if build is scheduled or regular to set the test plan
- script@1.1:
title: Test without Building
inputs:
- content: |
#!/usr/bin/env bash
set -ex
ls ./Users/vagrant/git/focus-ios/focus-ios-tests/XCUITest/
ls ./Users/vagrant/git/DerivedData/Build/Products
cp -r ./Users/vagrant/git/focus-ios/focus-ios-tests/XCUITest/* .
mv ./Users/vagrant/git/* .
ls -la
echo "-- test-without-building --"
xcodebuild -resultBundlePath "xcodebuild.xcresult" -derivedDataPath "/Users/vagrant/git/DerivedData" -destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" test-without-building -xctestrun "/Users/vagrant/git/DerivedData/Build/Products/Focus_SmokeTest_iphonesimulator17.2-arm64.xctestrun"
- custom-test-results-export@0:
inputs:
- search_pattern: "$BITRISE_SOURCE_DIR/xcodebuild.xcresult"
- test_name: SmokeTest
- deploy-to-bitrise-io@2: {}
- github-status@2:
inputs:
- status_identifier: "Focus-build"
- slack@3:
run_if: ".IsBuildFailed"
inputs:
- channel: "#mobile-alerts-ios"
- message: "The build run the Focus testPlan: $TEST_PLAN_NAME"
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
klar_unit_test:
before_run:
- focus-pull-and-unzip-dependencies
steps:
- script@1.1:
title: Test without Building
inputs:
- content: |
#!/usr/bin/env bash
set -ex
ls ./Users/vagrant/git/focus-ios/Blockzilla.xcodeproj/
cp -r ./Users/vagrant/git/focus-ios/Blockzilla.xcodeproj/* .
mv ./Users/vagrant/git/* .
ls -la
echo "-- test-without-building --"
xcodebuild -resultBundlePath "xcodebuild.xcresult" -derivedDataPath "/Users/vagrant/git/DerivedData" -destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" test-without-building -xctestrun "/Users/vagrant/git/DerivedData/Build/Products/Klar_UnitTests_iphonesimulator17.2-arm64.xctestrun"
- custom-test-results-export@0:
inputs:
- search_pattern: "$BITRISE_SOURCE_DIR/xcodebuild.xcresult"
- test_name: UnitTestsKlar
- deploy-to-bitrise-io@2: {}
- slack@3:
run_if: ".IsBuildFailed"
inputs:
- channel: "#mobile-alerts-ios"
- message: "The build run the Klar testPlan: UnitTests"
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
focus_unit_test:
before_run:
- focus-pull-and-unzip-dependencies
steps:
- script@1.1:
title: Test without Building
inputs:
- content: |
#!/usr/bin/env bash
set -ex
ls ./Users/vagrant/git/focus-ios/Blockzilla.xcodeproj/
cp -r ./Users/vagrant/git/focus-ios/Blockzilla.xcodeproj/* .
mv ./Users/vagrant/git/* .
ls -la
echo "-- test-without-building --"
xcodebuild -resultBundlePath "xcodebuild.xcresult" -derivedDataPath "/Users/vagrant/git/DerivedData" -destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" test-without-building -xctestrun "/Users/vagrant/git/DerivedData/Build/Products/Focus_UnitTests_iphonesimulator17.2-arm64.xctestrun"
- custom-test-results-export@0:
inputs:
- search_pattern: "$BITRISE_SOURCE_DIR/xcodebuild.xcresult"
- test_name: UnitTests
- deploy-to-bitrise-io@2: {}
- slack@3:
run_if: ".IsBuildFailed"
inputs:
- channel: "#mobile-alerts-ios"
- message: "The build run the Focus testPlan: UnitTests"
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
# FOCUS UTILITIES WORKFLOWS
focus-clone-and-build-dependencies:
description: Clones the repo and builds dependencies
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6.2: {}
- certificate-and-profile-installer@1: {}
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
./checkout.sh
title: ContentBlockerGen
focus-pull-and-unzip-dependencies:
description: Pulls and unzip the dependencis from previous stage_1_focus
steps:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_1_focus.*
- script@1.1:
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
echo "-- unzip -- "
exec unzip "${BITRISE_ARTIFACT_PATHS}"
echo "show dir"
ls
focus-set-project-version:
steps:
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: focus-ios/Blockzilla/Info.plist
title: Set Blockzilla version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: focus-ios/ContentBlocker/Info.plist
title: Set ContentBlocker version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: focus-ios/FocusIntentExtension/Info.plist
title: Set FocusIntentExtension version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: focus-ios/OpenInFocus/Info.plist
title: Set OpenInFocus version numbers
focus-configure-nimbus:
steps:
- script@1:
title: Configure Nimbus
inputs:
- content: |-
#!/usr/bin/env bash
set -x
/usr/libexec/PlistBuddy -c "Add :NimbusServerURL string ${NIMBUS_URL}" focus-ios/Blockzilla/Info.plist
/usr/libexec/PlistBuddy -c "Add :NimbusStagingServerURL string ${NIMBUS_STAGING_SERVER_URL}" focus-ios/Blockzilla/Info.plist
/usr/libexec/PlistBuddy -c "Set :NimbusAppName ${NIMBUS_APP_NAME}" focus-ios/Blockzilla/Info.plist
/usr/libexec/PlistBuddy -c "Set :NimbusAppChannel ${NIMBUS_APP_CHANNEL}" focus-ios/Blockzilla/Info.plist
focus-configure-sentry:
steps:
- script@1:
title: Configure Sentry
inputs:
- content: |-
#!/usr/bin/env bash
set -x
/usr/libexec/PlistBuddy -c "Add :SentryDSN string ${SENTRY_DSN_FOCUS}" focus-ios/Blockzilla/Info.plist
focus-set-default-browser-entitlement:
steps:
- script@1:
title: Set Default Web Browser Entitlement
inputs:
- content: |-
#!/usr/bin/env bash
set -x
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" focus-ios/Focus.entitlements
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" focus-ios/Klar.entitlements
# Update the name change in Taskcluster files
focus_l10n_build:
before_run:
- focus-clone-and-build-dependencies
steps:
- script@1:
title: Set Default Web Browser Entitlement
inputs:
- content: |-
#!/usr/bin/env bash
set -x
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" focus-ios/Focus.entitlements
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" focus-ios/Klar.entitlements
- script@1:
title: Generate screenshots
inputs:
- content: |-
#!/usr/bin/env bash
set -x
# workaround until 2.187 version is installed. Error with 2.186
./focus-ios/focus-ios-tests/l10n-screenshots.sh en-US
- deploy-to-bitrise-io@1.10:
inputs:
- deploy_path: l10n-screenshots-dd/
- is_compress: 'true'
- deploy-to-bitrise-io@1.10:
inputs:
- deploy_path: l10n-screenshots/en-US/en-US
- is_compress: 'true'
focus_l10n_screenshots_tests:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6.2: {}
- cache-pull@2: {}
- certificate-and-profile-installer@1: {}
- script@1:
title: Set Default Web Browser Entitlement
inputs:
- content: |-
#!/usr/bin/env bash
set -x
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" focus-ios/Focus.entitlements
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" focus-ios/Klar.entitlements
- script@1:
inputs:
- content: >-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo "curl to Download derived data"
curl --location --retry 5 --output l10n-screenshots-dd.zip "$MOZ_DERIVED_DATA_PATH"
mkdir l10n-screenshots-dd
unzip l10n-screenshots-dd.zip -d l10n-screenshots-dd
rm l10n-screenshots-dd.zip
title: Download derived data path
- script@1:
title: Generate screenshots
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# workaround until 2.187 version is installed. Error with 2.186
./focus-ios/focus-ios-tests/l10n-screenshots.sh --test-without-building $MOZ_LOCALES
mkdir -p artifacts
for locale in $(echo $MOZ_LOCALES); do
# Only Focus for now
zip -9 -j "$locale.zip" "l10n-screenshots/$locale/$locale/"*
mv "$locale.zip" artifacts/
done
- deploy-to-bitrise-io@1.10:
inputs:
- deploy_path: artifacts/
# FOCUS RELEASE WORKFLOWS
focus_SPM_Beta:
before_run:
- focus-clone-and-build-dependencies
- focus-set-default-browser-entitlement
- focus-configure-nimbus
- focus-configure-sentry
steps:
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: focus-ios/Blockzilla/Info.plist
title: Set Blockzilla version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: focus-ios/ContentBlocker/Info.plist
title: Set ContentBlocker version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: focus-ios/FocusIntentExtension/Info.plist
title: Set FocusIntentExtension version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: focus-ios/OpenInFocus/Info.plist
title: Set OpenInFocus version numbers
- certificate-and-profile-installer@1: {}
- xcode-archive@3:
inputs:
- project_path: focus-ios/Blockzilla.xcodeproj
- scheme: Focus
- team_id: 43AQ936H96
- export_method: app-store
title: Build Focus
- deploy-to-itunesconnect-application-loader@1:
inputs:
- connection: 'off'
- app_password: "$APPLE_ACCOUNT_PW"
- itunescon_user: "$APPLE_ACCOUNT_ID"
- script@1:
title: Upload Focus Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
focus-ios/focus-ios-tests/tools/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FOCUS" upload-dif \
--org mozilla --project focus-ios "$BITRISE_DSYM_DIR_PATH"
- xcode-archive@3:
inputs:
- project_path: focus-ios/Blockzilla.xcodeproj
- scheme: Klar
- export_method: app-store
title: Build Klar
- deploy-to-itunesconnect-application-loader@1:
inputs:
- connection: 'off'
- app_password: "$APPLE_ACCOUNT_PW"
- itunescon_user: "$APPLE_ACCOUNT_ID"
- script@1:
title: Upload Klar Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
focus-ios/focus-ios-tests/tools/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FOCUS" upload-dif \
--org mozilla --project klar-ios "$BITRISE_DSYM_DIR_PATH"
focus_SPM_Nightly:
before_run:
- focus-clone-and-build-dependencies
- focus-set-default-browser-entitlement
- focus-configure-nimbus
- focus-configure-sentry
steps:
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: focus-ios/Blockzilla/Info.plist
title: Set Blockzilla version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: focus-ios/ContentBlocker/Info.plist
title: Set ContentBlocker version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: focus-ios/FocusIntentExtension/Info.plist
title: Set FocusIntentExtension version numbers
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: focus-ios/OpenInFocus/Info.plist
title: Set OpenInFocus version numbers
- certificate-and-profile-installer@1: {}
- xcode-archive@3:
inputs:
- project_path: focus-ios/Blockzilla.xcodeproj
- scheme: Focus
- team_id: 43AQ936H96
- export_method: app-store
title: Build Focus
- deploy-to-itunesconnect-application-loader@1:
inputs:
- connection: 'off'
- app_password: "$APPLE_ACCOUNT_PW"
- itunescon_user: "$APPLE_ACCOUNT_ID"
- script@1:
title: Upload Focus Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
focus-ios/focus-ios-tests/tools/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FOCUS" upload-dif \
--org mozilla --project focus-ios "$BITRISE_DSYM_DIR_PATH"
- xcode-archive@3:
inputs:
- project_path: focus-ios/Blockzilla.xcodeproj
- scheme: Klar
- export_method: app-store
title: Build Klar
- deploy-to-itunesconnect-application-loader@1:
inputs:
- connection: 'off'
- app_password: "$APPLE_ACCOUNT_PW"
- itunescon_user: "$APPLE_ACCOUNT_ID"
- script@1:
title: Upload Klar Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
focus-ios/focus-ios-tests/tools/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FOCUS" upload-dif \
--org mozilla --project klar-ios "$BITRISE_DSYM_DIR_PATH"
focus_release:
before_run:
- focus-clone-and-build-dependencies
- focus-set-project-version
- focus-set-default-browser-entitlement
- focus-configure-nimbus
- focus-configure-sentry
steps:
- certificate-and-profile-installer@1: {}
- xcode-archive@3:
inputs:
- project_path: focus-ios/Blockzilla.xcodeproj
- scheme: Focus
- team_id: 43AQ936H96
- export_method: app-store
title: Build Focus
- deploy-to-itunesconnect-application-loader@1:
inputs:
- connection: 'off'
- app_password: "$APPLE_ACCOUNT_PW"
- itunescon_user: "$APPLE_ACCOUNT_ID"
- script@1:
title: Upload Focus Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
focus-ios/focus-ios-tests/tools/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FOCUS" upload-dif \
--org mozilla --project focus-ios "$BITRISE_DSYM_DIR_PATH"
- xcode-archive@3:
inputs:
- project_path: focus-ios/Blockzilla.xcodeproj
- scheme: Klar
- export_method: app-store
title: Build Klar
- deploy-to-itunesconnect-application-loader@1:
inputs:
- connection: 'off'
- app_password: "$APPLE_ACCOUNT_PW"
- itunescon_user: "$APPLE_ACCOUNT_ID"
- script@1:
title: Upload Klar Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
focus-ios/focus-ios-tests/tools/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FOCUS" upload-dif \
--org mozilla --project klar-ios "$BITRISE_DSYM_DIR_PATH"
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: focus-ios/Blockzilla.xcodeproj
- opts:
is_expand: false
BITRISE_EXPORT_METHOD: app-store
- opts:
is_expand: false
BITRISE_NIGHTLY_VERSION: '9001'
- opts:
is_expand: false
BITRISE_RELEASE_VERSION: '123.0'
- opts:
is_expand: false
BITRISE_BETA_VERSION: '123.0'
meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core