Revision control

Copy as Markdown

format_version: '8'
pipelines:
pipeline_build_and_test:
workflows:
determine_apps_affected: {}
firefox_configure_build:
run_if:
expression: '{{ enveq "BUILD_FIREFOX_IOS" "true" }}'
depends_on:
- determine_apps_affected
focus_configure_build:
run_if:
expression: '{{ enveq "BUILD_FOCUS_IOS" "true" }}'
depends_on:
- determine_apps_affected
# We don't build klar for new PR now, bu we can still
# start klar_configure_build manually.
klar_configure_build:
run_if:
expression: false
depends_on:
- determine_apps_affected
run_firefox_ui_tests:
run_if:
expression: '{{ enveq "RUN_UI_TESTS" "Run_UI_Tests" }}'
depends_on:
- firefox_configure_build
parallel: 5
focus_ui_test:
run_if:
expression: '{{ enveq "RUN_UI_TESTS" "Run_UI_Tests" }}'
depends_on:
- focus_configure_build
parallel: 1
pipeline_build_and_test_focus:
workflows:
focus_configure_build: {}
focus_ui_test:
depends_on:
- focus_configure_build
parallel: 1
workflows:
determine_apps_affected:
steps:
# The diff below needs the full history, git-clone fetches only the last commit by default
- git-clone@8:
inputs:
- clone_depth: -1
- 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
# git-clone checks out the PR merge ref without creating the base branch ref, so fetch it
BASE_BRANCH_NAME="${BASE_BRANCH#origin/}"
git fetch --no-tags origin "+refs/heads/$BASE_BRANCH_NAME:refs/remotes/origin/$BASE_BRANCH_NAME"
BASE_BRANCH="origin/$BASE_BRANCH_NAME"
# 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, LICENSE, and PR template changes
TOTAL_CHANGED_FILES_COUNT=$(git diff --name-only $BASE_BRANCH..."$BITRISE_GIT_COMMIT" | wc -l | xargs)
DOCS_ONLY_FILE_COUNT=$(git diff --name-only $BASE_BRANCH..."$BITRISE_GIT_COMMIT" \
| grep -Eci '(\.md$|^LICENSE$|^PULL_REQUEST_TEMPLATE$)' | xargs)
if [ "$TOTAL_CHANGED_FILES_COUNT" -eq "$DOCS_ONLY_FILE_COUNT" ] && [ "$DOCS_ONLY_FILE_COUNT" -ne 0 ]; then
echo "Only Markdown, LICENSE or template 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\.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*)
# Explicitly 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="false"
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"
echo "BUILD_FIREFOX_IOS: $BUILD_FIREFOX_IOS"
echo "BUILD_FOCUS_IOS: $BUILD_FOCUS_IOS"
echo "BUILD_SAMPLE_BROWSER_IOS: $BUILD_SAMPLE_BROWSER_IOS"
- share-pipeline-variable@1:
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_configure_build:
before_run:
- 0_detect_standalone_build
- 1_git_clone_and_post_clone
- 2_certificate_and_profile
- 3_provisioning_and_npm_installation
- skip_macro_validation
- decision_to_run_UI_Tests
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- restore-spm-cache@3:
is_always_run: true
- activate-build-cache-for-xcode@0: {}
- xcode-build-for-test@3:
inputs:
- scheme: Fennec
- configuration: Debug
- project_path: /Users/vagrant/git/firefox-ios/Client.xcodeproj
- xcodebuild_options: '"ONLY_ACTIVE_ARCH=YES" "COMPILER_INDEX_STORE_ENABLE=NO" -allowProvisioningUpdates -skipMacroValidation DEVELOPMENT_TEAM=$APPLE_TEAM_ID'
- destination: platform=iOS Simulator,name=iPhone 18 Pro,OS=27.0
- script@1:
title: Detect number of warnings
# TODO: Fix the number of warnings reported by Xcode 27
is_always_run: true
inputs:
- content: |
set -e
set -x
echo "bitrise_xcode"
COUNT_XCUI=$(./test-fixtures/generate-metrics.sh $BITRISE_XCODE_RAW_RESULT_TEXT_PATH 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
- script@1:
title: Remove cache
is_always_run: true
inputs:
- content: |
export PATH="${PATH#"$HOME/.bitrise-xcelerate/bin:"}"
envman add --key PATH --value "$PATH"
- script@1:
title: Override xctestrun file to UnitTests
inputs:
- content: |-
#!/usr/bin/env bash
set -euxo pipefail
# Point to the Unit tests plan instead of Accessibility
UNIT_TESTS_XCTESTRUN="$BITRISE_TEST_BUNDLE_PATH/Fennec_UnitTest_iphonesimulator27.1-arm64.xctestrun"
SMOKE_UI_XCTESTRUN="$BITRISE_TEST_BUNDLE_PATH/Fennec_Smoketest_iphonesimulator27.1-arm64.xctestrun"
if [ ! -f "$UNIT_TESTS_XCTESTRUN" ]; then
echo "ERROR: .xctestrun file not found: $UNIT_TESTS_XCTESTRUN"
exit 1
fi
echo "Found UnitTest .xctestrun: $UNIT_TESTS_XCTESTRUN"
envman add --key BITRISE_XCTESTRUN_UNIT_TEST_FILE_PATH --value "$UNIT_TESTS_XCTESTRUN"
envman add --key BITRISE_XCTESTRUN_SMOKE_TEST_FILE_PATH --value "$SMOKE_UI_XCTESTRUN"
- xcode-test-without-building@1:
timeout: 1200
inputs:
- destination: platform=iOS Simulator,name=iPhone 18 Pro,OS=27.0
- xcodebuild_options: '"ONLY_ACTIVE_ARCH=YES" "COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO" -collect-test-diagnostics never'
- xctestrun: $BITRISE_TEST_BUNDLE_PATH/Fennec_UnitTest_iphonesimulator27.1-arm64.xctestrun
- maximum_test_repetitions: 2
- test_repetition_mode: retry_on_failure
- xcode-test-shard-calculation@0:
run_if: '{{enveq "BITRISE_TEST_BUNDLE_PATH" "" | not}}'
inputs:
- product_path: $BITRISE_XCTESTRUN_SMOKE_TEST_FILE_PATH
- shard_count: 5
- destination: $BITRISE_DESTINATION
outputs:
- BITRISE_TEST_SHARDS_PATH: BITRISE_TEST_SHARDS_PATH_FIREFOX
is_always_run: true
# Only push/release/epic builds save SPM cache. PRs read from the cache
# (via restore-spm-cache@3 above) but never write back, so they can't
# poison the cache for subsequent builds. main keeps the cache fresh.
- save-spm-cache@1:
is_always_run: true
run_if: '{{not .IsPR}}'
- script@1:
title: Clean before deploying
timeout: 360
inputs:
- content: |
#!/usr/bin/env bash
set -euo pipefail
echo "Removing raw-xcodebuild-output.log to reduce artifact size"
rm -f "$BITRISE_DEPLOY_DIR/raw-xcodebuild-output.log"
echo "Removing swiftlint reports already deployed by the swiftlint workflow"
rm -f "$BITRISE_DEPLOY_DIR/swiftlint_report.txt" || true
rm -f "$BITRISE_DEPLOY_DIR/swiftlint_report.xml" || true
echo "Removing unit test xcresult"
rm -f "$BITRISE_DEPLOY_DIR"/Test-Fennec_UnitTest_*.xcresult.zip || true
echo "Removing testbundle.zip artifact (already available as pipeline intermediate)"
rm -f "$BITRISE_DEPLOY_DIR/testbundle.zip" || true
echo "Removing dSYM directories from test bundle to reduce pipeline artifact size"
find "$BITRISE_TEST_BUNDLE_PATH" -name "*.dSYM" -type d -exec rm -rf {} + 2>/dev/null || true
echo "Removing .bcsymbolmap files from test bundle"
find "$BITRISE_TEST_BUNDLE_PATH" -name "*.bcsymbolmap" -delete 2>/dev/null || true
- deploy-to-bitrise-io@2:
run_if: '{{enveq "BITRISE_TEST_BUNDLE_PATH" "" | not}}'
inputs:
- pipeline_intermediate_files: |-
BITRISE_TEST_SHARDS_PATH_FIREFOX
BITRISE_TEST_BUNDLE_PATH
BITRISE_XCTESTRUN_SMOKE_TEST_FILE_PATH
is_always_run: true
- script@1:
title: Run Danger 2
timeout: 360
inputs:
- content: |
#!/usr/bin/env bash
# Fail if any command fails
set -e
# Extract .xcresult using xcrun xccov
echo "Generating coverage.json from xcresult..."
xcrun xccov view --report --json "$BITRISE_XCRESULT_PATH" > coverage.json
echo "coverage.json created successfully"
# Define a cleanup function to remove the file
function cleanup_coverage {
if [ -f coverage.json ]; then
echo "Removing coverage.json"
rm coverage.json
fi
}
# Register it to run on script exit
trap cleanup_coverage EXIT
echo "Running Danger"
swift run danger-swift ci
- slack@4:
is_always_run: true
inputs:
- title: ''
- author_name: ''
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
- footer_icon: https://emoji.slack-edge.com/T07DB2PSS3W/testops-notify/55edcdb3371320b6.png
- 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}
Mana|https://mana.mozilla.org/wiki/display/MTE/Mobile+Test+Engineering
- slack@4:
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
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
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
# Branch pushes (no PR) leave $BITRISEIO_GIT_BRANCH_DEST empty, and Bitrise
# clones only the pushed commit - so origin/main may be missing entirely or
# present without a common ancestor, either of which makes the diff below
# fail. Fetch it, and tolerate failure: an empty FILES_CHANGED takes the
# "no files changed" path below and skips the blacklist check rather than
# failing the workflow and skipping the build and tests.
git fetch --no-tags origin main 2>/dev/null || true
FILES_CHANGED=$(git diff --name-only origin/main..."$BITRISE_GIT_COMMIT" 2>/dev/null || true)
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/|focus-ios/|.*.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
run_firefox_ui_tests:
before_run:
- 1_git_clone_and_post_clone
- 2_certificate_and_profile
# - skip_macro_validation # TODO check if Needed here?
steps:
- pull-intermediate-files@1: {}
- xcode-test-without-building@1:
timeout: 1200
inputs:
- only_testing: $BITRISE_TEST_SHARDS_PATH_FIREFOX/$BITRISE_IO_PARALLEL_INDEX
- destination: platform=iOS Simulator,name=iPhone 18 Pro,OS=27.0
- xcodebuild_options: '"ONLY_ACTIVE_ARCH=YES" "COMPILER_INDEX_STORE_ENABLE=NO" -collect-test-diagnostics never'
- xctestrun: $BITRISE_TEST_BUNDLE_PATH/Fennec_Smoketest_iphonesimulator27.1-arm64.xctestrun
- deploy-to-bitrise-io@2: {}
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" Klar.entitlements
- xcode-build-for-test@3:
inputs:
- scheme: Focus
- configuration: FocusDebug
- project_path: /Users/vagrant/git/focus-ios/Blockzilla.xcodeproj
- xcodebuild_options: '"ONLY_ACTIVE_ARCH=YES" "COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
- destination: platform=iOS Simulator,name=iPhone 18 Pro,OS=27.0
- script@1:
title: Override xctestrun Focus env variables
inputs:
- content: |-
#!/usr/bin/env bash
set -euxo pipefail
# Point to the Unit tests plan instead of Accessibility
FOCUS_UI_XCTESTRUN="$BITRISE_TEST_BUNDLE_PATH/Focus_SmokeTest_iphonesimulator27.1-arm64.xctestrun"
echo "Found UITest .xctestrun: $FOCUS_UI_XCTESTRUN"
envman add --key BITRISE_XCTESTRUN_FOCUS_UI_TEST_FILE_PATH --value "$FOCUS_UI_XCTESTRUN"
- xcode-test-without-building@1:
timeout: 1200
inputs:
- destination: platform=iOS Simulator,name=iPhone 18 Pro,OS=27.0
- xcodebuild_options: '"ONLY_ACTIVE_ARCH=YES" "COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
- xctestrun: $BITRISE_TEST_BUNDLE_PATH/Focus_UnitTests_iphonesimulator27.1-arm64.xctestrun
- xcode-test-shard-calculation@0:
inputs:
- product_path: $BITRISE_XCTESTRUN_FOCUS_UI_TEST_FILE_PATH
- shard_count: 1
- destination: $BITRISE_DESTINATION
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: |-
BITRISE_TEST_BUNDLE_PATH
BITRISE_TEST_SHARDS_PATH
BITRISE_XCTESTRUN_FOCUS_UI_TEST_FILE_PATH
- slack@4:
run_if: ".IsBuildFailed"
inputs:
- channel: "#mobile-alerts-ios"
- message: "The build failed to build"
- webhook_url: "$SLACK_WEBHOOK"
klar_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" Klar.entitlements
- xcode-build-for-test@3:
inputs:
- scheme: Klar
- configuration: KlarDebug
- project_path: /Users/vagrant/git/focus-ios/Blockzilla.xcodeproj
- xcodebuild_options: '"COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
- destination: platform=iOS Simulator,name=iPhone 17,OS=26.5
- xcode-test-without-building@1:
timeout: 1200
inputs:
- destination: platform=iOS Simulator,name=iPhone 17,OS=26.5
- xcodebuild_options: '"COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
- xctestrun: $BITRISE_TEST_BUNDLE_PATH/Klar_UnitTests_iphonesimulator26.5-arm64.xctestrun
- deploy-to-bitrise-io@2: {}
- slack@4:
run_if: ".IsBuildFailed"
inputs:
- channel: "#mobile-alerts-ios"
- message: "The build run the Klar testPlan: UnitTests"
- webhook_url: "$SLACK_WEBHOOK"
focus_ui_test:
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
- pull-intermediate-files@1: {}
- xcode-test-without-building@1:
timeout: 1200
inputs:
- only_testing: $BITRISE_TEST_SHARDS_PATH/$BITRISE_IO_PARALLEL_INDEX
- destination: platform=iOS Simulator,name=iPhone 18 Pro,OS=27.0
- xcodebuild_options: '"ONLY_ACTIVE_ARCH=YES" "COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO" -collect-test-diagnostics never'
- xctestrun: $BITRISE_TEST_BUNDLE_PATH/Focus_SmokeTest_iphonesimulator27.1-arm64.xctestrun
- deploy-to-bitrise-io@2: {}
- github-status@3:
inputs:
- status_identifier: "Focus-build"
- slack@4:
run_if: ".IsBuildFailed"
inputs:
- channel: "#mobile-alerts-ios"
- message: "The build run the Focus testPlan: $TEST_PLAN_NAME"
- webhook_url: "$SLACK_WEBHOOK"
send_slack_notification:
steps:
- slack@4:
inputs:
- title: ''
- author_name: ''
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
- footer_icon: https://emoji.slack-edge.com/T07DB2PSS3W/testops-notify/55edcdb3371320b6.png
- 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}
Mana|https://mana.mozilla.org/wiki/display/MTE/Mobile+Test+Engineering
Detect_warnings:
steps:
- script@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