Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Optimize bitrise.yml file (#3998)
Browse files Browse the repository at this point in the history
* Optimize bitrise.yml file

* reusing code in steps

* update taskluster as firefox
  • Loading branch information
isabelrios authored Jan 23, 2024
1 parent 8cd040f commit c3528cf
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 293 deletions.
2 changes: 1 addition & 1 deletion .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ tasks:
# Note: This task is built server side without the context or tooling that
# exist in tree so we must hard code the hash
image:
mozillareleases/taskgraph:decision-10068f116a3800a829ddba367136a95bef5634e06f77e051859586202c93b18a@sha256:a74ed430fd80ebb647bb4a5b019523cf5f69246ed2c2603386dbc8f7200c8140
mozillareleases/taskgraph:decision-c4ac262880970ca484105929e02dd12f00214d5f2603ab6ce4c0d17de5cd0280@sha256:2dd667994aa13fccdcdcede85c570a5eb4a5247e42875a9e95a135ef774ee469

maxRunTime: 1800

Expand Down
185 changes: 40 additions & 145 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,33 @@ project_type: ios

trigger_map:
- push_branch: main
pipeline: pipeline_build_and_run_tests
pipeline: pipeline_build_and_run_tests_focus
- pull_request_source_branch: "*"
pipeline: pipeline_build_and_run_tests
pipeline: pipeline_build_and_run_tests_focus
- tag: "*"
workflow: release

pipelines:
pipeline_build_and_run_tests:
pipeline_build_and_run_tests_focus:
stages:
- stage_1: {}
- stage_2: {}
- stage_1_focus: {}
- stage_2_focus: {}

stages:
stage_1:
stage_1_focus:
workflows:
- configure_build: {}
- configure_build_focus: {}

stage_2:
stage_2_focus:
workflows:
- ui_test_focus: {}
- unit_test_klar: {}
- unit_test_focus: {}

workflows:
configure_build:
configure_build_focus:
steps:
- [email protected]: {}
- cache-pull@2: {}
- certificate-and-profile-installer@1: {}
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
./checkout.sh
title: ContentBlockerGen
- swiftlint-extended@1:
inputs:
- linting_path: "$BITRISE_SOURCE_DIR"
Expand All @@ -54,16 +44,6 @@ workflows:
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
- git::https://github.com/DamienBitrise/bitrise-test-plan-sharder.git@master:
title: Bitrise Test Plan Sharder
inputs:
- xcode_project: Blockzilla.xcodeproj
- target: Blockzilla
- shards: '2'
- scheme: Focus
- debug_mode: 'true'
- test_path: ''
- file_type: ".swift"
- [email protected]:
title: Build for Testing Focus
inputs:
Expand Down Expand Up @@ -117,10 +97,8 @@ workflows:
- channel: "#mobile-alerts-ios"
- message: "The build failed to build"
- webhook_url: "$SLACK_WEBHOOK"
meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core
before_run:
- clone-and-build-dependencies

ui_test_focus:
steps:
Expand All @@ -144,21 +122,6 @@ workflows:
envman add --key TEST_PLAN_NAME --value SmokeTest
fi
- title: Check if build is scheduled or regular to set the test plan
- git::https://github.com/bitrise-steplib/bitrise-step-artifact-pull.git@main:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_1.*
- [email protected]:
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
echo "-- unzip -- "
exec unzip "${BITRISE_ARTIFACT_PATHS}"
echo "show dir"
ls
- [email protected]:
title: Test without Building
inputs:
Expand Down Expand Up @@ -186,29 +149,11 @@ workflows:
- channel: "#mobile-alerts-ios"
- message: "The build run the Focus testPlan: $TEST_PLAN_NAME"
- webhook_url: "$SLACK_WEBHOOK"

meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core
before_run:
- pull-and-unzip-dependencies

unit_test_klar:
steps:
- git::https://github.com/bitrise-steplib/bitrise-step-artifact-pull.git@main:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_1.*
- [email protected]:
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
echo "-- unzip -- "
exec unzip "${BITRISE_ARTIFACT_PATHS}"
echo "show dir"
ls
- [email protected]:
title: Test without Building
inputs:
Expand All @@ -232,28 +177,11 @@ workflows:
- channel: "#mobile-alerts-ios"
- message: "The build run the Klar testPlan: UnitTests"
- webhook_url: "$SLACK_WEBHOOK"
meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core
before_run:
- pull-and-unzip-dependencies

unit_test_focus:
steps:
- git::https://github.com/bitrise-steplib/bitrise-step-artifact-pull.git@main:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_1.*
- [email protected]:
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
echo "-- unzip -- "
exec unzip "${BITRISE_ARTIFACT_PATHS}"
echo "show dir"
ls
- [email protected]:
title: Test without Building
inputs:
Expand All @@ -277,12 +205,27 @@ workflows:
- channel: "#mobile-alerts-ios"
- message: "The build run the Focus testPlan: UnitTests"
- webhook_url: "$SLACK_WEBHOOK"
before_run:
- pull-and-unzip-dependencies

meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core

pull-and-unzip-dependencies:
description: Pulls and unzip the dependencis from previous stage_1_focus
steps:
- git::https://github.com/bitrise-steplib/bitrise-step-artifact-pull.git@main:
title: Pull artifacts
inputs:
- verbose: true
- artifact_sources: stage_1_focus.*
- [email protected]:
title: Unzip
inputs:
- content: |
set -euxo pipefail
echo "$BITRISE_ARTIFACT_PATHS"
echo "-- unzip -- "
exec unzip "${BITRISE_ARTIFACT_PATHS}"
echo "show dir"
ls
clone-and-build-dependencies:
description: Clones the repo and builds dependencies
Expand All @@ -297,10 +240,6 @@ workflows:
#!/usr/bin/env bash
./checkout.sh
title: ContentBlockerGen
meta:
bitrise.io:
stack: osx-xcode-15.2.x


set-project-version:
steps:
Expand All @@ -324,10 +263,6 @@ workflows:
- build_version_offset: '3250'
- plist_path: focus-ios/OpenInFocus/Info.plist
title: Set OpenInFocus version numbers
meta:
bitrise.io:
stack: osx-xcode-15.2.x


configure-nimbus:
steps:
Expand All @@ -341,11 +276,6 @@ workflows:
/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
meta:
bitrise.io:
stack: osx-xcode-15.2.x


configure-sentry:
steps:
- script@1:
Expand All @@ -355,10 +285,6 @@ workflows:
#!/usr/bin/env bash
set -x
/usr/libexec/PlistBuddy -c "Add :SentryDSN string ${SENTRY_DSN}" focus-ios/Blockzilla/Info.plist
meta:
bitrise.io:
stack: osx-xcode-15.2.x

set-default-browser-entitlement:
steps:
Expand All @@ -370,10 +296,6 @@ workflows:
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
meta:
bitrise.io:
stack: osx-xcode-15.2.x

release:
steps:
Expand Down Expand Up @@ -417,10 +339,7 @@ workflows:
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"
meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core
before_run:
- clone-and-build-dependencies
- set-project-version
Expand All @@ -447,23 +366,16 @@ workflows:
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:
Expand All @@ -488,23 +400,9 @@ workflows:
- [email protected]:
inputs:
- deploy_path: artifacts/
meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core

L10nBuild:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- cache-pull@2: {}
- certificate-and-profile-installer@1: {}
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
./checkout.sh
title: ContentBlockerGen
- script@1:
title: Set Default Web Browser Entitlement
inputs:
Expand All @@ -530,16 +428,13 @@ workflows:
inputs:
- deploy_path: l10n-screenshots/en-US/en-US
- is_compress: 'true'
meta:
bitrise.io:
stack: osx-xcode-15.2.x
machine_type_id: g2-m1.8core

before_run:
- clone-and-build-dependencies
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: Blockzilla.xcodeproj
BITRISE_PROJECT_PATH: focus-ios/Blockzilla.xcodeproj
- opts:
is_expand: false
BITRISE_EXPORT_METHOD: app-store
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions taskcluster/focusios_taskgraph/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from taskgraph.transforms.job import run_job_using, configure_taskdesc_for_run
from taskgraph.transforms.run import run_task_using, configure_taskdesc_for_run
from taskgraph.util.schema import Schema, taskref_or_string
from voluptuous import Required, Optional

Expand Down Expand Up @@ -32,9 +32,9 @@
})


