Revision control

Copy as Markdown

format_version: '8'
project_type: ios
pipelines:
pipeline_build_and_test:
stages:
- pre_configuration: {}
- build_applications: {}
- run_tests: {}
stages:
pre_configuration:
workflows:
- determine_apps_affected: {}
build_applications:
workflows:
- firefox_configure_build:
run_if: '{{getenv "BUILD_FIREFOX_IOS" | eq "true"}}'
- focus_configure_build:
run_if: '{{getenv "BUILD_FOCUS_IOS" | eq "true"}}'
run_tests:
workflows:
- build_and_test_1_SmokeTest1:
run_if: '{{getenv "BUILD_FIREFOX_IOS" | eq "true"}}'
- build_and_test_2_SmokeTest2:
run_if: '{{getenv "BUILD_FIREFOX_IOS" | eq "true"}}'
- build_and_test_3_SmokeTest3:
run_if: '{{getenv "BUILD_FIREFOX_IOS" | eq "true"}}'
- build_and_test_4_SmokeTest4:
run_if: '{{getenv "BUILD_FIREFOX_IOS" | eq "true"}}'
- focus_ui_test:
run_if: '{{getenv "BUILD_FOCUS_IOS" | eq "true"}}'
- focus_unit_test:
run_if: '{{getenv "BUILD_FOCUS_IOS" | eq "true"}}'
- klar_unit_test:
run_if: '{{getenv "BUILD_FOCUS_IOS" | eq "true"}}'
workflows:
firefox_configure_build:
before_run:
- 0_detect_standalone_build
- 1_git_clone_and_post_clone
- 2_certificate_and_profile
- 3_provisioning_and_npm_installation
- decision_to_run_UI_Tests
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- restore-spm-cache@1:
is_always_run: true
title: Bitrise Test Plan Sharder
inputs:
- xcode_project: Client.xcodeproj
- target: Client
- shards: '4'
- scheme: Fennec
- debug_mode: 'true'
- test_path: ''
- file_type: ".swift"
- script@1.1:
title: Build for Testing
inputs:
- content: |
set -euxo pipefail
echo "-- build-for-testing --"
mkdir DerivedData
xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile
xcodebuild "-project" "/Users/vagrant/git/firefox-ios/Client.xcodeproj" "-scheme" "Fennec" -configuration "Fennec" "CODE_SIGNING_ALLOWED=NO" -sdk "iphonesimulator" "-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_fennec.log
ls /Users/vagrant/git/DerivedData/Build/Products
ls /Users/vagrant/git/DerivedData
- xcode-test-without-building@0:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
timeout: 600
inputs:
- destination: platform=iOS Simulator,name=iPhone 15,OS=17.2
- xcodebuild_options: '"COMPILER_INDEX_STORE_ENABLE=NO"
"CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
- xctestrun: "/Users/vagrant/git/DerivedData/Build/Products/Fennec_UnitTest_iphonesimulator17.2-arm64.xctestrun"
- maximum_test_repetitions: 2
- save-spm-cache@1:
is_always_run: true
- script@1.1:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
title: Compress Derived Data
is_always_run: true
inputs:
- content: |
set -euxo pipefail
ls /Users/vagrant/git/DerivedData
ls /Users/vagrant/git/DerivedData/Build/Products
echo "-- compress --"
# Add Fennec-iphonesimulator folder
# Add All .xctestrun files
# Add firefox-ios-test files and test plans
exec zip -0 -qr "${BITRISE_SOURCE_DIR}/DerivedData.zip" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/" \
"$BITRISE_SOURCE_DIR/DerivedData/Build/Products/Fennec-iphonesimulator/" \
"$BITRISE_SOURCE_DIR/firefox-ios/Client.xcodeproj" \
"$BITRISE_SOURCE_DIR/firefox-ios/firefox-ios-tests/" \
"$BITRISE_SOURCE_DIR/firefox-ios/Client/" \
"$BITRISE_SOURCE_DIR/xcodebuild.log"
- deploy-to-bitrise-io@2:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
inputs:
- deploy_path: "${BITRISE_SOURCE_DIR}/DerivedData.zip"
- pipeline_intermediate_files: "$BITRISE_XCRESULT_PATH:BITRISE_XCRESULT_PATH"
- script@1.1:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
title: Run Danger 2
timeout: 180
inputs:
- content: |
#!/usr/bin/env bash
# Fail if any command fails
set -e
echo "Run danger"
swift run danger-swift ci
- cache-push@2.7.1:
is_always_run: true
- script@1.1:
title: Detect number of warnings
is_always_run: true
inputs:
- content: |
set -e
set -x
echo "bitrise_xcode"
COUNT_XCUI=$(./test-fixtures/generate-metrics.sh /Users/vagrant/git/xcodebuild_fennec.log all)
envman add --key SHOW_WARNING_IN_SLACK --value Show_Warnings
envman add --key SHOW_WARNING_COUNT_XCUI --value "$COUNT_XCUI"
STR=$COUNT_XCUI
SUB='greater'
if [[ "$STR" == *"$SUB"* ]]; then
echo "Failure, the number of warnings increased"
exit 1
fi
- slack@3.1:
is_always_run: true
inputs:
- title: ''
- author_name: ''
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
- footer: Created by Mobile Test Engineering
- pretext_on_error: "*Firefox-iOS* :firefox: *Build/XCUITests* :x:"
- pretext: "*Firefox-iOS* :firefox: *Build/XCUITests* :white_check_mark:"
- timestamp: 'no'
- fields: |
Task | ${BITRISE_BUILD_URL}
Owner | ${GIT_CLONE_COMMIT_AUTHOR_NAME}
Commit | ${GIT_CLONE_COMMIT_MESSAGE_SUBJECT}
Source-Workflow | ${BITRISE_TRIGGERED_WORKFLOW_TITLE}
Branch | ${BITRISE_GIT_BRANCH}
Warnings-in-code-test | ${SHOW_WARNING_COUNT_XCUI}
- buttons: |
App|${BITRISE_APP_URL}
- slack@3.1:
is_always_run: true
run_if: '{{getenv "NEW_RC_VERSION" | eq "New_RC_Version" | and .IsBuildFailed}}'
inputs:
- channel: "#firefox-ios"
- text: Build status using latest Rust-Component
- webhook_url: $WEBHOOK_SLACK_TOKEN_2
build_and_test_1_SmokeTest1:
envs:
- opts:
is_expand: false
SHARD: '1'
after_run:
- _build_and_test
build_and_test_2_SmokeTest2:
envs:
- opts:
is_expand: false
SHARD: '2'
after_run:
- _build_and_test
build_and_test_3_SmokeTest3:
envs:
- opts:
is_expand: false
SHARD: '3'
after_run:
- _build_and_test
build_and_test_4_SmokeTest4:
envs:
- opts:
is_expand: false
SHARD: '4'
after_run:
- _build_and_test
_build_and_test:
before_run:
- 0_detect_standalone_build
- 1_git_clone_and_post_clone
- decision_to_run_UI_Tests
- firefox_pull_and_unzip_dependencies
steps:
- xcode-test-without-building@0:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
timeout: 1200
inputs:
- destination: platform=iOS Simulator,name=iPhone 15,OS=17.2
- xcodebuild_options: '"-derivedDataPath" "/Users/vagrant/git/DerivedData"
"COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY="
"CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
- xctestrun: "Users/vagrant/git/DerivedData/Build/Products/Fennec_Smoketest${SHARD}_iphonesimulator17.2-arm64.xctestrun"
- deploy-to-bitrise-io@2.1.1:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
inputs:
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_${SHARD}_XCRESULT_PATH'
determine_apps_affected:
steps:
- git-clone@6.2: {}
- script@1:
title: Determine which application to base configuration
inputs:
- content: |-
#!/usr/bin/env bash
set -e
# Determine which application to base configuration while comparing against branch destination:
#
# BITRISEIO_GIT_BRANCH_DEST is used only on pull requests and is set to destination/branch (i.e, release/v123 )
# BITRISE_GIT_BRANCH is the git branch that is built by Bitrise (i.e, release/v123 )
# BITRISE_GIT_COMMIT is the git commit hash that is built by Bitrise
#
# If the destination branch is a release or epic branch, we need to compare changes against that destination branch
# If the branch built by Bitrise is a release or epic branch, we need to compare changes against that branch
# Otherwise, we need to compare changes against origin/main
if [[ $BITRISEIO_GIT_BRANCH_DEST = release* ]] || [[ $BITRISEIO_GIT_BRANCH_DEST = epic* ]]; then
BASE_BRANCH="$BITRISEIO_GIT_BRANCH_DEST"
echo $BASE_BRANCH
elif [[ $BITRISE_GIT_BRANCH = release* ]] || [[ $BITRISE_GIT_BRANCH = epic* ]]; then
BASE_BRANCH="$BITRISE_GIT_BRANCH"
echo $BASE_BRANCH
else
BASE_BRANCH="origin/main"
echo $BASE_BRANCH
fi
# Determine apps affected by the changes introduced in the commit/PR
APPS_AFFECTED=$(git diff --name-only $BASE_BRANCH..."$BITRISE_GIT_COMMIT" | xargs -n1 dirname | sort | uniq)
echo "These are the files changed:"
echo $APPS_AFFECTED
# Initialize all application flags as "false" by default
BUILD_FIREFOX_IOS="false"
BUILD_FOCUS_IOS="false"
BUILD_SAMPLE_BROWSER_IOS="false"
# Manual triggers leave empty commits.
# Check for empty commit/PR and exit blacklist check if found to avoid erroring out.
echo "Files changed in commit/PR: $APPS_AFFECTED"
if [[ -z "$APPS_AFFECTED" ]]; then
echo "No files changed in commit/PR. Skipping Blacklist check..."
# Set environment variables
envman add --key BUILD_FIREFOX_IOS --value "true"
envman add --key BUILD_FOCUS_IOS --value "true"
exit 0
fi
# Skip building on only markdown and/or LICENSE file changes
TOTAL_CHANGED_FILES_COUNT=$(git diff --name-only $BASE_BRANCH..."$BITRISE_GIT_COMMIT" | wc -l | xargs)
MD_AND_LICENSE_FILE_COUNT=$(git diff --name-only $BASE_BRANCH..."$BITRISE_GIT_COMMIT" | grep -Eci '(\.md$|^LICENSE$)' | xargs)
if [ "$TOTAL_CHANGED_FILES_COUNT" -eq "$MD_AND_LICENSE_FILE_COUNT" ] && [ "$MD_AND_LICENSE_FILE_COUNT" -ne 0 ]; then
echo "Only Markdown and/or LICENSE files have been changed. No build will be triggered."
exit 0
fi
# Check for specific applications and set flags accordingly
# Add more specific conditions for directories as needed; otherwise see default case
# Pattern matches (*) on directory names and reacts to subdirectory changes as well
for app in $APPS_AFFECTED; do
# Check for root directory changes
if [[ "$app" == "." ]]; then
CHANGED_FILES=$(git diff --name-only $BASE_BRANCH..."$BITRISE_GIT_COMMIT")
echo "Project root changes detected: $CHANGED_FILES"
ROOT_SPECIFIC_FILES=$(echo "$CHANGED_FILES" | grep -E '^(bootstrap\.sh|content_blocker_update\.sh|Dangerfile|Dangerfile\.swift|Info\.plist|iOSNimbusFeatureUtility\.sh|package\.lock|Package\.json|Package\.resolved|Package\.swift|rust_components_local\.sh|setup_build_tools\.sh|update_version\.sh|\.swiftlint\.yml)$' || true)
echo "Root specific files: $ROOT_SPECIFIC_FILES"
if [ ! -z "$ROOT_SPECIFIC_FILES" ]; then
BUILD_FIREFOX_IOS="true"
fi
fi
case "$app" in
firefox-ios*)
BUILD_FIREFOX_IOS="true"
;;
focus-ios*)
BUILD_FOCUS_IOS="true"
;;
SampleBrowser*)
BUILD_SAMPLE_BROWSER_IOS="true"
;;
BrowserKit*|taskcluster*|test-fixtures*)
# Explicity directory changes - build all applications
BUILD_FIREFOX_IOS="true"
BUILD_FOCUS_IOS="true"
;;
".")
# Root directory changes - build all applications
BUILD_FIREFOX_IOS="true"
BUILD_FOCUS_IOS="true"
BUILD_SAMPLE_BROWSER_IOS="true"
;;
*)
# Default case - build all applications (e.g, BrowserKit)
BUILD_FIREFOX_IOS="true"
BUILD_FOCUS_IOS="true"
BUILD_SAMPLE_BROWSER_IOS="true"
;;
esac
done
# Set environment variables
envman add --key BUILD_FIREFOX_IOS --value "$BUILD_FIREFOX_IOS"
envman add --key BUILD_FOCUS_IOS --value "$BUILD_FOCUS_IOS"
envman add --key BUILD_SAMPLE_BROWSER_IOS --value "$BUILD_SAMPLE_BROWSER_IOS"
- share-pipeline-variable@1:
title: Share which application(s) to base configuration off of
inputs:
- variables: |-
BUILD_FIREFOX_IOS
BUILD_FOCUS_IOS
BUILD_SAMPLE_BROWSER_IOS
- script@1:
title: Echo applications set
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
echo "BUILD_FIREFOX_IOS: $BUILD_FIREFOX_IOS"
echo "BUILD_FOCUS_IOS: $BUILD_FOCUS_IOS"
echo "BUILD_SAMPLE_BROWSER_IOS: $BUILD_SAMPLE_BROWSER_IOS"
firefox_pull_and_unzip_dependencies:
steps:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: build_applications.firefox_configure_build
- script@1.1:
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
derived_data=${BITRISE_ARTIFACT_PATHS##*|}
echo "$derived_data"
echo "-- unzip -- "
exec unzip "$derived_data"
send_slack_notification:
steps:
- slack@3.1:
inputs:
- title: ''
- author_name: ''
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
- footer: Created by Mobile Test Engineering
- pretext_on_error: "*Firefox-iOS* :firefox: *Build/XCUITests* :x:"
- pretext: "*Firefox-iOS* :firefox: *Build/XCUITests* :white_check_mark:"
- timestamp: 'no'
- fields: |
Task | ${BITRISE_BUILD_URL}
Owner | ${GIT_CLONE_COMMIT_AUTHOR_NAME}
Commit | ${GIT_CLONE_COMMIT_MESSAGE_SUBJECT}
Source-Workflow | ${BITRISE_TRIGGERED_WORKFLOW_TITLE}
Branch | ${BITRISE_GIT_BRANCH}
Warnings-in-code | ${SHOW_WARNING_COUNT}
Warnings-in-code-test | ${SHOW_WARNING_COUNT_XCUI}
- buttons: |
App|${BITRISE_APP_URL}
0_detect_standalone_build:
steps:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
# ANSI color codes
RED='\033[31;1m'
CYAN='\033[36;1m'
GREEN='\033[32;1m'
NC='\033[0m' # No Color (resets color to default)
# Check if $BITRISEIO_PIPELINE_ID is unset or empty
# If so, this is a standalone build and we need to fail it
if [ -z "$BITRISEIO_PIPELINE_ID" ]; then
printf "\n${RED}Error: BITRISEIO_PIPELINE_ID is not set.${NC}\n\
This means you have triggered a build stage or workflow individually, instead of the entire pipeline.\n\n\
The current build workflow is: ${RED}$BITRISE_TRIGGERED_WORKFLOW_TITLE${NC}, but needs to be run in ${RED}pipeline_build_and_test${NC}.\n\n\
To trigger a pipeline rebuild in its entirety, please do the following:\n\n\
${CYAN}1. Select your last failed build for 'pipeline_build_and_test'.\n\
${CYAN}2. Click the 'Rebuild' button dropdown icon located in the top right of the page.\n\
${CYAN}3. From the dropdown menu, select 'Rebuild entire Pipeline'.\n\
${CYAN}4. If no dropdown menu is present, you are looking at a standalone build\n\
${CYAN}and need to select the initial Github pipeline triggered by the PR.${NC}\n\n\
If you are still having issues, please contact ${GREEN}#mobile-testeng${NC} on Slack.\n"
exit 1 # Exit with a failure status
else
echo "BITRISEIO_PIPELINE_ID is set to $BITRISEIO_PIPELINE_ID"
fi
title: Detect standalone build
1_git_clone_and_post_clone:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6.2: {}
- script@1.1:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
BRANCH=$BITRISE_GIT_BRANCH
if [[ $BRANCH == update-spm-new-rust-component-tag-* ]]
then
echo "Building with new Rust-Component version"
envman add --key NEW_RC_VERSION --value New_RC_Version
fi
title: Save Branch Name
- script@1:
title: Add default web browser entitlement for Fennec
inputs:
- content: |-
#/usr/bin/env bash
set -x
echo "Adding com.apple.developer.web-browser to entitlements"
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.web-browser bool true" firefox-ios/Client/Entitlements/FennecApplication.entitlements
- cache-pull@2.1: {}
2_certificate_and_profile:
steps:
- certificate-and-profile-installer@1: {}
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
cd firefox-ios/Client.xcodeproj
sed -i '' 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = "iPhone Developer"/' project.pbxproj
cd -
title: Set xcodeproj code_sign_identity to iPhone Developer
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8' > /tmp/tmp.xcconfig
echo 'EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))' >> /tmp/tmp.xcconfig
echo 'IPHONEOS_DEPLOYMENT_TARGET=11.4' >> /tmp/tmp.xcconfig
echo 'SWIFT_TREAT_WARNINGS_AS_ERRORS=NO' >> /tmp/tmp.xcconfig
echo 'GCC_TREAT_WARNINGS_AS_ERRORS=NO' >> /tmp/tmp.xcconfig
export XCODE_XCCONFIG_FILE=/tmp/tmp.xcconfig
envman add --key XCODE_XCCONFIG_FILE --value /tmp/tmp.xcconfig
title: Workaround carthage lipo
- script@1.1:
title: Bypass Bitrise Mirror for Swiftlint Upgrade
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
echo "Swiftlint version before mirror swap"
swiftlint version
cd "$(brew --repository)/Library/Taps/homebrew/homebrew-core"
# Bypass Bitrise mirror that lags 1 week to 1 month behind homebrew-core versions
brew upgrade swiftlint
echo "Swiftlint version after mirror swap"
swiftlint version
- script@1:
inputs:
- content: |-
./bootstrap.sh
title: Run bootstrap
- swiftlint-extended@1:
inputs:
- linting_path: "$BITRISE_SOURCE_DIR"
- deploy-to-bitrise-io@2.2: {}
- script@1:
inputs:
- content: |-
set -e
echo "$SWIFTLINT_REPORT"
if [ ! -z "$SWIFTLINT_REPORT" ] ;then
# The file is not-empty.
echo "Failing build since there are swiftlint errors"
exit 1
fi
title: Fail build if swiftlint fails
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
rm /tmp/tmp.xcconfig
envman add --key XCODE_XCCONFIG_FILE --value ''
title: Remove carthage lipo workaround
3_provisioning_and_npm_installation:
steps:
- script@1.1:
title: NPM install and build
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
set -x
npm install
npm run build
Detect_warnings:
steps:
- script@1.1:
title: Detect number of warnings
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
TEST_LOG_PATH=$BITRISE_XCODEBUILD_TEST_LOG_PATH
COUNT_XCUI=$(./test-fixtures/generate-metrics.sh $TEST_LOG_PATH all)
envman add --key SHOW_WARNING_COUNT_XCUI --value "$COUNT_XCUI"
envman add --key SHOW_WARNING_IN_SLACK --value Show_Warnings
STR=$COUNT_XCUI
SUB='greater'
if [[ "$STR" == *"$SUB"* ]]; then
echo "Failure, the number of warnings increased"
exit 1
fi
is_always_run: true
decision_to_run_UI_Tests:
steps:
- script@1:
title: Files changed in commit
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
# We need to check both PRs and MERGEs for release and epic branches so an error isn't
# created when trying to find a diff on a commit that doesn't exist on origin/main
# First check destination branch for PRs and then check $BITRISE_GIT_BRANCH for
# merges to origin/main since the destination branch changes back to origin/main
if [[ $BITRISEIO_GIT_BRANCH_DEST = release* ]] || [[ $BITRISEIO_GIT_BRANCH_DEST = epic* ]]; then
FILES_CHANGED=$(git diff --name-only $BITRISEIO_GIT_BRANCH_DEST..."$BITRISE_GIT_COMMIT")
elif [[ $BITRISE_GIT_BRANCH = release* ]] || [[ $BITRISE_GIT_BRANCH = epic* ]]; then
echo "Skipping Blacklist check for Merging into $BITRISE_GIT_BRANCH..."
exit 0
FILES_CHANGED=$(git diff --name-only $BITRISE_GIT_BRANCH..."$BITRISE_GIT_COMMIT")
else
FILES_CHANGED=$(git diff --name-only origin/main..."$BITRISE_GIT_COMMIT")
fi
# Manual triggers leave empty commits.
# Check for empty commit/PR and exit blacklist check if found to avoid erroring out.
echo "Files changed in commit/PR: $FILES_CHANGED"
if [[ -z "$FILES_CHANGED" ]]; then
echo "No files changed in commit/PR. Skipping Blacklist check..."
envman add --key RUN_UI_TESTS --value Run_UI_Tests
exit 0
fi
# Match on file names in all directories and subdirectories
#
# Project Configs
# .*[^bitrise]\.y[^/]*$ -> matches all files not named bitrise whose file extension begins with a 'y'
# .*\.sh$ -> matches all files whose file extension begins with 'sh'
# .*\.md$ -> matches all files whose file extension begins with 'md'
# .*\.lproj/.* -> matches all files whose parent directory begins with 'lproj'
# fastlane/* -> matches all files in the fastlane directory
# taskcluster/* -> matches all files in the taskcluster directory
#
# Features tested outside bitrise
# Sync*/* -> matches all files in the Sync, SyncTelemetry
# firefox-ios/firefox-ios-tests/Tests/Sync*/* -> matches all files in SyncIntegrationTests directories
# firefox-ios/firefox-ios-tests/Tests/L10nSnapshotTests/* -> matches all files in the L10nSnapshotTests directory
#
# Test Helpers
# test-fixtures/.py$ -> matches all files whose file extension begin with 'py'
DO_NOT_RUN_TESTS='^(.*[^bitrise]\.y[^/]*$|.*\.sh$|.*\.md$|.*\.lproj/.*|Sync*/*|firefox-ios/firefox-ios-tests/Tests/Sync*/*|fastlane/*|taskcluster/*|firefox-ios/firefox-ios-tests/Tests/L10nSnapshotTests/*|test-fixtures/.*.py$)'
# Pass the FILES_CHANGED to grep to find any matches for the regex DO_NOT_RUN_TESTS
# -v inverts the filtered results, returning any files not filtered by the regex
if grep -v -E "${DO_NOT_RUN_TESTS}" <<< "${FILES_CHANGED}" && [ -n "$FILES_CHANGED" ];
then
echo "Running UI Tests"
envman add --key RUN_UI_TESTS --value Run_UI_Tests
else
echo "Not Running UI Tests"
fi
- share-pipeline-variable@1:
inputs:
- variables: RUN_UI_TESTS
NewXcodeVersions:
steps:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
YESTERDAY=`date -v -1d '+%Y-%m-%d'`
brew install jq
resp=$(curl -X GET -s -H 'Accept: application/vnd.github.v3+json' -H "authorization: Bearer ${GITHUB_ACCESS_TOKEN}" https://api.github.com/repos/mozilla-mobile/firefox-ios/commits\?sha\=main\&since\=$YESTERDAY | jq -r '.[].commit.message | select(contains("Auto Update Bitrise.YML"))')
echo $resp
if [ -z "$resp" ]
then
echo "There is not any new commit, stop building"
else
echo "There is a new commit, continue building"
envman add --key NEW_XCODE_VERSION --value New_Version_Found
fi
if [[ $BITRISE_GIT_MESSAGE == BuildAndRun* ]]
then
echo "Scheduled build to run the rest of steps once xcode version has been updated"
envman add --key RUN_ALL_STEPS --value Run_All_Steps
fi
title: Check main branch for recent activity before continuing
- activate-ssh-key@4.0:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6.2: {}
- cache-pull@2.4: {}
- certificate-and-profile-installer@1: {}
- script@1:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8' > /tmp/tmp.xcconfig
echo 'EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))' >> /tmp/tmp.xcconfig
echo 'IPHONEOS_DEPLOYMENT_TARGET=11.4' >> /tmp/tmp.xcconfig
echo 'SWIFT_TREAT_WARNINGS_AS_ERRORS=NO' >> /tmp/tmp.xcconfig
echo 'GCC_TREAT_WARNINGS_AS_ERRORS=NO' >> /tmp/tmp.xcconfig
export XCODE_XCCONFIG_FILE=/tmp/tmp.xcconfig
envman add --key XCODE_XCCONFIG_FILE --value /tmp/tmp.xcconfig
title: Workaround carthage lipo bug
- script@1:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
inputs:
- content: |-
./bootstrap.sh
title: Run bootstrap
- script@1:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
rm /tmp/tmp.xcconfig
envman add --key XCODE_XCCONFIG_FILE --value ''
title: Remove carthage lipo workaround
- script@1:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
cd firefox-ios/Client.xcodeproj
sed -i '' 's/"Fennec Development"/"Bitrise Firefox iOS Dev"/' project.pbxproj
sed -i '' 's/Fennec ShareTo Development/Bitrise Firefox iOS Dev - Share To/' project.pbxproj
sed -i '' 's/Fennec WidgetKit Development/Bitrise Firefox iOS Dev - WidgetKit/' project.pbxproj
sed -i '' 's/"XCUITests"/"Bitrise Firefox iOS Dev - XCUI Tests"/' project.pbxproj
sed -i '' 's/Fennec NotificationService Development/Bitrise Firefox iOS Dev - Notification Service/' project.pbxproj
sed -i '' 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = "iPhone Distribution"/' project.pbxproj
cd -
title: Set provisioning to Bitrise in xcodeproj
- script@1.1:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
title: NPM install and build
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
set -x
npm install
npm run build
- xcode-build-for-simulator@0.12:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
inputs:
- xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
- scheme: Fennec
- simulator_device: iPhone 15
- xcode-test@4.5:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
inputs:
- scheme: Fennec
- destination: platform=iOS Simulator,name=iPhone 15,OS=17.2
- deploy-to-bitrise-io@2.2: {}
- cache-push@2.4: {}
- slack@3.1:
run_if: '{{getenv "NEW_XCODE_VERSION" | eq "New_Version_Found" | or (getenv "RUN_ALL_STEPS" | eq "Run_All_Steps")}}'
inputs:
- channel: "#firefox-ios"
- text: Build status using latest Xcode detected
- message: "The build run info: $BITRISE_GIT_MESSAGE"
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
description: This Workflow is to build the app using latest xcode available in Bitrise
L10nBuild:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6.2: {}
- cache-pull@2.1: {}
- certificate-and-profile-installer@1: {}
- script@1:
inputs:
- content: >-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo
'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64
arm64e armv7 armv7s armv6 armv8' > /tmp/tmp.xcconfig
echo 'EXCLUDED_ARCHS=$(inherited)
$(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))'
>> /tmp/tmp.xcconfig
echo 'IPHONEOS_DEPLOYMENT_TARGET=11.4' >> /tmp/tmp.xcconfig
echo 'SWIFT_TREAT_WARNINGS_AS_ERRORS=NO' >> /tmp/tmp.xcconfig
echo 'GCC_TREAT_WARNINGS_AS_ERRORS=NO' >> /tmp/tmp.xcconfig
export XCODE_XCCONFIG_FILE=/tmp/tmp.xcconfig
envman add --key XCODE_XCCONFIG_FILE --value /tmp/tmp.xcconfig
title: Workaround carthage lipo
- script@1:
inputs:
- content: |-
./bootstrap.sh
title: Run bootstrap
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
rm /tmp/tmp.xcconfig
envman add --key XCODE_XCCONFIG_FILE --value ''
title: Remove carthage lip
- script@1.1:
title: NPM install and build
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
npm install
npm run build
- script@1.1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
gem install fastlane -v 2.219.0
fastlane -version
./firefox-ios/l10n-screenshots.sh en-US
title: Generate screenshots
- 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'
- cache-push@2.3: {}
envs:
- opts:
is_expand: false
BITRISE_SCHEME: L10nSnapshotTest
description: >-
This Workflow is to run L10n tests in one locale and then share the bundle with the rest of the builds
L10nScreenshotsTests:
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
# fail if any commands fails
set -e
# debug log
set -x
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.1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
gem install fastlane -v 2.219.0
fastlane -version
./firefox-ios/l10n-screenshots.sh --test-without-building $MOZ_LOCALES
mkdir -p artifacts
for locale in $(echo $MOZ_LOCALES); do
zip -9 -j "$locale.zip" "l10n-screenshots/$locale/$locale/"*
mv "$locale.zip" artifacts/
done
title: Generate screenshots
- deploy-to-bitrise-io@1.10:
inputs:
- deploy_path: artifacts/
envs:
- opts:
is_expand: false
BITRISE_SCHEME: L10nSnapshotTest
description: >-
This Workflow is to run L10n tests for all locales
SPM_Deploy_Prod_Beta:
steps:
- activate-ssh-key@4.1:
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
set -e
set -x
cd firefox-ios/Client.xcodeproj
sed -i '' 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = "iPhone Distribution"/' project.pbxproj
cd -
title: Set xcodeproj code_sign_identity
- script@1.1:
title: NPM, ContentBlockerGen
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
./bootstrap.sh
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: firefox-ios/Client/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: firefox-ios/Extensions/NotificationService/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: firefox-ios/Extensions/ShareTo/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: firefox-ios/WidgetKit/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_RELEASE_VERSION"
- plist_path: firefox-ios/CredentialProvider/Info.plist
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
echo "Setting Nimbus variables"
/usr/libexec/PlistBuddy -c "Set NimbusURL $NIMBUS_URL" "firefox-ios/Client/Info.plist"
title: Nimbus Variable Setup
- xcode-archive@4.0:
inputs:
- project_path: firefox-ios/Client.xcodeproj
- compile_bitcode: 'no'
- upload_bitcode: 'no'
- team_id: 43AQ936H96
- export_method: app-store
- output_tool: xcodebuild
- distribution_method: app-store
- export_development_team: 43AQ936H96
- configuration: "$BITRISE_SCHEME"
- deploy-to-bitrise-io@2.0: {}
- deploy-to-itunesconnect-application-loader@1.3:
inputs:
- app_password: "$APPLE_ACCOUNT_PW"
- password: "$APPLE_ACCOUNT_PW"
- connection: 'off'
- itunescon_user: "$APPLE_ACCOUNT_ID"
- script@1:
title: Upload Firefox Prod Beta Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
firefox-ios/ThirdParty/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FIREFOX" upload-dif \
--org mozilla --project firefox-ios "$BITRISE_DSYM_DIR_PATH"
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
# sleep 9999
is_always_run: true
title: debug-sleep
- slack@3.2:
inputs:
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
- xcode-archive@4.0:
inputs:
- project_path: firefox-ios/Client.xcodeproj
- compile_bitcode: 'no'
- upload_bitcode: 'no'
- team_id: 43AQ936H96
- export_method: app-store
- output_tool: xcodebuild
- scheme: FirefoxBeta
- export_development_team: 43AQ936H96
- distribution_method: app-store
- configuration: FirefoxBeta
title: 'FirefoxBeta: Xcode Archive & Export for iOS'
- deploy-to-itunesconnect-application-loader@1.3:
inputs:
- app_password: "$APPLE_ACCOUNT_PW"
- connection: 'off'
- itunescon_user: "$APPLE_ACCOUNT_ID"
title: 'FirefoxBeta: Deploy to iTunes Connect'
envs:
- opts:
is_expand: false
BITRISE_SCHEME: Firefox
description: This step is to build, archive and upload Firefox Release and Beta
SPM_Deploy_Beta_Only:
steps:
- activate-ssh-key@4.1:
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
set -e
set -x
cd firefox-ios/Client.xcodeproj
sed -i '' 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = "iPhone Distribution"/' project.pbxproj
cd -
title: Set xcodeproj code_sign_identity
- script@1.1:
title: NPM, ContentBlockerGen
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
./bootstrap.sh
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: firefox-ios/Client/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: firefox-ios/Extensions/NotificationService/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: firefox-ios/Extensions/ShareTo/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: firefox-ios/WidgetKit/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_BETA_VERSION"
- plist_path: firefox-ios/CredentialProvider/Info.plist
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
echo "Setting Nimbus variables"
/usr/libexec/PlistBuddy -c "Set NimbusURL $NIMBUS_URL" "firefox-ios/Client/Info.plist"
title: Nimbus Variable Setup
- xcode-archive@4.0:
inputs:
- project_path: firefox-ios/Client.xcodeproj
- compile_bitcode: 'no'
- upload_bitcode: 'no'
- team_id: 43AQ936H96
- export_method: app-store
- output_tool: xcodebuild
- scheme: FirefoxBeta
- export_development_team: 43AQ936H96
- distribution_method: app-store
- configuration: FirefoxBeta
title: 'FirefoxBeta: Xcode Archive & Export for iOS'
- deploy-to-itunesconnect-application-loader@1.3:
inputs:
- app_password: "$APPLE_ACCOUNT_PW"
- connection: 'off'
- itunescon_user: "$APPLE_ACCOUNT_ID"
title: 'FirefoxBeta: Xcode Archive & Export for iOS'
- script@1:
title: Upload Firefox Beta Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
firefox-ios/ThirdParty/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FIREFOX" upload-dif \
--org mozilla --project firefox-ios "$BITRISE_DSYM_DIR_PATH"
envs:
- opts:
is_expand: false
BITRISE_SCHEME: Firefox
description: This step is to build, archive and upload Firefox Release and Beta
SPM_Nightly_Beta_Only:
steps:
- activate-ssh-key@4.1:
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
set -e
set -x
cd firefox-ios/Client.xcodeproj
sed -i '' 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = "iPhone Distribution"/' project.pbxproj
cd -
title: Set xcodeproj code_sign_identity
- script@1.1:
title: NPM, ContentBlockerGen
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
./bootstrap.sh
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: firefox-ios/Client/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: firefox-ios/Extensions/NotificationService/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: firefox-ios/Extensions/ShareTo/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: firefox-ios/WidgetKit/Info.plist
- set-xcode-build-number@1:
inputs:
- build_short_version_string: "$BITRISE_NIGHTLY_VERSION"
- plist_path: firefox-ios/CredentialProvider/Info.plist
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
echo "Setting Nimbus variables"
/usr/libexec/PlistBuddy -c "Set NimbusURL $NIMBUS_URL" "firefox-ios/Client/Info.plist"
title: Nimbus Variable Setup
- xcode-archive@4.0:
inputs:
- project_path: firefox-ios/Client.xcodeproj
- compile_bitcode: 'no'
- upload_bitcode: 'no'
- team_id: 43AQ936H96
- export_method: app-store
- output_tool: xcodebuild
- scheme: FirefoxBeta
- export_development_team: 43AQ936H96
- distribution_method: app-store
- configuration: FirefoxBeta
title: 'FirefoxBeta: Xcode Archive & Export for iOS'
- deploy-to-bitrise-io@2: {}
- deploy-to-itunesconnect-application-loader@1.3:
inputs:
- app_password: "$APPLE_ACCOUNT_PW"
- connection: 'off'
- itunescon_user: "$APPLE_ACCOUNT_ID"
title: 'Nightly FirefoxBeta: Xcode Archive & Export for iOS'
- script@1:
title: Upload NightlyBeta Symbols
inputs:
- content: |-
#!/usr/bin/env bash
set -x
firefox-ios/ThirdParty/sentry-cli --auth-token "$SENTRY_AUTH_TOKEN_FIREFOX" upload-dif \
--org mozilla --project firefox-ios "$BITRISE_DSYM_DIR_PATH"
envs:
- opts:
is_expand: false
BITRISE_SCHEME: Firefox
description: This step is to build, archive and upload Firefox Release and Beta
Bitrise_Performance_Test:
steps:
- cache-pull@2.1:
is_always_run: true
- xcode-test@4.5:
inputs:
- project_path: firefox-ios/Client.xcodeproj
- scheme: Fennec
- destination: platform=iOS Simulator,name=iPhone 15,OS=17.2
- test_plan: PerformanceTestPlan
- script@1.1:
is_always_run: true
title: Create perfherder data object
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# get dependency
cd ./test-fixtures && git clone https://github.com/isabelrios/xcresult_extract.git
echo $BITRISE_XCRESULT_PATH
ls
ls $BITRISE_XCRESULT_PATH
cp -r $BITRISE_XCRESULT_PATH /Users/vagrant/Library/Developer/Xcode/DerivedData/**/Logs/Test/
echo "DerivedData/Client/Log/Tests"
ls /Users/vagrant/Library/Developer/Xcode/DerivedData
CLIENT_PATH=$(ls /Users/vagrant/Library/Developer/Xcode/DerivedData | grep 'Client-')
mv /Users/vagrant/Library/Developer/Xcode/DerivedData/$CLIENT_PATH/Logs/Test/Test-Fennec.xcresult /Users/vagrant/Library/Developer/Xcode/DerivedData/$CLIENT_PATH/Logs/Test/Test-Fennec-test.xcresult
ls /Users/vagrant/Library/Developer/Xcode/DerivedData/$CLIENT_PATH/Logs/Test
xcrun xcresulttool graph --path $BITRISE_XCRESULT_PATH
ls ..
python3 xcresult_extract/xcresult_extract.py -project ../Client.xcodeproj -scheme Fennec
cat data.txt
sed 's/.*=//;s/'\''/"/g' data.txt > test.json
cat test.json
python3 perfTestTransform.py
- deploy-to-bitrise-io@1.9: {}
before_run:
- 1_git_clone_and_post_clone
- 2_certificate_and_profile
- 3_provisioning_and_npm_installation
Archive_and_Run_Robo_Test:
before_run:
- 1_git_clone_and_post_clone
- 2_certificate_and_profile
- 3_provisioning_and_npm_installation
steps:
- xcode-archive@4.7.2:
inputs:
- project_path: firefox-ios/Client.xcodeproj
- compile_bitcode: 'no'
- upload_bitcode: 'no'
- team_id: 9G8J6YA743
- export_method: development
- distribution_method: development
- export_development_team: 9G8J6YA743
- output_tool: xcodebuild
- scheme: Fennec_Enterprise
- configuration: Fennec_Enterprise
- deploy-to-bitrise-io@2: {}
- cache-pull@2.7.2:
inputs:
- cache_paths: "$HOME/sdk/google-cloud-sdk"
- script@1:
title: Install Google Cloud SDK
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
if [ -e $HOME/sdk/google-cloud-sdk ]; then
echo "Google Cloud SDK found, skipping installation..."
else
echo "Google Cloud SDK not found, installing..."
curl https://sdk.cloud.google.com > install.sh
bash install.sh --disable-prompts --install-dir=$HOME/sdk
source $HOME/sdk/google-cloud-sdk/path.bash.inc
gcloud components install beta --quiet
fi
- cache-push@2.7.1:
inputs:
- cache_paths: "$HOME/sdk/google-cloud-sdk"
- ignore_check_on_paths: "!/Users/vagrant/Library/Developer/Xcode/DerivedData/**"
- compress_archive: "true"
- script@1:
title: Firebase Test Lab Execution
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
set -o pipefail
curl -o /tmp/key-file.json $BITRISEIO_GOOGLE_APPLICATION_CREDENTIALS_URL
$HOME/sdk/google-cloud-sdk/bin/gcloud version
$HOME/sdk/google-cloud-sdk/bin/gcloud auth activate-service-account -q --key-file /tmp/key-file.json
$HOME/sdk/google-cloud-sdk/bin/gcloud config set project "$GOOGLE_CLOUD_PROJECT"
GCLOUD_OUTPUT=$($HOME/sdk/google-cloud-sdk/bin/gcloud beta firebase test ios run \
--type robo \
--app "$BITRISE_IPA_PATH" \
--device=model=iphone13pro,version=15.7 \
--device=model=iphone8,version=16.6 \
--results-bucket=firefox_ios_test_artifacts \
--no-record-video \
--client-details=matrixLabel="Bitrise" \
--quiet 2>&1)
GCLOUD_EXITCODE=$? # this will get the right-most command from the gcloud subshell
echo "GCLOUD_EXITCODE: $GCLOUD_EXITCODE"
# There is a chance the gcloud cli returns a custom array of exit codes, so we will need
# to parse the output to get the exit codes and potentially trigger our own failure
# In the case of an Inconclusive Test, we still haven't confirmed what stand-in exit code
# is returned, so we will need to update this script once we know what it is.
# We also don't know what order the exit codes will be returned in, so we will need to
# parse the output to get the exit codes and then assign them to variables.
envman add --key GCLOUD_EXIT_CODE --value "$GCLOUD_EXITCODE"
MATRIX_WEBLINK=$(echo "$GCLOUD_OUTPUT" | grep 'https://console.firebase.google.com/project' | awk -F '[][]' '{print $2}' | head -n 1)
envman add --key MATRIX_WEBLINK --value "$MATRIX_WEBLINK"
- script@1:
title: Modify Slack Message Based on GCLOUD_EXIT_CODE
inputs:
- content: |-
#!/usr/bin/env bash
# unpack GLCOUD_EXIT_CODE from string to int, if gcloud returns string instead of int for exit code
if [ $((GCLOUD_EXIT_CODE)) -ne 0 ]; then
SLACK_MESSAGE_PRETEXT="*Firefox-iOS* :firefox: *Archive/Robo Test* :x:"
else
SLACK_MESSAGE_PRETEXT="*Firefox-iOS* :firefox: *Archive/Robo Test* :white_check_mark:"
fi
envman add --key SLACK_MESSAGE_PRETEXT --value "$SLACK_MESSAGE_PRETEXT"
- slack@3.5.0:
is_always_run: true
inputs:
- title: ''
- author_name: ''
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
- footer: Created by Mobile Test Engineering
- pretext_on_error: "${SLACK_MESSAGE_PRETEXT}"
- pretext: "${SLACK_MESSAGE_PRETEXT}"
- timestamp: 'no'
- fields: |
Task | ${BITRISE_BUILD_URL}
Commit | ${GIT_CLONE_COMMIT_MESSAGE_SUBJECT}
Source-Workflow | ${BITRISE_TRIGGERED_WORKFLOW_TITLE}
Branch | ${BITRISE_GIT_BRANCH}
Result | ${MATRIX_WEBLINK}
- buttons: |
App|${BITRISE_APP_URL}
Firebase_Performance_Test:
before_run:
- 1_git_clone_and_post_clone
- 2_certificate_and_profile
- 3_provisioning_and_npm_installation
steps:
- xcode-archive@4.7.2:
inputs:
- project_path: firefox-ios/Client.xcodeproj
- compile_bitcode: 'no'
- upload_bitcode: 'no'
- team_id: 9G8J6YA743
- export_method: development
- distribution_method: development
- export_development_team: 9G8J6YA743
- output_tool: xcodebuild
- scheme: Fennec_Enterprise
- configuration: Fennec_Enterprise
- deploy-to-bitrise-io@2: {}
- script@1.1:
title: Firebase Build for Testing Physical Devices
inputs:
- content: |
#!/usr/bin/env bash
set -euxo pipefail
DERIVED_DATA_DIR="/Users/vagrant/git/DerivedData"
PROJECT="/Users/vagrant/git/firefox-ios/Client.xcodeproj"
SCHEME="Fennec_Enterprise"
SDK="iphoneos"
DESTINATION="generic/platform=iOS"
PRODUCTS_DIR="${DERIVED_DATA_DIR}/Build/Products"
TEST_PLAN="${SCHEME}_PerformanceTestPlan"
echo "-- build-for-testing --"
mkdir DerivedData
xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile -project firefox-ios/Client.xcodeproj
xcodebuild build-for-testing -project "$PROJECT" \
-scheme "$SCHEME" \
-sdk "$SDK" \
-destination "$DESTINATION" \
-derivedDataPath "${DERIVED_DATA_DIR}"
echo "-- verify build artifacts --"
if [[ ! -d "$PRODUCTS_DIR" ]]; then
echo "Error: $PRODUCTS_DIR was not created. Check your build steps and try again."
exit 1
fi
if [[ -z $(find "$PRODUCTS_DIR" -type f -name "${TEST_PLAN}*.xctestrun") ]]; then
echo "Error: Missing $TEST_PLAN. Check your scheme and ensure the Test Plan is added."
echo "The files in $PRODUCTS_DIR are:"
ls -l "$PRODUCTS_DIR"
echo "The available test plans for this scheme, $SCHEME, are:"
awk '/<TestPlanReference/,/<\/TestPlanReference>/' \
"${PROJECT}/xcshareddata/xcschemes/${SCHEME}.xcscheme" | \
grep "reference" | \
cut -d '"' -f 2 | \
sed -n 's|container:Tests/\(.*\).xctestplan|\1|p'
exit 1
fi
if [[ ! -d "${PRODUCTS_DIR}/${SCHEME}-${SDK}" ]]; then
echo "Error: Missing sdk for iPhone OS. Check your build sdk argument and try again."
echo "The files in $PRODUCTS_DIR are:"
ls -l "$PRODUCTS_DIR"
echo "The available sdks in this environment are:"
xcodebuild -showsdks | grep -E 'iphoneos|iphonesimulator'
exit 1
fi
- script@1.1:
title: Create .zip artifact for Firebase Testing
inputs:
- content: |
#!/usr/bin/env bash
set -euxo pipefail
PRODUCTS_DIR="/Users/vagrant/git/DerivedData/Build/Products"
SCHEME="Fennec_Enterprise"
SDK="iphoneos"
TEST_PLAN="${SCHEME}_PerformanceTestPlan"
TARGET_ARCHIVE="/Users/vagrant/git/Fennec_Enterprise.zip"
echo "-- create .zip artifact --"
# do not double-quote $TEST_PLAN, as it is a wildcard and we need it to expand
( cd "$PRODUCTS_DIR" && zip -r "${SCHEME}.zip" "${SCHEME}-${SDK}" ${TEST_PLAN}*.xctestrun )
mv "${PRODUCTS_DIR}/${SCHEME}.zip" "$TARGET_ARCHIVE"
- cache-pull@2.7.2:
inputs:
- cache_paths: "$HOME/google-cloud-sdk"
- script@1:
title: Install Google Cloud SDK
inputs:
- content: |-
#!/usr/bin/env bash
set -e
if [ -e $HOME/google-cloud-sdk ]; then
echo "Google Cloud SDK found, skipping installation..."
else
echo "Google Cloud SDK not found, installing..."
curl https://sdk.cloud.google.com > install.sh
bash install.sh --disable-prompts
source $HOME/google-cloud-sdk/path.bash.inc
fi
- cache-push@2.7.1:
inputs:
- cache_paths: "$HOME/google-cloud-sdk"
- ignore_check_on_paths: "!/Users/vagrant/Library/Developer/Xcode/DerivedData/**"
- compress_archive: "true"
- script@1:
title: Run Performance Tests in Firebase Test Lab
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
TIMESTAMP=$(date "+%Y%m%d%H%M%S")
RESULTS_DIR="firefox_ios_performance_tests_${TIMESTAMP}"
GOOGLE_CLOUD_BUCKET="firefox_ios_test_artifacts"
DEVICE_MODEL="iphone14pro" # if updating device model and version, also update firebase-performance.kind
DEVICE_VERSION="16.6"
TARGET_ARCHIVE="/Users/vagrant/git/Fennec_Enterprise.zip" # this should be the same as the artifact created in the previous step
curl -o /tmp/key-file.json "$BITRISEIO_GOOGLE_APPLICATION_CREDENTIALS_URL"
$HOME/google-cloud-sdk/bin/gcloud version
$HOME/google-cloud-sdk/bin/gcloud auth activate-service-account -q --key-file /tmp/key-file.json
$HOME/google-cloud-sdk/bin/gcloud config set project "$GOOGLE_CLOUD_PROJECT"
FIREBASE_TEST_RESULT=$($HOME/google-cloud-sdk/bin/gcloud firebase test ios run \
--test "$TARGET_ARCHIVE" \
--device model="$DEVICE_MODEL",version="$DEVICE_VERSION" \
--client-details=matrixLabel="Bitrise" \
--num-flaky-test-attempts=2 \
--results-bucket="$GOOGLE_CLOUD_BUCKET" \
--results-dir="$RESULTS_DIR")
FIREBASE_XCRESULT_PATH=$("${HOME}/google-cloud-sdk/bin/gsutil" ls "$XCRESULT_PATH" | grep ".xcresult")
envman add --key FIREBASE_XCRESULT_PATH --value "$FIREBASE_XCRESULT_PATH"
- script@1.1:
is_always_run: true
title: Create Perfherder Data Object from Firebase
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -ex
# get dependency
cd ./test-fixtures && git clone https://github.com/isabelrios/xcresult_extract.git
# pull firebase xcresult and rename it to extract measurement data
mkdir test_firebase_xcresult
$HOME/google-cloud-sdk/bin/gsutil -m cp -r "$FIREBASE_XCRESULT_PATH" ./test_firebase_xcresult &
# Get the process ID of the backgrounded gsutil command
PID=$!
TIMEOUT=60
CHECK_INTERVAL=5
ITERATIONS=$((TIMEOUT / CHECK_INTERVAL))
for ((i = 0; i < ITERATIONS; i++)); do
echo "Waiting for gsutil to complete..."
sleep $CHECK_INTERVAL
if ! ps -p $PID > /dev/null; then
break
fi
done
# if gsutil is still running after 60s, it is hanging and needs to be killed
if ps -p $PID > /dev/null; then
echo "The gsutil command exceeded the timeout. Stopping and removing contents..."
kill -9 $PID
rm -rf ./test_firebase_xcresult
mkdir ./test_firebase_xcresult
echo "Retrying xcresult copy without multi-processing..."
$HOME/google-cloud-sdk/bin/gsutil cp -r "$FIREBASE_XCRESULT_PATH" ./test_firebase_xcresult
fi
mv ./test_firebase_xcresult/*.xcresult ./test_firebase_xcresult/Test-Fennec-test.xcresult
# firebase xcresult needs to be in the Test dir created during earlier build-for-testing step
FIREBASE_XCRESULT="./test_firebase_xcresult/Test-Fennec-test.xcresult"
CLIENT_PATH=$(ls /Users/vagrant/Library/Developer/Xcode/DerivedData | grep 'Client-')
BITRISE_XCRESULT="/Users/vagrant/Library/Developer/Xcode/DerivedData/${CLIENT_PATH}/Logs/Test/Test-Fennec-test.xcresult"
mv "$FIREBASE_XCRESULT" "$BITRISE_XCRESULT"
# create and print perf data object for perfherder ingest via taskcluster log output
xcrun xcresulttool graph --path "$BITRISE_XCRESULT"
ls ..
# If this ever breaks, check the xcresult_extract.py function find_xcresult_path
# and figure out exactly what it is doing because we are using Fennec as the scheme
# and it works for both Fennec and Fennec_Enterprise, but I don't know why.
# I would change it here but I am too afraid to break it.
python3 xcresult_extract/xcresult_extract.py -project ../Client.xcodeproj -scheme Fennec
cat data.txt
sed 's/.*=//;s/'\''/"/g' data.txt > test.json
cat test.json
python3 perfTestTransform.py
#
# *****%*****%***** FOCUS WORKFLOWS *****%*****%*****
#
focus_configure_build:
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: "$SLACK_WEBHOOK"
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: "$SLACK_WEBHOOK"
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: "$SLACK_WEBHOOK"
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: "$SLACK_WEBHOOK"
# # 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
steps:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: build_applications.focus_configure_build
- 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_SERVER_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-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" 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" 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" 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" 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" 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" upload-dif \
--org mozilla --project klar-ios "$BITRISE_DSYM_DIR_PATH"
app:
envs:
- opts:
is_expand: false
BITRISE_EXPORT_METHOD: development
- opts:
is_expand: false
BITRISE_NIGHTLY_VERSION: '9000'
- opts:
is_expand: false
BITRISE_RELEASE_VERSION: '127.0'
- opts:
is_expand: false
BITRISE_BETA_VERSION: '127.0'
trigger_map:
- push_branch: main
pipeline: pipeline_build_and_test
- push_branch: epic-branch/*
pipeline: pipeline_build_and_test
- push_branch: release/v127
pipeline: pipeline_build_and_test
- pull_request_target_branch: main
pipeline: pipeline_build_and_test
- pull_request_target_branch: epic-branch/*
pipeline: pipeline_build_and_test
- pull_request_target_branch: release/v*
pipeline: pipeline_build_and_test
meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core