Revision control

Copy as Markdown

#!/usr/bin/env python3
# Purpose: Run Firefox-iOS tests against this application-services working tree.
# Usage: ./automation/
import argparse
import subprocess
import tempfile
from pathlib import Path
from shared import step_msg, fatal_err, run_cmd_checked, find_app_services_root
parser = argparse.ArgumentParser(description="Run Firefox-iOS tests against this application-services working tree.")
group = parser.add_mutually_exclusive_group()
help="Use a local copy of firefox-ios instead of cloning it.")
help="Clone a different firefox-ios repository.")
help="Branch of firefox-ios to use.")
choices=["open-project", "run-tests", "do-nothing"],
help="Run the following action once firefox-ios is set up.")
args = parser.parse_args()
firefox_ios_branch = args.branch
local_repo_path = args.use_local_repo
remote_repo_url = args.remote_repo_url
action = args.action
ios_repo_path = local_repo_path
appservices_path = find_app_services_root()
if local_repo_path is None:
ios_repo_path = tempfile.mkdtemp(suffix="-fxios")
if remote_repo_url is None:
remote_repo_url = DEFAULT_REMOTE_REPO_URL
step_msg(f"Cloning {remote_repo_url}")
run_cmd_checked(["git", "clone", remote_repo_url, ios_repo_path])
if firefox_ios_branch is not None:
run_cmd_checked(["git", "checkout", firefox_ios_branch], cwd=ios_repo_path)
elif firefox_ios_branch is not None:
fatal_err("Cannot specify branch when using a local repo; check it out locally and try again.")
step_msg("Cloning rust-components-swift")
rcs_repo_path = tempfile.mkdtemp(suffix="-rcs")
run_cmd_checked(["git", "clone", DEFAULT_RCS_REPO_URL, rcs_repo_path])
step_msg("Setting up iOS to use the local application services")
run_cmd_checked(["./", "-a", appservices_path, rcs_repo_path], cwd=ios_repo_path)
step_msg("Running the firefox-ios bootstrap script")
run_cmd_checked(["./"], cwd=ios_repo_path)
if action == "do-nothing":
elif action == "open-project":
run_cmd_checked(["open", "Client.xcodeproj"], cwd=ios_repo_path)
elif action == "run-tests" or action is None:
# TODO: we specify scheme = Fennec, but it might be wrong? Check with iOS peeps.
step_msg("Running firefox-ios tests")"""\
set -o pipefail && \
xcodebuild \
-workspace ./Client.xcodeproj/project.xcworkspace \
-scheme Fennec \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 14' \
test | \
tee raw_xcodetest.log | \
xcpretty && exit "${PIPESTATUS[0]}"
""", cwd=ios_repo_path, shell=True)
print("Sorry I did not understand what you wanted. Good luck!")