@run_job_using("docker-worker", "run-commands", schema=run_commands_schema)
def configure_run_commands_schema(config, job, taskdesc):
run = job["run"]
@run_task_using("docker-worker", "run-commands", schema=run_commands_schema)
def configure_run_commands_schema(config, task, taskdesc):
run = task["run"]
pre_commands = run.pop("pre-commands", [])
pre_commands += [
_generate_dummy_secret_command(secret) for secret in run.pop("dummy-secrets", [])
Expand All @@ -47,8 +47,8 @@ def configure_run_commands_schema(config, job, taskdesc):

run["command"] = _convert_commands_to_string(all_commands)
_inject_secrets_scopes(run, taskdesc)
_set_run_task_attributes(job)
configure_taskdesc_for_run(config, job, taskdesc, job["worker"]["implementation"])
_set_run_task_attributes(task)
configure_taskdesc_for_run(config, task, taskdesc, task["worker"]["implementation"])


def _generate_secret_command(secret):
Expand Down Expand Up @@ -122,7 +122,7 @@ def _inject_secrets_scopes(run, taskdesc):
scopes.extend(new_secret_scopes)


def _set_run_task_attributes(job):
run = job["run"]
def _set_run_task_attributes(task):
run = task["run"]
run["cwd"] = "{checkout}"
run["using"] = "run-task"
2 changes: 1 addition & 1 deletion taskcluster/focusios_taskgraph/screenshots_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_screenshots_locales():
config = {"locales": []}

# Check all *.lproj files as there is one per locale
for file in os.listdir(os.path.join(project_dir, 'Blockzilla')):
for file in os.listdir(os.path.join(project_dir, 'focus-ios/Blockzilla')):
if file.endswith(".lproj"):
config["locales"].append(file)

Expand Down
Loading

0 comments on commit c3528cf

Please sign in to comment.