diff --git a/bitrise.yml b/bitrise.yml index 9a0115be..02f37eed 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -1,314 +1,2996 @@ format_version: "13" default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: other -meta: - bitrise.io: - stack: linux-docker-android-22.04 - machine_type_id: g2.linux.medium - app: envs: - - PANDOC_VERSION: "3.6.2" - - MAVEN_VERSION: "3.9.9" - # These are needed for the E2E test assertion logic + - PANDOC_VERSION: 3.6.2 + - MAVEN_VERSION: 3.9.9 - WORKSPACE_SLUG: 322a005426441b60 - MONOLITH_API_PAT: $BITRISE_BUILD_CACHE_AUTH_TOKEN - TRIGGERED_BUILD_SLUG: $BITRISE_BUILD_SLUG - -workflows: - release: - description: Creates Linux and Darwin binaries, then publishes a GitHub release +meta: + bitrise.io: + machine_type_id: g2.linux.medium + stack: linux-docker-android-22.04 +pipelines: + benchmark: + workflows: + benchmark_doddle_build_baseline: {} + benchmark_doddle_build_cc: {} + benchmark_doddle_build_cc_random: {} + benchmark_results: + depends_on: + - benchmark_doddle_build_baseline + - benchmark_doddle_build_cc + - benchmark_doddle_build_cc_random + features-e2e: triggers: - tag: - - name: - regex: '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' + push: + - branch: main + pull_request: + - source_branch: '*' + workflows: + e2e-xcode-comp-cache: {} + feature-e2e-bazel-bitrisedc-no-rbe: {} + feature-e2e-bazel-public-no-rbe: {} + feature-e2e-gradle-bitwarden: {} + feature-e2e-gradle-duckduck: {} + gradle-configuration-e2e-linux: {} + gradle-configuration-e2e-osx: {} + test: {} +workflows: + benchmark_calendar_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: Calendar + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_calendar_build_baseline_16_4: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: Calendar_16_4 + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-16.4.x + benchmark_calendar_build_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Calendar_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_calendar_build_cc_dd: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Calendar_CC_DD + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_calendar_build_cc_dd_spm: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Calendar_CC_DD_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_calendar_build_cc_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Calendar_CC_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_calendar_build_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: Calendar_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_calendar_build_spm_16_4: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: Calendar_SPM_16_4 + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-16.4.x + benchmark_calendar_build_spm_explicit: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: Calendar_Explicit_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:richardtop/CalendarApp.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Calendar.xcodeproj + - scheme: Calendar + - configuration: Debug + - xcodebuild_options: SWIFT_ENABLE_EXPLICIT_MODULES=YES -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_icecubesapp_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: IceCubesApp + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:Dimillian/IceCubesApp.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + inputs: + - content: |- + set -exo pipefail + cp IceCubesApp-release.xcconfig IceCubesApp.xcconfig + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: IceCubesApp.xcodeproj + - scheme: IceCubesApp + - configuration: Debug + - destination: platform=iOS Simulator,name=iPhone 17,OS=26.0 + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_icecubesapp_build_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: IceCubesApp_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:Dimillian/IceCubesApp.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + inputs: + - content: |- + set -exo pipefail + cp IceCubesApp-release.xcconfig IceCubesApp.xcconfig + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: IceCubesApp.xcodeproj + - scheme: IceCubesApp + - configuration: Debug + - destination: platform=iOS Simulator,name=iPhone 17,OS=26.0 + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_icecubesapp_build_cc_dd_spm: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: IceCubesApp_CC_DD_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:Dimillian/IceCubesApp.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + inputs: + - content: |- + set -exo pipefail + cp IceCubesApp-release.xcconfig IceCubesApp.xcconfig + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: IceCubesApp.xcodeproj + - scheme: IceCubesApp + - configuration: Debug + - destination: platform=iOS Simulator,name=iPhone 17,OS=26.0 + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_icecubesapp_build_cc_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: IceCubesApp_CC_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:Dimillian/IceCubesApp.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + inputs: + - content: |- + set -exo pipefail + cp IceCubesApp-release.xcconfig IceCubesApp.xcconfig + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: IceCubesApp.xcodeproj + - scheme: IceCubesApp + - configuration: Debug + - destination: platform=iOS Simulator,name=iPhone 17,OS=26.0 + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_icecubesapp_build_dd: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: IceCubesApp_DD + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:Dimillian/IceCubesApp.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + inputs: + - content: |- + set -exo pipefail + cp IceCubesApp-release.xcconfig IceCubesApp.xcconfig + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: IceCubesApp.xcodeproj + - scheme: IceCubesApp + - configuration: Debug + - destination: platform=iOS Simulator,name=iPhone 17,OS=26.0 + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_results: + envs: + - APPS: |- + WordPress + WordPress_Analyze + WordPress_Random + Tuist + Calendar + IceCubesApp + VLC + Doddle + opts: + is_expand: false + steps: + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + set -euo pipefail + + variants=( + "" + "_SPM" + "_CC" + "_DD_CC" + "_CC_DD" + "_SPM_CC" + "_CC_SPM" + "_DD_SPM_CC" + "_CC_DD_SPM" + ) + + pretty_diff() { + local secs=$1 + local sign="" + if (( secs < 0 )); then + sign="-" + secs=$(( -secs )) + fi + local minutes=$(( secs / 60 )) + local seconds=$(( secs % 60 )) + if (( minutes > 0 )); then + printf '%s%dm %ds\n' "$sign" "$minutes" "$seconds" + else + printf '%s%ds\n' "$sign" "$seconds" + fi + } + + # read APPS into an array + apps=() + while IFS= read -r line || [[ -n $line ]]; do + apps+=("$line") + done <<< "$APPS" + + # build all variants + app_variants=() + for base in "${apps[@]}"; do + app_variants+=("$base") + for v in "${variants[@]}"; do + [[ -z "$v" ]] && continue + app_variants+=("${base}${v}") + done + done + + # duration in seconds from START/END var names + duration_seconds() { + local start_name=$1 + local end_name=$2 + echo $(( ${!end_name} - ${!start_name} )) + } + + # percent change with one decimal using integer math: + # returns string like "+12.3%" or "-4.0%" or "0.0%" + percent_change_one_decimal() { + local base_secs=$1 + local var_secs=$2 + + if (( base_secs == 0 )); then + printf 'N/A' + return + fi + + local diff=$(( base_secs - var_secs )) # positive = improvement + local scaled=$(( (diff * 1000) / base_secs )) # tenths of percent (integer) + local sign="" + if (( scaled > 0 )); then + sign="+" + elif (( scaled < 0 )); then + sign="-" + scaled=$(( -scaled )) + fi + local int_part=$(( scaled / 10 )) + local frac=$(( scaled % 10 )) + printf '%s%d.%d%%' "$sign" "$int_part" "$frac" + } + + for app in "${app_variants[@]}"; do + start="${app}_START" + end="${app}_END" + # skip if missing + [[ -z "${!start-}" ]] && continue + [[ -z "${!end-}" ]] && continue + + dur=$(duration_seconds "$start" "$end") + printf 'Duration for %s: ' "$app" + pretty_diff "$dur" + + # determine base name (before first underscore) + base_name="$app" + if [[ "$app" == *"_"* ]]; then + base_name="${app%%_*}" + fi + + # skip comparison when this is the base itself + if [[ "$app" == "$base_name" ]]; then + # nothing to compare to + continue + fi + + base_start="${base_name}_START" + base_end="${base_name}_END" + + if [[ -z "${!base_start-}" || -z "${!base_end-}" ]]; then + printf ' Base (%s) missing START/END — cannot compute percent change.\n' "$base_name" + continue + fi + + base_dur=$(duration_seconds "$base_start" "$base_end") + pc=$(percent_change_one_decimal "$base_dur" "$dur") + + if [[ "$pc" == "N/A" ]]; then + printf ' Percent change vs %s: N/A (base duration is zero)\n' "$base_name" + continue + fi + + if [[ "$pc" == "+0.0%" || "$pc" == "0.0%" ]]; then + printf ' Percent change vs %s: 0.0%% (equal)\n' "$base_name" + else + if (( dur < base_dur )); then + label="improved" + elif (( dur > base_dur )); then + label="slower" + else + label="equal" + fi + printf ' Percent change vs %s: %s (%s)\n' "$base_name" "$pc" "$label" + fi + done + benchmark_sample_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: SampleApp + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/bitrise-io/sample-apps-ios-swiftpm + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - change-workdir: + title: Switch working dir to _tmp + inputs: + - path: ./sample-swiftpm4 + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: sample-swiftpm2.xcodeproj + - scheme: sample-swiftpm2 + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_sample_build_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: SampleApp_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/bitrise-io/sample-apps-ios-swiftpm + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - change-workdir: + title: Switch working dir to _tmp + inputs: + - path: ./sample-swiftpm4 + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: sample-swiftpm2.xcodeproj + - scheme: sample-swiftpm2 + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_sample_build_spm_explicit: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: SampleApp_SPM_Explicit + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/bitrise-io/sample-apps-ios-swiftpm + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - change-workdir: + title: Switch working dir to _tmp + inputs: + - path: ./sample-swiftpm4 + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: sample-swiftpm2.xcodeproj + - scheme: sample-swiftpm2 + - configuration: Debug + - xcodebuild_options: -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + -SWIFT_ENABLE_EXPLICIT_MODULES=YES + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_tuist_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: Tuist + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:tuist/tuist.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Generate workspace + inputs: + - content: |- + set -exo pipefail + tuist install + tuist generate + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Tuist.xcworkspace + - scheme: TuistApp + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -skipMacroValidation + -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_tuist_build_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Tuist_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:tuist/tuist.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Generate workspace + inputs: + - content: |- + set -exo pipefail + tuist install + tuist generate + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Tuist.xcworkspace + - scheme: TuistApp + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -skipMacroValidation + -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_tuist_build_dd_cc: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Tuist_DD_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:tuist/tuist.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Generate workspace + inputs: + - content: |- + set -exo pipefail + tuist install + tuist generate + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Tuist.xcworkspace + - scheme: TuistApp + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -skipMacroValidation + -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_tuist_build_dd_spm_cc: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Tuist_DD_SPM_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:tuist/tuist.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Generate workspace + inputs: + - content: |- + set -exo pipefail + tuist install + tuist generate + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Tuist.xcworkspace + - scheme: TuistApp + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -skipMacroValidation + -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_tuist_build_spm_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Tuist_SPM_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: git@github.com:tuist/tuist.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Generate workspace + inputs: + - content: |- + set -exo pipefail + tuist install + tuist generate + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: Tuist.xcworkspace + - scheme: TuistApp + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -skipMacroValidation + -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_vlc_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: VLC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://code.videolan.org/videolan/vlc-ios.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + + gem install cocoapods + pod install + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: VLC.xcworkspace + - scheme: VLC-iOS + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_vlc_build_baseline_16_4: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: VLC_16_4 + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://code.videolan.org/videolan/vlc-ios.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + + gem install cocoapods + pod install + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: VLC.xcworkspace + - scheme: VLC-iOS + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-16.4.x + benchmark_vlc_build_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: VLC_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://code.videolan.org/videolan/vlc-ios.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + gem install cocoapods + pod install + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: VLC.xcworkspace + - scheme: VLC-iOS + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_vlc_build_cc_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: VLC_CC_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://code.videolan.org/videolan/vlc-ios.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + gem install cocoapods + pod install + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: VLC.xcworkspace + - scheme: VLC-iOS + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_vlc_build_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: VLC_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://code.videolan.org/videolan/vlc-ios.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + gem install cocoapods + pod install + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: VLC.xcworkspace + - scheme: VLC-iOS + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_vlc_build_spm_16_4: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: VLC_SPM_16_4 + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://code.videolan.org/videolan/vlc-ios.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + gem install cocoapods + pod install + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: VLC.xcworkspace + - scheme: VLC-iOS + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-16.4.x + benchmark_wordpress_analyze_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_Analyze + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-analyze: + inputs: + - workdir: . + - project_path: WordPress.xcworkspace + - scheme: WordPress + - cache_level: none + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_analyze_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_Analyze_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-analyze: + inputs: + - workdir: . + - project_path: WordPress.xcworkspace + - scheme: WordPress + - cache_level: none + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_analyze_cc_dd: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_Analyze_CC_DD + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-analyze: + inputs: + - workdir: . + - project_path: WordPress.xcworkspace + - scheme: WordPress + - cache_level: none + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_analyze_cc_dd_spm: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_Analyze_CC_DD_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-analyze: + inputs: + - workdir: . + - project_path: WordPress.xcworkspace + - scheme: WordPress + - cache_level: none + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_analyze_cc_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_Analyze_CC_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-analyze: + inputs: + - workdir: . + - project_path: WordPress.xcworkspace + - scheme: WordPress + - cache_level: none + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_analyze_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_Analyze_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-analyze: + inputs: + - workdir: . + - project_path: WordPress.xcworkspace + - scheme: WordPress + - cache_level: none + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_baseline_16_4: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_16.4 + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-16.4.x + benchmark_wordpress_build_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_cc_dd: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_CC_DD + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_cc_dd_spm: + envs: + - USE_DD_CACHE: "true" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_CC_DD_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_cc_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_CC_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_spm: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_spm_16_4: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_16.4_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-16.4.x + benchmark_wordpress_build_spm_explicit: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_Explicit_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO SWIFT_ENABLE_EXPLICIT_MODULES=YES + -resultBundlePath "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_build_spm_invalidpackage: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "true" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_SPM + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - restore-cache: + inputs: + - verbose: "true" + - key: 'darwin-arm64-spm-cache-WordPress_Explicit_SPM-ad8a2f69b293638b5ad9118881681f7a94a6dfb0b3f68de7c5210f26929bc400' + - script: + title: Remove alamofire to make SPM invalid + inputs: + - content: |- + #!/usr/bin/env bash + set -euo pipefail + + # Directory containing Package.swift and Package.resolved + TARGET_DIR="Modules" + + # Name to remove (case-insensitive) + PKG_NAME="alamofire" + + # Files (within TARGET_DIR) + PKG_SWIFT="Package.swift" + PKG_RESOLVED="Package.resolved" + + # Check target dir exists + if [ ! -d "$TARGET_DIR" ]; then + echo "Error: target directory '$TARGET_DIR' not found in $(pwd)" >&2 + exit 1 + fi + + # Enter target dir + pushd "$TARGET_DIR" >/dev/null + + # Ensure files exist + if [ ! -f "$PKG_SWIFT" ]; then + echo "Error: $PKG_SWIFT not found in $(pwd)" >&2 + popd >/dev/null + exit 1 + fi + if [ ! -f "$PKG_RESOLVED" ]; then + echo "Error: $PKG_RESOLVED not found in $(pwd)" >&2 + popd >/dev/null + exit 1 + fi + + # Check jq available + if ! command -v jq >/dev/null 2>&1; then + echo "Error: jq is required but not found. Install with 'brew install jq' or your package manager." >&2 + popd >/dev/null + exit 1 + fi + + # Backups + ts=$(date +%Y%m%d%H%M%S) + cp "$PKG_SWIFT" "${PKG_SWIFT}.bak.${ts}" + cp "$PKG_RESOLVED" "${PKG_RESOLVED}.bak.${ts}" + echo "Backups created in $TARGET_DIR: ${PKG_SWIFT}.bak.${ts}, ${PKG_RESOLVED}.bak.${ts}" + + # Build bracketed case-insensitive pattern for sed + PATTERN="" + for c in $(echo "$PKG_NAME" | fold -w1); do + lc=$(echo "$c" | tr '[:upper:]' '[:lower:]') + uc=$(echo "$c" | tr '[:lower:]' '[:upper:]') + PATTERN="${PATTERN}[${uc}${lc}]" + done + + # Remove dependency line from Package.swift (single-line assumption) + # Use portable sed handling for GNU and BSD + if sed --version >/dev/null 2>&1; then + # GNU sed + sed -i.bak_pkg_swift "/$PATTERN/d" "$PKG_SWIFT" + rm -f "${PKG_SWIFT}.bak_pkg_swift" + else + # BSD sed (macOS) + sed -i .bak_pkg_swift "/$PATTERN/d" "$PKG_SWIFT" + rm -f "${PKG_SWIFT}.bak_pkg_swift" + fi + + echo "Removed lines matching '$PKG_NAME' from $PKG_SWIFT (if any)." + + # Remove pin from Package.resolved (newer Xcode format: top-level "pins") + PKG_LC=$(printf '%s' "$PKG_NAME" | tr '[:upper:]' '[:lower:]') + + jq --arg name "$PKG_LC" '(.pins) |= map(select((.identity // "" | ascii_downcase) != $name))' \ + "$PKG_RESOLVED" > "${PKG_RESOLVED}.tmp" + + # verify jq output is valid JSON before replacing + if jq empty "${PKG_RESOLVED}.tmp" >/dev/null 2>&1; then + mv "${PKG_RESOLVED}.tmp" "$PKG_RESOLVED" + echo "Updated $PKG_RESOLVED (removed pins with identity == '$PKG_NAME' case-insensitively)." + else + echo "Error: jq produced invalid JSON; leaving original $PKG_RESOLVED in place." >&2 + rm -f "${PKG_RESOLVED}.tmp" + popd >/dev/null + exit 1 + fi + + # Quick checks + echo + echo "Quick checks (in $TARGET_DIR):" + echo "- Validate Package.resolved JSON (first 200 lines):" + jq . "$PKG_RESOLVED" | sed -n '1,200p' + echo + echo "- Look for any remaining identities matching '$PKG_NAME' (case-insensitive):" + if jq -r '.pins[]?.identity // empty' "$PKG_RESOLVED" | grep -i -E "$PKG_NAME" >/dev/null 2>&1; then + echo "Warning: found remaining matches in Package.resolved" + jq -r '.pins[]?.identity // empty' "$PKG_RESOLVED" | grep -i -E "$PKG_NAME" || true + else + echo "No remaining matches for '$PKG_NAME' in Package.resolved" + fi + + # Return to original dir + popd >/dev/null + + echo + echo "Done. If anything looks wrong, restore backups located at:" + echo " ${TARGET_DIR}/${PKG_SWIFT}.bak.${ts}" + echo " ${TARGET_DIR}/${PKG_RESOLVED}.bak.${ts}" + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - script: + title: Print SourcePackages + inputs: + - content: |- + for sp in ~/Library/Developer/Xcode/DerivedData/*/SourcePackages; do + [ -d "$sp" ] || continue + echo "=== $sp ===" + tree -L 2 "$sp" + ls -hal "$sp" + echo "workspace state sha1: $(cat "$sp/workspace-state.json" | sha1sum)" + cat "$sp/workspace-state.json" | jq '{dependencies: [.object.dependencies[].subpath],artifacts: [.object.artifacts[].targetName]}' + done + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: false + - USE_SPM: false + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_random_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: WordPress_Random + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Random checkout + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + # produce a numeric seed from the slug (sha1 -> hex -> decimal bytes) + seed_hex=$(printf '%s' "$BITRISE_BUILD_SLUG" | sha1sum | awk '{print $1}') + # turn hex into raw bytes for --random-source + seed_bytes=$(printf '%s' "$seed_hex" | xxd -r -p) + + # pick a commit deterministically + commit=$(git rev-list --max-count=30 HEAD | shuf -n1 --random-source=<(printf '%s' "$seed_bytes")) + git checkout "$commit" + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_wordpress_random_build_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: WordPress_Random_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/wordpress-mobile/WordPress-iOS.git + - BRANCH: trunk + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Random checkout + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + # pick a random commit from the last 30 commits (or fewer if repo has fewer) + commit=$(git rev-list --max-count=30 HEAD | shuf -n1) + git checkout "$commit" + - script: + title: Install dependencies + inputs: + - content: |- + set -exo pipefail + asdf install ruby 3.2.2 + asdf global ruby 3.2.2 + + mv WordPress/Credentials/Secrets-example.swift WordPress/Credentials/Secrets.swift + mkdir -p ~/DerivedData/Wordpress + rake dependencies + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - xcode-build-for-simulator: + inputs: + - project_path: WordPress.xcworkspace + - scheme: WordPress + - configuration: Debug + - xcodebuild_options: CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath + "$BITRISE_DEPLOY_DIR/$BENCHMARK_APP_NAME.xcresult" + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_doddle_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: Doddle + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/NaserElziadna/doddle.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - SILENT: "true" + - script: + title: Install dependencies + inputs: + - content: |- + asdf install ruby 3.4.6 + asdf global ruby 3.4.6 + # flutter upgrade + gem install cocoapods + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + flutter pub get + + cat < ios/Podfile + + platform :ios, '13.0' + # CocoaPods analytics sends network stats synchronously affecting flutter build latency. + ENV['COCOAPODS_DISABLE_STATS'] = 'true' + project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, + } + def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" + end + require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + flutter_ios_podfile_setup + target 'Runner' do + use_frameworks! + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + end + post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + target.build_configurations.each do |config| + config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' + end + end + end + EOF + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Build + inputs: + - content: |- + flutter build ios --debug --no-codesign + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_doddle_build_cc: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Doddle_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/NaserElziadna/doddle.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - SILENT: "true" + - script: + title: Install dependencies + inputs: + - content: |- + asdf install ruby 3.4.6 + asdf global ruby 3.4.6 + # flutter upgrade + gem install cocoapods + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + flutter pub get + + cat < ios/Podfile + + platform :ios, '13.0' + # CocoaPods analytics sends network stats synchronously affecting flutter build latency. + ENV['COCOAPODS_DISABLE_STATS'] = 'true' + project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, + } + def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" + end + require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + flutter_ios_podfile_setup + target 'Runner' do + use_frameworks! + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + end + post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + target.build_configurations.each do |config| + config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' + end + end + end + EOF + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Build + inputs: + - content: |- + flutter build ios --debug --no-codesign + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_doddle_build_cc_random: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "true" + - BENCHMARK_APP_NAME: Doddle_Random_CC + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/NaserElziadna/doddle.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - SILENT: "true" + - script: + title: Random checkout + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + # produce a numeric seed from the slug (sha1 -> hex -> decimal bytes) + seed_hex=$(printf '%s' "$BITRISE_BUILD_SLUG" | sha1sum | awk '{print $1}') + # turn hex into raw bytes for --random-source + seed_bytes=$(printf '%s' "$seed_hex" | xxd -r -p) + + # pick a commit deterministically + commit=$(git rev-list --max-count=30 HEAD | shuf -n1 --random-source=<(printf '%s' "$seed_bytes")) + git checkout "$commit" + - script: + title: Install dependencies + inputs: + - content: |- + asdf install ruby 3.4.6 + asdf global ruby 3.4.6 + # flutter upgrade + gem install cocoapods + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + flutter pub get + + cat < ios/Podfile + + platform :ios, '13.0' + # CocoaPods analytics sends network stats synchronously affecting flutter build latency. + ENV['COCOAPODS_DISABLE_STATS'] = 'true' + project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, + } + def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" + end + require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + flutter_ios_podfile_setup + target 'Runner' do + use_frameworks! + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + end + post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + target.build_configurations.each do |config| + config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' + end + end + end + EOF + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Build + inputs: + - content: |- + flutter build ios --debug --no-codesign + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_fluffychat_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: FluffyChat + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/krille-chan/fluffychat.git + - BRANCH: main + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - SILENT: "true" + - script: + title: Install dependencies + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + export PATH="$HOME/.cargo/bin:$PATH" + envman add --key PATH --value "$PATH" + rustup target add aarch64-apple-ios + + flutter upgrade + flutter pub get + + cat << EOPATCH | patch --forward --reject-file=apple_please_fix_your_coreutils ios/Podfile + diff --git a/ios/Podfile b/ios/Podfile + index 9411102b..0446120a 100644 + --- a/ios/Podfile + +++ b/ios/Podfile + @@ -37,5 +37,8 @@ end + post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + + target.build_configurations.each do |config| + + config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' + + end + end + end + EOPATCH + rm -f apple_please_fix_your_coreutils + + sed -i '' "/config\.build_settings\[[[:space:]]*'IPHONEOS_DEPLOYMENT_TARGET'[[:space:]]*\][[:space:]]*=[[:space:]]*'11\.0'/d" ios/Podfile + + cat ios/Podfile + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Build + inputs: + - content: |- + flutter build ipa -v --debug --no-codesign &> $BITRISE_DEPLOY_DIR/build.log + tail -n 300 $BITRISE_DEPLOY_DIR/build.log + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + benchmark_rustdesk_build_baseline: + envs: + - USE_DD_CACHE: "false" + - USE_SPM: "false" + - USE_COMP_CACHE: "false" + - BENCHMARK_APP_NAME: RustDesk + steps: + - bundle::benchmark-setup: + inputs: + - REPO_URL: https://github.com/rustdesk/rustdesk.git + - BRANCH: master + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - USE_COMP_CACHE: $USE_COMP_CACHE + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - SILENT: "true" +# - change-workdir: +# inputs: +# - path: flutter + - script: + title: Install dependencies + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + export PATH="$HOME/.cargo/bin:$PATH" + envman add --key PATH --value "$PATH" + rustup target add aarch64-apple-ios + flutter upgrade + + cat << EOPATCH | patch --forward flutter/ios/Podfile + diff --git a/ios/Podfile b/ios/Podfile + index 9411102b..0446120a 100644 + --- a/ios/Podfile + +++ b/ios/Podfile + @@ -37,5 +37,8 @@ end + post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + + target.build_configurations.each do |config| + + config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' + + end + end + end + EOPATCH + + sed -i '' "/config\.build_settings\[[[:space:]]*'IPHONEOS_DEPLOYMENT_TARGET'[[:space:]]*\][[:space:]]*=[[:space:]]*'11\.0'/d" flutter/ios/Podfile + + cat flutter/ios/Podfile + - bundle::benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + - script: + title: Build + inputs: + - content: |- + cargo build --features flutter,hwcodec --target aarch64-apple-ios --lib &> $BITRISE_DEPLOY_DIR/rustdesk_build.log + tail -n 100 $BITRISE_DEPLOY_DIR/rustdesk_build.log + - bundle::benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + - USE_SPM: $USE_SPM + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + e2e-xcode-comp-cache: + envs: + - TEST_APP_URL: git@github.com:bitrise-io/swift-composable-architecture.git + - COMMIT: 27db3dfc9f55c206e09ca2a51b93bd600a56429e + steps: + - bundle::feature-e2e-setup: {} + - script: + title: activate xcode using CLI + inputs: + - content: |- + #!/usr/bin/env bash + set -eo pipefail + + echo "Original Xcodebuild command location:" + type xcodebuild || true + + # Add --xcode-path /usr/bin/xcodebuild to test xcode path override (for local) + ../bitrise-build-cache-cli -d activate xcode \ + --cache + - script: + title: build app + inputs: + - content: |- + echo "Xcodebuild command location after activation:" + type xcodebuild || true + + echo "Config file content:" + cat "$HOME/.bitrise-xcelerate/config.json" + + echo "Starting build..." + xcodebuild build \ + -workspace ComposableArchitecture.xcworkspace \ + -scheme ComposableArchitecture \ + -destination "generic/platform=iOS" \ + -skipMacroValidation 2> wrapper.log | tee xcodebuild.log | xcpretty + - script: + title: gather info + inputs: + - content: |- + set -exo pipefail + + cp ~/.bitrise-xcelerate/config.json $BITRISE_DEPLOY_DIR + cp ~/.local/state/xcelerate/logs/* $BITRISE_DEPLOY_DIR + cp xcodebuild.log $BITRISE_DEPLOY_DIR + cp wrapper.log $BITRISE_DEPLOY_DIR + + cat "$BITRISE_DEPLOY_DIR/wrapper.log" + head -n 20 $BITRISE_DEPLOY_DIR/xcodebuild.log + tail -n 20 $BITRISE_DEPLOY_DIR/xcodebuild.log + + source ../_e2e/scripts/error.sh + source ../_e2e/scripts/extract_invocation_id.sh + + invocation_id=$(extract_invocation_id_xcode "$BITRISE_DEPLOY_DIR/wrapper.log") + if [[ -z "$invocation_id" ]]; then + fatal "Invocation ID not found in logs" + fi + + echo "Found Invocation ID: $invocation_id" + envman add --key INVOCATION_ID --value "$invocation_id" + - script: + title: Assert invocation from API + inputs: + - content: |- + source ../_e2e/scripts/assert_invocations.sh + + assert_bitrise_invocation_in_list "$INVOCATION_ID" "xcode" + assert_bitrise_invocation_detail "$INVOCATION_ID" "xcode" + assert_build_performance "$INVOCATION_ID" + assert_invocation_in_build_performance "$INVOCATION_ID" "xcode" + - script: + title: Check for cache usage + inputs: + - content: |- + set -exo pipefail + + ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/xcodebuild.log" 'CompilationCacheMetrics' + - deploy-to-bitrise-io: {} + meta: + bitrise.io: + machine_type_id: g2.mac.large + stack: osx-xcode-26.0.x-edge + feature-e2e-bazel-bitrisedc-no-rbe: + envs: + - TEST_APP_URL: git@github.com:bitrise-io/bazel.git + - BRANCH: master + steps: + - bundle::feature-e2e-setup: {} + - apt-get-install: + inputs: + - packages: bc + - upgrade: "no" + - script@1: + title: Install bazel + inputs: + - content: | + #!/usr/bin/env bash + set -exo pipefail + ../scripts/install_bazel.sh + - script: + title: Enable build cache + inputs: + - content: |- + set -exo pipefail + ../bitrise-build-cache-cli activate bazel -d --cache --cache-push --bes --timestamps + - script: + title: Build and capture logs + inputs: + - content: |- + set -exo pipefail + (/usr/local/bin/bazel build //src:bazel-dev --announce_rc --copt='-w' 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + - script: + title: Check for cache invocations + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ + '--remote_cache=grpcs:\/\/bitrise-accelerate\.services\.bitrise\.io' \ + 'Invocation ID: ' \ + '--bes_header=x-os=Linux' \ + '--bes_header=x-cpu-cores=[0-9]+' \ + '--bes_header=x-mem-size=[0-9]+' \ + '--bes_header=x-ci-provider=bitrise' \ + "--bes_header=x-app-id=$BITRISE_APP_SLUG" \ + '--bes_header=x-locale=\w+' \ + '--bes_header=x-default-charset=\w+' + + source ../_e2e/scripts/extract_invocation_id.sh + + invocation_id=$(extract_invocation_id_bazel "$BITRISE_DEPLOY_DIR/logs.txt") + if [[ -z "$invocation_id" ]]; then + fatal "Invocation ID not found in logs" + fi + + echo "Found Invocation ID: $invocation_id" + envman add --key INVOCATION_ID --value "$invocation_id" + - script: + title: Assert invocation from API + inputs: + - content: |- + source ../_e2e/scripts/assert_invocations.sh + + assert_bitrise_invocation_in_list "$INVOCATION_ID" "bazel" + assert_bitrise_invocation_detail "$INVOCATION_ID" "bazel" + assert_invocation_targets_bazel "$INVOCATION_ID" + assert_build_performance "$INVOCATION_ID" + assert_invocation_in_build_performance "$INVOCATION_ID" "bazel" + - deploy-to-bitrise-io@2: {} + meta: + bitrise.io: + machine_type_id: g2.linux.medium + stack: linux-docker-android-22.04 + feature-e2e-bazel-public-no-rbe: + envs: + - TEST_APP_URL: git@github.com:bitrise-io/bazel.git + - BRANCH: master + steps: + - bundle::feature-e2e-setup: {} + - apt-get-install: + inputs: + - packages: bc dnsutils iputils-ping + - upgrade: "no" + - script: + title: Enable build cache + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + echo "Bitrise step ID: $BITRISE_STEP_EXECUTION_ID" + ../bitrise-build-cache-cli activate bazel -d --cache --cache-push --bes --timestamps + - script: + title: Build and capture logs using Docker + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + mkdir -p ../_dockerroot + cp -r $HOME/.bazelrc ../_dockerroot/.bazelrc + + echo ${DOCKER_SHARED_PASSWORD} | docker login --username bitrisedev --password-stdin + + sudo docker run --rm \ + -w "/workspace" \ + -e "BITRISE_APP_SLUG=$BITRISE_APP_SLUG" \ + -e "BITRISE_BUILD_SLUG=$BITRISE_BUILD_SLUG" \ + -e "BITRISE_STEP_EXECUTION_ID=$BITRISE_STEP_EXECUTION_ID" \ + -e "BITRISE_TRIGGERED_WORKFLOW_TITLE=$BITRISE_TRIGGERED_WORKFLOW_TITLE" \ + -e "GIT_REPOSITORY_UR=$GIT_REPOSITORY_URL" \ + -e "BITRISE_GIT_COMMIT=$BITRISE_GIT_COMMIT" \ + --mount "type=bind,source=$PWD,target=/workspace" \ + --mount "type=bind,source=$(readlink -f ../_dockerroot)/.bazelrc,target=/root/.bazelrc,ro" \ + --mount "type=bind,source=$BITRISE_DEPLOY_DIR,target=/bitrise-deploy" \ + ubuntu:22.04 \ + bash -c "set -o pipefail; apt-get update && apt-get install -y curl build-essential xz-utils zip unzip python3 && \ + curl -Lo bazelisk https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 && \ + chmod +x bazelisk && \ + ./bazelisk build //src:bazel-dev --announce_rc --copt='-w' 2>&1 | tee /bitrise-deploy/logs.txt" + - script: + title: Check for cache invocations + inputs: + - content: |- + #!/bin/bash + set -exo pipefail + + ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ + '--remote_cache=grpcs:\/\/bitrise-accelerate\.services\.bitrise\.io' \ + 'Invocation ID: ' \ + '--bes_header=x-os=Linux' \ + '--bes_header=x-cpu-cores=[0-9]+' \ + '--bes_header=x-mem-size=[0-9]+' \ + '--bes_header=x-ci-provider=bitrise' \ + "--bes_header=x-app-id=$BITRISE_APP_SLUG" \ + '--bes_header=x-locale=\w+' \ + '--bes_header=x-default-charset=\w+' + + source ../_e2e/scripts/extract_invocation_id.sh + + invocation_id=$(extract_invocation_id_bazel "$BITRISE_DEPLOY_DIR/logs.txt") + if [[ -z "$invocation_id" ]]; then + fatal "Invocation ID not found in logs" + fi + + echo "Found Invocation ID: $invocation_id" + envman add --key INVOCATION_ID --value "$invocation_id" + - script: + title: Assert invocation from API + inputs: + - content: |- + source ../_e2e/scripts/assert_invocations.sh + + assert_bitrise_invocation_in_list "$INVOCATION_ID" "bazel" + assert_bitrise_invocation_detail "$INVOCATION_ID" "bazel" + assert_invocation_targets_bazel "$INVOCATION_ID" + assert_build_performance "$INVOCATION_ID" + assert_invocation_in_build_performance "$INVOCATION_ID" "bazel" + - deploy-to-bitrise-io@2: {} + meta: + bitrise.io: + machine_type_id: g2.linux.medium + stack: linux-docker-android-22.04 + feature-e2e-gradle-bitwarden: envs: - - GITHUB_TOKEN: $GIT_BOT_USER_ACCESS_TOKEN + - TEST_APP_URL: git@github.com:bitwarden/android.git + - COMMIT: 2c71ab7d27d7f976766adee7bfd1828d5eda0850 steps: - - activate-ssh-key@4: - run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - - git-clone@8: + - bundle::feature-e2e-setup: {} + - apt-get-install: inputs: - - fetch_tags: "yes" - - script@1: - title: asdf use latest go + - packages: bc + - upgrade: "no" + - script: + title: Enable build cache inputs: - content: |- - #!/usr/bin/env bash - - asdf install golang 1.24.3 - asdf global golang 1.24.3 + set -exo pipefail + ../bitrise-build-cache-cli activate gradle -d --cache - script: - title: Install Goreleaser + title: Print ~/.init.d/bitrise-build-cache.init.gradle.kts inputs: - - content: | - #!/usr/bin/env bash - set -ex - - GOBIN=/usr/local/bin/ go install github.com/goreleaser/goreleaser/v2@latest - - bundle::generate_gradle_verification_reference: { } - - bundle::check_gradle_verification_reference: { } + - content: cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts - script: - title: Goreleaser (create binaries + publish to GH) - deps: - brew: - - name: goreleaser + title: Create local configuration cache inputs: - - content: | - #!/usr/bin/env bash - set -ex - - goreleaser release + - content: |- + set -exo pipefail + ./gradlew debug --configuration-cache --dry-run --info --stacktrace - script: - title: Authenticate to GCP + title: Save configuration cache inputs: - - content: |- - #!/bin/bash - set -euxo pipefail - KEY_FILE_PATH=$(mktemp -d)/keyfile.json - echo "${GAR_SERVICE_ACCOUNT_B64}" | base64 --decode > ${KEY_FILE_PATH} - gcloud auth activate-service-account --key-file=${KEY_FILE_PATH} + - content: |- + set -exo pipefail + ../bitrise-build-cache-cli save-gradle-configuration-cache \ + --config-cache-dir "$PWD/.gradle/configuration-cache" \ + --key "cli-bitwarden-test" - script: - title: Upload release artifacts to GAR + title: Delete local configuration cache inputs: - content: |- - #!/usr/bin/env bash - set -eo pipefail - - DIST_DIR="dist" - if [[ ! -d "$DIST_DIR" ]]; then - echo "Directory $DIST_DIR does not exist." - exit 1 - fi - tree -L 2 dist - - tag="${BITRISE_GIT_TAG#v}" # Remove the v from the tag - if [[ -z "$tag" ]]; then - echo "BITRISE_GIT_TAG is not set. Exiting." - exit 1 - fi - - echo "Uploading with tag: $tag" - - filenames=("bitrise-build-cache_${tag}_darwin_amd64.tar.gz" - "bitrise-build-cache_${tag}_linux_amd64.tar.gz" - "bitrise-build-cache_${tag}_darwin_arm64.tar.gz" - "bitrise-build-cache_${tag}_linux_arm64.tar.gz") - for filename in "${filenames[@]}"; do - if [[ ! -f "$DIST_DIR/$filename" ]]; then - echo "File $DIST_DIR/$filename does not exist." - exit 1 - fi - echo "Uploading $filename to GAR..." - - package_name="${filename/_${tag}/}" # Files will be versioned - - gcloud artifacts generic upload \ - --project=ip-build-cache-prod \ - --source="$DIST_DIR/$filename" \ - --package="$package_name" \ - --version="$tag" \ - --location=us-central1 \ - --repository=build-cache-cli-releases - done - - echo "Uploaded artifacts to GAR." - - deploy-to-bitrise-io@2: {} + set -exo pipefail + rm -rf .gradle/configuration-cache - script: - title: Update step + title: Restore configuration cache inputs: - - content: | - #!/usr/bin/env bash - set -ex - - ./scripts/update_step.sh - - slack@4: + - content: |- + set -exo pipefail + ../bitrise-build-cache-cli restore-gradle-configuration-cache \ + --key "cli-bitwarden-test" + - script: + title: Build and capture logs inputs: - - channel: "#team-advanced-ci-alerts-website" - - text: |- - Build Cache for Gradle step update PR is ready! :tada: :rocket: :bitrise: - - Check PR here: $PR_URL - - emoji: ":gradle:" - - color: "#08a045" - - webhook_url: "$SLACK_WEBHOOK_ALERTS" - title: Send slack if PR opened - run_if: '{{ getenv "PR_URL" | ne "" }}' - - slack@4: + - content: |- + set -exo pipefail + (./gradlew debug --configuration-cache --info --stacktrace 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + - script: + title: Check for cache invocations inputs: - - channel: "#team-advanced-ci-alerts-website" - - text: |- - CLI release failed! :gopher_lift: :rotating_light: + - content: "set -exo pipefail\n\n../scripts/check_pattern.sh \"$BITRISE_DEPLOY_DIR/logs.txt\" + \\\n 'Reusing configuration cache.' \\\n '\\[Bitrise Build Cache\\].*\U0001F916 + Bitrise remote cache enabled' \\\n '\\[Bitrise Build Cache\\].*Request + metadata invocationId' \\\n '\\[Bitrise Analytics\\].*\U0001F916 Bitrise + analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'\n\nsource + ../_e2e/scripts/extract_invocation_id.sh\n\ninvocation_id=$(extract_invocation_id_gradle + \"$BITRISE_DEPLOY_DIR/logs.txt\")\nif [[ -z \"$invocation_id\" ]]; then\n + \ fatal \"Invocation ID not found in logs\"\nfi\n\necho \"Found Invocation + ID: $invocation_id\"\nenvman add --key INVOCATION_ID --value \"$invocation_id\"" + - script: + title: Assert invocation from API + inputs: + - content: |- + source ../_e2e/scripts/assert_invocations.sh - Check build here: $BITRISE_BUILD_URL - - emoji: ":rotating_light:" - - color: "#ee003b" - - webhook_url: "$SLACK_WEBHOOK_ALERTS" - title: Send slack if failed - run_if: ".IsBuildFailed" - meta: - bitrise.io: - machine_type_id: g2.mac.medium - stack: osx-xcode-edge - test: + assert_bitrise_invocation_in_list "$INVOCATION_ID" "gradle" + assert_bitrise_invocation_detail "$INVOCATION_ID" "gradle" + assert_invocation_tasks_gradle "$INVOCATION_ID" + assert_build_performance "$INVOCATION_ID" + assert_invocation_in_build_performance "$INVOCATION_ID" "gradle" + - deploy-to-bitrise-io@2: {} + feature-e2e-gradle-duckduck: + envs: + - TEST_APP_URL: git@github.com:duckduckgo/Android.git + - BRANCH: develop steps: - - activate-ssh-key@4: - run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - - git-clone@8: {} - - go-list@1: {} - - script@1: - title: golangci-lint + - bundle::feature-e2e-setup: {} + - apt-get-install: + inputs: + - packages: bc + - upgrade: "no" + - script: + title: Enable build cache inputs: - content: |- - #!/bin/bash - set -ex - make lint - - go-test@1: {} - - bundle::generate_gradle_verification_reference: { } - - bundle::check_gradle_verification_reference: { } - - deploy-to-bitrise-io@2: + set -exo pipefail + ../bitrise-build-cache-cli activate gradle -d --cache + - script: + title: Print ~/.init.d/bitrise-build-cache.init.gradle.kts inputs: - - deploy_path: "$GRADLE_VERIFICATION_REF_TARGET_PATH" - meta: - bitrise.io: - machine_type_id: g2.mac.medium - stack: osx-xcode-edge - - generate_gradle_verification: - steps: - - bundle::generate_gradle_verification_reference: { } + - content: cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts + - script: + title: Build and capture logs + inputs: + - content: |- + set -exo pipefail + (./gradlew debug --info --stacktrace 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + - script: + title: Check for cache invocations + inputs: + - content: "set -exo pipefail\n\n../scripts/check_pattern.sh \"$BITRISE_DEPLOY_DIR/logs.txt\" + \\\n '\\[Bitrise Build Cache\\].*\U0001F916 Bitrise remote cache enabled' + \\\n '\\[Bitrise Build Cache\\].*Request metadata invocationId' \\\n + \ '\\[Bitrise Analytics\\].*\U0001F916 Bitrise analytics enabled for tasks.*Invocation + ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'\n\nsource + ../_e2e/scripts/extract_invocation_id.sh\n\ninvocation_id=$(extract_invocation_id_gradle + \"$BITRISE_DEPLOY_DIR/logs.txt\")\nif [[ -z \"$invocation_id\" ]]; then\n + \ fatal \"Invocation ID not found in logs\"\nfi\n\necho \"Found Invocation + ID: $invocation_id\"\nenvman add --key INVOCATION_ID --value \"$invocation_id\"" + - script: + title: Assert invocation from API + inputs: + - content: |- + source ../_e2e/scripts/assert_invocations.sh + assert_bitrise_invocation_in_list "$INVOCATION_ID" "gradle" + assert_bitrise_invocation_detail "$INVOCATION_ID" "gradle" + assert_invocation_tasks_gradle "$INVOCATION_ID" + assert_build_performance "$INVOCATION_ID" + assert_invocation_in_build_performance "$INVOCATION_ID" "gradle" + - deploy-to-bitrise-io@2: {} generate_and_commit_dependency_matrix: steps: - activate-ssh-key@4: run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - git-clone@8: inputs: - - fetch_tags: "yes" - - shallow_clone: "false" - - clone_depth: "-1" + - fetch_tags: "yes" + - shallow_clone: "false" + - clone_depth: "-1" - bundle::generate_and_commit_dependency_matrix: {} - slack@4: - inputs: - - channel: "#team-advanced-ci-alerts-website" - - text: |- - Dependency matrix generation failed! :matrix-code: :rotating_light: - - Check build here: $BITRISE_BUILD_URL - - emoji: ":rotating_light:" - - color: "#ee003b" - - webhook_url: "$SLACK_WEBHOOK_ALERTS" title: Send slack if failed - run_if: ".IsBuildFailed" - - update_plugins: - envs: - - GITHUB_TOKEN: $GIT_BOT_USER_ACCESS_TOKEN + run_if: .IsBuildFailed + inputs: + - channel: '#team-advanced-ci-alerts-website' + - text: |- + Dependency matrix generation failed! :matrix-code: :rotating_light: + + Check build here: $BITRISE_BUILD_URL + - emoji: ':rotating_light:' + - color: '#ee003b' + - webhook_url: $SLACK_WEBHOOK_ALERTS + generate_gradle_verification: steps: - - activate-ssh-key@4: - run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - - git-clone@8: - inputs: - - fetch_tags: "yes" - - shallow_clone: "false" - - clone_depth: "-1" - - apt-get-install: - inputs: - - packages: libxml2-utils - - script: - title: Ensure we're on main - inputs: - - content: | - #!/bin/bash - set -ex - - git fetch origin - if [[ "$BITRISE_GIT_BRANCH" != "main" ]]; then - git checkout main - git pull origin main - fi - - script: - title: Update plugins with latest version - inputs: - - content: | - bash ./scripts/update_plugins.sh - - bundle::generate_gradle_verification_reference: {} - - script: - title: Commit updated plugins and open PR - inputs: - - content: | - set -ex - - # Check for existing PR with the same title - existing_pr=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ - "https://api.github.com/repos/bitrise-io/bitrise-build-cache-cli/pulls?state=open" | jq -r ".[] | select(.title == \"chore: Update Gradle plugins\") | .html_url") - - if [ -n "$existing_pr" ]; then - echo "A pull request with this title already exists: $existing_pr" - exit 0 - fi - - if [ -n "$(git status --porcelain)" ]; then - git branch -D update-plugins || true - git checkout -b update-plugins - - git add . - git commit -m "feat: update plugins to release" - git push -f origin update-plugins - - # Create a pull request using GitHub API - pr_response=$(curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \ - -d "{\"title\":\"chore: Update Gradle plugins\",\"body\":\"This PR updates the Gradle plugins.\",\"head\":\"update-plugins\",\"base\":\"main\"}" \ - "https://api.github.com/repos/bitrise-io/bitrise-build-cache-cli/pulls") - - pr_url=$(echo "$pr_response" | jq -r .html_url) - envman add --key PR_URL --value "$pr_url" - - if [ "$pr_url" != "null" ]; then - echo "Pull request created successfully: $pr_url" - else - echo "Failed to create pull request. Response: $pr_response" - exit 1 - fi - else - echo "No changes detected, skipping commit." - exit 0 - fi - - slack@4: - inputs: - - channel: "#team-advanced-ci-alerts-website" - - text: |- - Gradle plugin update PR is ready! :tada: :rocket: :gradle: - - Check PR here: $PR_URL - - emoji: ":gradle:" - - color: "#08a045" - - webhook_url: "$SLACK_WEBHOOK_ALERTS" - title: Send slack if PR opened - run_if: '{{ getenv "PR_URL" | ne "" }}' - - slack@4: - inputs: - - channel: "#team-advanced-ci-alerts-website" - - text: |- - CLI plugin update failed! :gradle: :gopher_lift: :rotating_light: - - Check build here: $BITRISE_BUILD_URL - - emoji: ":rotating_light:" - - color: "#ee003b" - - webhook_url: "$SLACK_WEBHOOK_ALERTS" - title: Send slack if failed - run_if: ".IsBuildFailed" - - feature-e2e-gradle-duckduck: + - bundle::generate_gradle_verification_reference: {} + gradle-configuration-e2e-linux: envs: - - TEST_APP_URL: git@github.com:duckduckgo/Android.git - - BRANCH: develop + - TEST_APP_URL: git@github.com:bitwarden/android.git + - COMMIT: 2c71ab7d27d7f976766adee7bfd1828d5eda0850 steps: - bundle::feature-e2e-setup: {} - - apt-get-install: - inputs: - - packages: 'bc' - - upgrade: "no" - script: title: Enable build cache inputs: @@ -318,57 +3000,56 @@ workflows: - script: title: Print ~/.init.d/bitrise-build-cache.init.gradle.kts inputs: - - content: |- - cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts + - content: cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts - script: - title: Build and capture logs + title: Create local configuration cache inputs: - content: |- set -exo pipefail - (./gradlew debug --info --stacktrace 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + ./gradlew debug --configuration-cache --dry-run --info --stacktrace - script: - title: Check for cache invocations + title: Save configuration cache inputs: - content: |- set -exo pipefail - - ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ - '\[Bitrise Build Cache\].*🤖 Bitrise remote cache enabled' \ - '\[Bitrise Build Cache\].*Request metadata invocationId' \ - '\[Bitrise Analytics\].*🤖 Bitrise analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' - - source ../_e2e/scripts/extract_invocation_id.sh - - invocation_id=$(extract_invocation_id_gradle "$BITRISE_DEPLOY_DIR/logs.txt") - if [[ -z "$invocation_id" ]]; then - fatal "Invocation ID not found in logs" - fi - - echo "Found Invocation ID: $invocation_id" - envman add --key INVOCATION_ID --value "$invocation_id" + ../bitrise-build-cache-cli save-gradle-configuration-cache \ + --config-cache-dir "$PWD/.gradle/configuration-cache" - script: - title: Assert invocation from API + title: Delete local configuration cache + inputs: + - content: |- + set -exo pipefail + rm -rf .gradle/configuration-cache + - script: + title: Restore configuration cache + inputs: + - content: |- + set -exo pipefail + ../bitrise-build-cache-cli restore-gradle-configuration-cache + - script: + title: Build and capture logs + inputs: + - content: |- + set -exo pipefail + (./gradlew debug --configuration-cache --info --stacktrace 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + - script: + title: Check for cache invocations inputs: - - content: |- - source ../_e2e/scripts/assert_invocations.sh - - assert_bitrise_invocation_in_list "$INVOCATION_ID" "gradle" - assert_bitrise_invocation_detail "$INVOCATION_ID" "gradle" - assert_invocation_tasks_gradle "$INVOCATION_ID" - assert_build_performance "$INVOCATION_ID" - assert_invocation_in_build_performance "$INVOCATION_ID" "gradle" + - content: "set -exo pipefail\n\n../scripts/check_pattern.sh \"$BITRISE_DEPLOY_DIR/logs.txt\" + \\\n 'Reusing configuration cache.' \\\n '\\[Bitrise Build Cache\\].*\U0001F916 + Bitrise remote cache enabled' \\\n '\\[Bitrise Build Cache\\].*Request + metadata invocationId' \\\n '\\[Bitrise Analytics\\].*\U0001F916 Bitrise + analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'" - deploy-to-bitrise-io@2: {} - - feature-e2e-gradle-bitwarden: + meta: + bitrise.io: + stack: linux-docker-android-22.04 + gradle-configuration-e2e-osx: envs: - TEST_APP_URL: git@github.com:bitwarden/android.git - COMMIT: 2c71ab7d27d7f976766adee7bfd1828d5eda0850 steps: - bundle::feature-e2e-setup: {} - - apt-get-install: - inputs: - - packages: 'bc' - - upgrade: "no" - script: title: Enable build cache inputs: @@ -378,8 +3059,7 @@ workflows: - script: title: Print ~/.init.d/bitrise-build-cache.init.gradle.kts inputs: - - content: |- - cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts + - content: cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts - script: title: Create local configuration cache inputs: @@ -392,8 +3072,7 @@ workflows: - content: |- set -exo pipefail ../bitrise-build-cache-cli save-gradle-configuration-cache \ - --config-cache-dir "$PWD/.gradle/configuration-cache" \ - --key "cli-bitwarden-test" + --config-cache-dir "$PWD/.gradle/configuration-cache" - script: title: Delete local configuration cache inputs: @@ -405,8 +3084,7 @@ workflows: inputs: - content: |- set -exo pipefail - ../bitrise-build-cache-cli restore-gradle-configuration-cache \ - --key "cli-bitwarden-test" + ../bitrise-build-cache-cli restore-gradle-configuration-cache - script: title: Build and capture logs inputs: @@ -416,414 +3094,591 @@ workflows: - script: title: Check for cache invocations inputs: - - content: |- - set -exo pipefail - - ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ - 'Reusing configuration cache.' \ - '\[Bitrise Build Cache\].*🤖 Bitrise remote cache enabled' \ - '\[Bitrise Build Cache\].*Request metadata invocationId' \ - '\[Bitrise Analytics\].*🤖 Bitrise analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' - - source ../_e2e/scripts/extract_invocation_id.sh - - invocation_id=$(extract_invocation_id_gradle "$BITRISE_DEPLOY_DIR/logs.txt") - if [[ -z "$invocation_id" ]]; then - fatal "Invocation ID not found in logs" - fi - - echo "Found Invocation ID: $invocation_id" - envman add --key INVOCATION_ID --value "$invocation_id" - - script: - title: Assert invocation from API - inputs: - - content: |- - source ../_e2e/scripts/assert_invocations.sh - - assert_bitrise_invocation_in_list "$INVOCATION_ID" "gradle" - assert_bitrise_invocation_detail "$INVOCATION_ID" "gradle" - assert_invocation_tasks_gradle "$INVOCATION_ID" - assert_build_performance "$INVOCATION_ID" - assert_invocation_in_build_performance "$INVOCATION_ID" "gradle" + - content: "set -exo pipefail\n\n../scripts/check_pattern.sh \"$BITRISE_DEPLOY_DIR/logs.txt\" + \\\n 'Reusing configuration cache.' \\\n '\\[Bitrise Build Cache\\].*\U0001F916 + Bitrise remote cache enabled' \\\n '\\[Bitrise Build Cache\\].*Request + metadata invocationId' \\\n '\\[Bitrise Analytics\\].*\U0001F916 Bitrise + analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'" - deploy-to-bitrise-io@2: {} - feature-e2e-bazel-bitrisedc-no-rbe: meta: bitrise.io: - stack: linux-docker-android-22.04 - machine_type_id: g2.linux.medium + machine_type_id: g2.mac.medium + stack: osx-xcode-edge + release: + description: Creates Linux and Darwin binaries, then publishes a GitHub release + triggers: + tag: + - name: + regex: ^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ envs: - - TEST_APP_URL: git@github.com:bitrise-io/bazel.git - - BRANCH: master + - GITHUB_TOKEN: $GIT_BOT_USER_ACCESS_TOKEN steps: - - bundle::feature-e2e-setup: {} - - apt-get-install: + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@8: inputs: - - packages: 'bc' - - upgrade: "no" + - fetch_tags: "yes" - script@1: + title: asdf use latest go + inputs: + - content: |- + #!/usr/bin/env bash + + asdf install golang 1.24.3 + asdf global golang 1.24.3 + - script: + title: Install Goreleaser inputs: - content: | #!/usr/bin/env bash - set -exo pipefail - ../scripts/install_bazel.sh - title: Install bazel + set -ex + + GOBIN=/usr/local/bin/ go install github.com/goreleaser/goreleaser/v2@latest + - bundle::generate_gradle_verification_reference: {} + - bundle::check_gradle_verification_reference: {} - script: - title: Enable build cache + title: Goreleaser (create binaries + publish to GH) + deps: + brew: + - name: goreleaser inputs: - - content: |- - set -exo pipefail - ../bitrise-build-cache-cli activate bazel -d --cache --cache-push --bes --timestamps + - content: | + #!/usr/bin/env bash + set -ex + + goreleaser release - script: - title: Build and capture logs + title: Authenticate to GCP inputs: - content: |- - set -exo pipefail - (/usr/local/bin/bazel build //src:bazel-dev --announce_rc --copt='-w' 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + #!/bin/bash + set -euxo pipefail + KEY_FILE_PATH=$(mktemp -d)/keyfile.json + echo "${GAR_SERVICE_ACCOUNT_B64}" | base64 --decode > ${KEY_FILE_PATH} + gcloud auth activate-service-account --key-file=${KEY_FILE_PATH} - script: - title: Check for cache invocations + title: Upload release artifacts to GAR inputs: - content: |- - #!/bin/bash - set -exo pipefail + #!/usr/bin/env bash + set -eo pipefail - ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ - '--remote_cache=grpcs:\/\/bitrise-accelerate\.services\.bitrise\.io' \ - 'Invocation ID: ' \ - '--bes_header=x-os=Linux' \ - '--bes_header=x-cpu-cores=[0-9]+' \ - '--bes_header=x-mem-size=[0-9]+' \ - '--bes_header=x-ci-provider=bitrise' \ - "--bes_header=x-app-id=$BITRISE_APP_SLUG" \ - '--bes_header=x-locale=\w+' \ - '--bes_header=x-default-charset=\w+' + DIST_DIR="dist" + if [[ ! -d "$DIST_DIR" ]]; then + echo "Directory $DIST_DIR does not exist." + exit 1 + fi + tree -L 2 dist - source ../_e2e/scripts/extract_invocation_id.sh + tag="${BITRISE_GIT_TAG#v}" # Remove the v from the tag + if [[ -z "$tag" ]]; then + echo "BITRISE_GIT_TAG is not set. Exiting." + exit 1 + fi - invocation_id=$(extract_invocation_id_bazel "$BITRISE_DEPLOY_DIR/logs.txt") - if [[ -z "$invocation_id" ]]; then - fatal "Invocation ID not found in logs" + echo "Uploading with tag: $tag" + + filenames=("bitrise-build-cache_${tag}_darwin_amd64.tar.gz" + "bitrise-build-cache_${tag}_linux_amd64.tar.gz" + "bitrise-build-cache_${tag}_darwin_arm64.tar.gz" + "bitrise-build-cache_${tag}_linux_arm64.tar.gz") + for filename in "${filenames[@]}"; do + if [[ ! -f "$DIST_DIR/$filename" ]]; then + echo "File $DIST_DIR/$filename does not exist." + exit 1 fi + echo "Uploading $filename to GAR..." - echo "Found Invocation ID: $invocation_id" - envman add --key INVOCATION_ID --value "$invocation_id" - - script: - title: Assert invocation from API - inputs: - - content: |- - source ../_e2e/scripts/assert_invocations.sh + package_name="${filename/_${tag}/}" # Files will be versioned + + gcloud artifacts generic upload \ + --project=ip-build-cache-prod \ + --source="$DIST_DIR/$filename" \ + --package="$package_name" \ + --version="$tag" \ + --location=us-central1 \ + --repository=build-cache-cli-releases + done - assert_bitrise_invocation_in_list "$INVOCATION_ID" "bazel" - assert_bitrise_invocation_detail "$INVOCATION_ID" "bazel" - assert_invocation_targets_bazel "$INVOCATION_ID" - assert_build_performance "$INVOCATION_ID" - assert_invocation_in_build_performance "$INVOCATION_ID" "bazel" + echo "Uploaded artifacts to GAR." - deploy-to-bitrise-io@2: {} + - script: + title: Update step + inputs: + - content: | + #!/usr/bin/env bash + set -ex - feature-e2e-bazel-public-no-rbe: + ./scripts/update_step.sh + - slack@4: + title: Send slack if PR opened + run_if: '{{ getenv "PR_URL" | ne "" }}' + inputs: + - channel: '#team-advanced-ci-alerts-website' + - text: |- + Build Cache for Gradle step update PR is ready! :tada: :rocket: :bitrise: + + Check PR here: $PR_URL + - emoji: ':gradle:' + - color: '#08a045' + - webhook_url: $SLACK_WEBHOOK_ALERTS + - slack@4: + title: Send slack if failed + run_if: .IsBuildFailed + inputs: + - channel: '#team-advanced-ci-alerts-website' + - text: |- + CLI release failed! :gopher_lift: :rotating_light: + + Check build here: $BITRISE_BUILD_URL + - emoji: ':rotating_light:' + - color: '#ee003b' + - webhook_url: $SLACK_WEBHOOK_ALERTS meta: bitrise.io: - stack: linux-docker-android-22.04 - machine_type_id: g2.linux.medium + machine_type_id: g2.mac.medium + stack: osx-xcode-edge + test: + steps: + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@8: {} + - go-list@1: {} + - script@1: + title: golangci-lint + inputs: + - content: |- + #!/bin/bash + set -ex + make lint + - go-test@1: {} + - bundle::generate_gradle_verification_reference: {} + - bundle::check_gradle_verification_reference: {} + - deploy-to-bitrise-io@2: + inputs: + - deploy_path: $GRADLE_VERIFICATION_REF_TARGET_PATH + meta: + bitrise.io: + machine_type_id: g2.mac.medium + stack: osx-xcode-edge + update_plugins: envs: - - TEST_APP_URL: git@github.com:bitrise-io/bazel.git - - BRANCH: master + - GITHUB_TOKEN: $GIT_BOT_USER_ACCESS_TOKEN steps: - - bundle::feature-e2e-setup: { } - - apt-get-install: - inputs: - - packages: 'bc dnsutils iputils-ping' - - upgrade: "no" - - script: - title: Enable build cache - inputs: - - content: |- - #!/bin/bash - set -exo pipefail + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@8: + inputs: + - fetch_tags: "yes" + - shallow_clone: "false" + - clone_depth: "-1" + - apt-get-install: + inputs: + - packages: libxml2-utils + - script: + title: Ensure we're on main + inputs: + - content: | + #!/bin/bash + set -ex - echo "Bitrise step ID: $BITRISE_STEP_EXECUTION_ID" - ../bitrise-build-cache-cli activate bazel -d --cache --cache-push --bes --timestamps - - script: - title: Build and capture logs using Docker - inputs: - - content: |- - #!/bin/bash - set -exo pipefail + git fetch origin + if [[ "$BITRISE_GIT_BRANCH" != "main" ]]; then + git checkout main + git pull origin main + fi + - script: + title: Update plugins with latest version + inputs: + - content: | + bash ./scripts/update_plugins.sh + - bundle::generate_gradle_verification_reference: {} + - script: + title: Commit updated plugins and open PR + inputs: + - content: | + set -ex - mkdir -p ../_dockerroot - cp -r $HOME/.bazelrc ../_dockerroot/.bazelrc - - echo ${DOCKER_SHARED_PASSWORD} | docker login --username bitrisedev --password-stdin - - sudo docker run --rm \ - -w "/workspace" \ - -e "BITRISE_APP_SLUG=$BITRISE_APP_SLUG" \ - -e "BITRISE_BUILD_SLUG=$BITRISE_BUILD_SLUG" \ - -e "BITRISE_STEP_EXECUTION_ID=$BITRISE_STEP_EXECUTION_ID" \ - -e "BITRISE_TRIGGERED_WORKFLOW_TITLE=$BITRISE_TRIGGERED_WORKFLOW_TITLE" \ - -e "GIT_REPOSITORY_UR=$GIT_REPOSITORY_URL" \ - -e "BITRISE_GIT_COMMIT=$BITRISE_GIT_COMMIT" \ - --mount "type=bind,source=$PWD,target=/workspace" \ - --mount "type=bind,source=$(readlink -f ../_dockerroot)/.bazelrc,target=/root/.bazelrc,ro" \ - --mount "type=bind,source=$BITRISE_DEPLOY_DIR,target=/bitrise-deploy" \ - ubuntu:22.04 \ - bash -c "set -o pipefail; apt-get update && apt-get install -y curl build-essential xz-utils zip unzip python3 && \ - curl -Lo bazelisk https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 && \ - chmod +x bazelisk && \ - ./bazelisk build //src:bazel-dev --announce_rc --copt='-w' 2>&1 | tee /bitrise-deploy/logs.txt" + # Check for existing PR with the same title + existing_pr=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ + "https://api.github.com/repos/bitrise-io/bitrise-build-cache-cli/pulls?state=open" | jq -r ".[] | select(.title == \"chore: Update Gradle plugins\") | .html_url") - - script: - title: Check for cache invocations - inputs: - - content: |- - #!/bin/bash - set -exo pipefail + if [ -n "$existing_pr" ]; then + echo "A pull request with this title already exists: $existing_pr" + exit 0 + fi - ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ - '--remote_cache=grpcs:\/\/bitrise-accelerate\.services\.bitrise\.io' \ - 'Invocation ID: ' \ - '--bes_header=x-os=Linux' \ - '--bes_header=x-cpu-cores=[0-9]+' \ - '--bes_header=x-mem-size=[0-9]+' \ - '--bes_header=x-ci-provider=bitrise' \ - "--bes_header=x-app-id=$BITRISE_APP_SLUG" \ - '--bes_header=x-locale=\w+' \ - '--bes_header=x-default-charset=\w+' - - source ../_e2e/scripts/extract_invocation_id.sh - - invocation_id=$(extract_invocation_id_bazel "$BITRISE_DEPLOY_DIR/logs.txt") - if [[ -z "$invocation_id" ]]; then - fatal "Invocation ID not found in logs" - fi - - echo "Found Invocation ID: $invocation_id" - envman add --key INVOCATION_ID --value "$invocation_id" - - script: - title: Assert invocation from API - inputs: - - content: |- - source ../_e2e/scripts/assert_invocations.sh + if [ -n "$(git status --porcelain)" ]; then + git branch -D update-plugins || true + git checkout -b update-plugins - assert_bitrise_invocation_in_list "$INVOCATION_ID" "bazel" - assert_bitrise_invocation_detail "$INVOCATION_ID" "bazel" - assert_invocation_targets_bazel "$INVOCATION_ID" - assert_build_performance "$INVOCATION_ID" - assert_invocation_in_build_performance "$INVOCATION_ID" "bazel" - - deploy-to-bitrise-io@2: { } + git add . + git commit -m "feat: update plugins to release" + git push -f origin update-plugins - gradle-configuration-e2e-osx: - meta: - bitrise.io: - machine_type_id: g2.mac.medium - stack: osx-xcode-edge - envs: - - TEST_APP_URL: git@github.com:bitwarden/android.git - - COMMIT: 2c71ab7d27d7f976766adee7bfd1828d5eda0850 + # Create a pull request using GitHub API + pr_response=$(curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \ + -d "{\"title\":\"chore: Update Gradle plugins\",\"body\":\"This PR updates the Gradle plugins.\",\"head\":\"update-plugins\",\"base\":\"main\"}" \ + "https://api.github.com/repos/bitrise-io/bitrise-build-cache-cli/pulls") + + pr_url=$(echo "$pr_response" | jq -r .html_url) + envman add --key PR_URL --value "$pr_url" + + if [ "$pr_url" != "null" ]; then + echo "Pull request created successfully: $pr_url" + else + echo "Failed to create pull request. Response: $pr_response" + exit 1 + fi + else + echo "No changes detected, skipping commit." + exit 0 + fi + - slack@4: + title: Send slack if PR opened + run_if: '{{ getenv "PR_URL" | ne "" }}' + inputs: + - channel: '#team-advanced-ci-alerts-website' + - text: |- + Gradle plugin update PR is ready! :tada: :rocket: :gradle: + + Check PR here: $PR_URL + - emoji: ':gradle:' + - color: '#08a045' + - webhook_url: $SLACK_WEBHOOK_ALERTS + - slack@4: + title: Send slack if failed + run_if: .IsBuildFailed + inputs: + - channel: '#team-advanced-ci-alerts-website' + - text: |- + CLI plugin update failed! :gradle: :gopher_lift: :rotating_light: + + Check build here: $BITRISE_BUILD_URL + - emoji: ':rotating_light:' + - color: '#ee003b' + - webhook_url: $SLACK_WEBHOOK_ALERTS +step_bundles: + benchmark-setup: + inputs: + - REPO_URL: $REPO_URL + opts: {} + - BRANCH: $BRANCH + opts: {} + - USE_DD_CACHE: $USE_DD_CACHE + opts: {} + - USE_SPM: $USE_SPM + opts: {} + - USE_COMP_CACHE: $USE_COMP_CACHE + opts: {} + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + opts: {} + - SILENT: false + opts: { } steps: - - bundle::feature-e2e-setup: {} + - activate-ssh-key: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - script: - title: Enable build cache - inputs: - - content: |- - set -exo pipefail - ../bitrise-build-cache-cli activate gradle -d --cache + title: Delete DerivedData + inputs: + - content: rm -rf ~/Library/Developer/Xcode/DerivedData - script: - title: Print ~/.init.d/bitrise-build-cache.init.gradle.kts + title: Clean _benchmark dir inputs: - - content: |- - cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts + - content: rm -rf ./_benchmark + - git-clone: {} - script: - title: Create local configuration cache + title: Build CLI + run_if: '{{enveq "USE_COMP_CACHE" "true"}}' inputs: - content: |- set -exo pipefail - ./gradlew debug --configuration-cache --dry-run --info --stacktrace + go build -o bitrise-build-cache-cli - script: - title: Save configuration cache + title: Activate comp cache using CLI + run_if: '{{enveq "USE_COMP_CACHE" "true"}}' inputs: - content: |- - set -exo pipefail - ../bitrise-build-cache-cli save-gradle-configuration-cache \ - --config-cache-dir "$PWD/.gradle/configuration-cache" + #!/usr/bin/env bash + set -eo pipefail + + ./bitrise-build-cache-cli activate xcode --cache --silent=${SILENT} - script: - title: Delete local configuration cache + title: Git clone benchmark app inputs: - content: |- - set -exo pipefail - rm -rf .gradle/configuration-cache + #!/usr/bin/env bash + set -eo pipefail + + git clone --recurse-submodules --depth 30 $REPO_URL -b $BRANCH ./_benchmark/$BENCHMARK_APP_NAME + - change-workdir: + title: Switch working dir to _benchmark + inputs: + - path: ./_benchmark/$BENCHMARK_APP_NAME + - git::https://github.com/bitrise-steplib/bitrise-step-restore-xcodebuild-cache.git@main: + run_if: '{{enveq "USE_DD_CACHE" "true"}}' + inputs: + - project_root_path: . + - restore-cache: + run_if: '{{enveq "USE_SPM" "true"}}' + inputs: + - verbose: true + - key: '{{ .OS }}-{{ .Arch }}-spm-cache-{{ getenv "BENCHMARK_APP_NAME" }}-{{ + checksum "**/Package.resolved" }}' - script: - title: Restore configuration cache + title: "Print SourcePackages dir (if SPM is used)" + run_if: '{{enveq "USE_SPM" "true"}}' inputs: - - content: |- - set -exo pipefail - ../bitrise-build-cache-cli restore-gradle-configuration-cache + - content: |- + #!/usr/bin/env bash + set -eo pipefail + + for sp in ~/Library/Developer/Xcode/DerivedData/*/SourcePackages; do + [ -d "$sp" ] || continue + echo "=== $sp ===" + if command -v tree >/dev/null 2>&1; then + tree -L 2 "$sp" + else + ls -la "$sp" + fi + done + benchmark_finish: + inputs: + - USE_DD_CACHE: $USE_DD_CACHE + opts: {} + - USE_SPM: $USE_SPM + opts: {} + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + opts: {} + steps: - script: - title: Build and capture logs + title: Store action end time inputs: - content: |- - set -exo pipefail - (./gradlew debug --configuration-cache --info --stacktrace 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + #!/usr/bin/env bash + set -eo pipefail + + envman add --key "${BENCHMARK_APP_NAME}_END" --value "$(date +%s)" + - save-cache: + run_if: '{{enveq "USE_SPM" "true"}}' + inputs: + - verbose: true + - key: '{{ .OS }}-{{ .Arch }}-spm-cache-{{ getenv "BENCHMARK_APP_NAME" }}-{{ + checksum "**/Package.resolved" }}' + - paths: ~/Library/Developer/Xcode/DerivedData/**/SourcePackages + - git::https://github.com/bitrise-steplib/bitrise-step-save-xcodebuild-cache.git@main: + run_if: '{{enveq "USE_DD_CACHE" "true"}}' + inputs: + - project_root_path: . + - derived_data_path: $HOME/Library/Developer/Xcode/DerivedData + - skip_spm: $USE_SPM - script: - title: Check for cache invocations + title: Save files + is_always_run: true inputs: - content: |- + #!/usr/bin/env bash set -exo pipefail - ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ - 'Reusing configuration cache.' \ - '\[Bitrise Build Cache\].*🤖 Bitrise remote cache enabled' \ - '\[Bitrise Build Cache\].*Request metadata invocationId' \ - '\[Bitrise Analytics\].*🤖 Bitrise analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' - - deploy-to-bitrise-io@2: {} + echo "BITRISE_XCODE_BUILD_RAW_RESULT_TEXT_PATH path: $BITRISE_XCODE_BUILD_RAW_RESULT_TEXT_PATH" + cp "$BITRISE_XCODE_BUILD_RAW_RESULT_TEXT_PATH" "$BITRISE_DEPLOY_DIR/${BENCHMARK_APP_NAME}_xcodebuild_result.txt" || echo "No xcodebuild result file found" - gradle-configuration-e2e-linux: - meta: - bitrise.io: - stack: linux-docker-android-22.04 - envs: - - TEST_APP_URL: git@github.com:bitwarden/android.git - - COMMIT: 2c71ab7d27d7f976766adee7bfd1828d5eda0850 + echo "BITRISE_XCODEBUILD_BUILD_FOR_SIMULATOR_LOG_PATH path: $BITRISE_XCODEBUILD_BUILD_FOR_SIMULATOR_LOG_PATH" + cp "$BITRISE_XCODEBUILD_BUILD_FOR_SIMULATOR_LOG_PATH" "$BITRISE_DEPLOY_DIR/${BENCHMARK_APP_NAME}_xcodebuild_simulator_log.txt" || echo "No xcodebuild simulator log file found" + + echo "BITRISE_XCRESULT_PATH path: $BITRISE_XCRESULT_PATH" + tar -czf "$BITRISE_DEPLOY_DIR/${BENCHMARK_APP_NAME}.xcresult.tar.gz" -C "$BITRISE_XCRESULT_PATH" . || echo "No xcarchive files found" + + find "$HOME/Library/Developer/Xcode/DerivedData" -type d -name '*.xcbuilddata' -exec sh -c ' + for dir do + name=$(basename "$dir") + dest="$BITRISE_DEPLOY_DIR/${name}.tar.gz" + echo "Creating $dest from $dir" + tar -C "$dir" -czf "$dest" . + done + ' _ {} + + + find "$HOME/Library/Developer/Xcode/DerivedData" -type f -name '*.xcactivitylog' -exec cp {} "$BITRISE_DEPLOY_DIR/" \; + + tree -L 2 "$HOME/Library/Developer/Xcode/DerivedData" + - deploy-to-bitrise-io: + title: Upload logs to Bitrise + inputs: + - deploy_path: $BITRISE_DEPLOY_DIR + - share-pipeline-variable: + title: Share benchmark step results + inputs: + - variables: |- + ${BENCHMARK_APP_NAME}_END + ${BENCHMARK_APP_NAME}_START + benchmark_start_measure: + inputs: + - BENCHMARK_APP_NAME: $BENCHMARK_APP_NAME + opts: {} steps: - - bundle::feature-e2e-setup: {} - script: - title: Enable build cache + title: Store action start time inputs: - content: |- - set -exo pipefail - ../bitrise-build-cache-cli activate gradle -d --cache - - script: - title: Print ~/.init.d/bitrise-build-cache.init.gradle.kts - inputs: - - content: |- - cat ~/.gradle/init.d/bitrise-build-cache.init.gradle.kts - - script: - title: Create local configuration cache + #!/usr/bin/env bash + set -eo pipefail + + envman add --key "${BENCHMARK_APP_NAME}_START" --value "$(date +%s)" + check_gradle_verification_reference: + steps: + - script@1: + title: Check if local updates to verification-metadata.xml are not commited inputs: - content: |- - set -exo pipefail - ./gradlew debug --configuration-cache --dry-run --info --stacktrace + set -x + + git update-index --refresh | grep "cmd/gradle/asset/verification-metadata.xml" + if [[ $? == 0 ]]; then + echo "Please manually commit the changes to the repo:" + echo "$GRADLE_VERIFICATION_REF_TARGET_PATH" + exit 1 + else + echo "The files have no unstaged changes: $GRADLE_VERIFICATION_REF_TARGET_PATH" + exit 0 + fi + feature-e2e-setup: + steps: + - activate-ssh-key: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - script: - title: Save configuration cache + title: Clone e2e testing repo with deploy key + run_if: '{{getenv "SSH_DEPLOY_KEY_E2E_TESTING" | ne ""}}' inputs: - content: |- - set -exo pipefail - ../bitrise-build-cache-cli save-gradle-configuration-cache \ - --config-cache-dir "$PWD/.gradle/configuration-cache" + #!/bin/bash + set -ex + + mkdir -p ~/.ssh + echo "$SSH_DEPLOY_KEY_E2E_TESTING" > ~/.ssh/github_deploy_build_cache_e2e_testing + chmod 600 ~/.ssh/github_deploy_build_cache_e2e_testing + + ssh-add ~/.ssh/github_deploy_build_cache_e2e_testing + + mkdir -p ./_e2e + GIT_SSH_COMMAND='ssh -i ~/.ssh/github_deploy_build_cache_e2e_testing -o IdentitiesOnly=yes' git clone git@github.com:bitrise-io/build-cache-e2e-testing.git ./_e2e + + ls -la ./_e2e - script: - title: Delete local configuration cache + title: Clone e2e repo with existing SSH key + run_if: '{{getenv "SSH_DEPLOY_KEY_E2E_TESTING" | eq ""}}' inputs: - content: |- - set -exo pipefail - rm -rf .gradle/configuration-cache + #!/bin/bash + set -ex + + rm -rf ./_e2e + mkdir -p ./_e2e + git clone git@github.com:bitrise-io/build-cache-e2e-testing.git ./_e2e + + ls -la ./_e2e - script: - title: Restore configuration cache + title: Delete _tmp dirs inputs: - - content: |- - set -exo pipefail - ../bitrise-build-cache-cli restore-gradle-configuration-cache + - content: rm -rf _tmp - script: - title: Build and capture logs + title: Delete DerivedData inputs: - - content: |- - set -exo pipefail - (./gradlew debug --configuration-cache --info --stacktrace 2>&1) | tee "$BITRISE_DEPLOY_DIR/logs.txt" + - content: rm -rf ~/Library/Developer/Xcode/DerivedData + - git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git: + inputs: + - repository_url: $TEST_APP_URL + - clone_into_dir: ./_tmp + - branch: $BRANCH + - commit: $COMMIT + - git-clone: {} - script: - title: Check for cache invocations + title: build CLI inputs: - content: |- set -exo pipefail - - ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/logs.txt" \ - 'Reusing configuration cache.' \ - '\[Bitrise Build Cache\].*🤖 Bitrise remote cache enabled' \ - '\[Bitrise Build Cache\].*Request metadata invocationId' \ - '\[Bitrise Analytics\].*🤖 Bitrise analytics enabled for tasks.*Invocation ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' - - deploy-to-bitrise-io@2: {} - e2e-xcode-comp-cache: - meta: - bitrise.io: - stack: osx-xcode-26.0.x-edge - machine_type_id: g2.mac.large - envs: - - TEST_APP_URL: git@github.com:bitrise-io/swift-composable-architecture.git - - COMMIT: 27db3dfc9f55c206e09ca2a51b93bd600a56429e + go build -o bitrise-build-cache-cli + - change-workdir: + title: Switch working dir to _tmp + inputs: + - path: ./_tmp + generate_and_commit_dependency_matrix: steps: - - bundle::feature-e2e-setup: {} - script: - title: activate xcode using CLI + title: Install pandoc + run_if: .IsCI inputs: - - content: |- - #!/usr/bin/env bash - set -eo pipefail + - content: | + #!/bin/bash + set -ex + + wget https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-amd64.tar.gz + tar xvzf pandoc-$PANDOC_VERSION-linux-amd64.tar.gz + sudo mv pandoc-$PANDOC_VERSION/bin/pandoc /usr/local/bin/ - echo "Original Xcodebuild command location:" - type xcodebuild || true + rm -rf pandoc-$PANDOC_VERSION-linux-amd64.tar.gz + rm -rf pandoc-$PANDOC_VERSION - # Add --xcode-path /usr/bin/xcodebuild to test xcode path override (for local) - ../bitrise-build-cache-cli -d activate xcode \ - --cache + pandoc --version - script: - title: build app + title: Install go versions inputs: - - content: |- - echo "Xcodebuild command location after activation:" - type xcodebuild || true - - echo "Config file content:" - cat "$HOME/.bitrise-xcelerate/config.json" - - echo "Starting build..." - xcodebuild build \ - -workspace ComposableArchitecture.xcworkspace \ - -scheme ComposableArchitecture \ - -destination "generic/platform=iOS" \ - -skipMacroValidation 2> wrapper.log | tee xcodebuild.log | xcpretty - + - content: | + #!/bin/bash + set -ex + + asdf install golang 1.23.8 + asdf install golang 1.21.5 - script: - title: gather info + title: Generate dependency matrix inputs: - - content: |- - set -exo pipefail - - cp ~/.bitrise-xcelerate/config.json $BITRISE_DEPLOY_DIR - cp ~/.local/state/xcelerate/logs/* $BITRISE_DEPLOY_DIR - cp xcodebuild.log $BITRISE_DEPLOY_DIR - cp wrapper.log $BITRISE_DEPLOY_DIR - - cat "$BITRISE_DEPLOY_DIR/wrapper.log" - head -n 20 $BITRISE_DEPLOY_DIR/xcodebuild.log - tail -n 20 $BITRISE_DEPLOY_DIR/xcodebuild.log - - source ../_e2e/scripts/error.sh - source ../_e2e/scripts/extract_invocation_id.sh - - invocation_id=$(extract_invocation_id_xcode "$BITRISE_DEPLOY_DIR/wrapper.log") - if [[ -z "$invocation_id" ]]; then - fatal "Invocation ID not found in logs" - fi + - content: | + #!/bin/bash + set -ex - echo "Found Invocation ID: $invocation_id" - envman add --key INVOCATION_ID --value "$invocation_id" + bash ./scripts/generate-dependency-matrix.sh - script: - title: Assert invocation from API + title: Reformat dependency matrix inputs: - - content: |- - source ../_e2e/scripts/assert_invocations.sh - - assert_bitrise_invocation_in_list "$INVOCATION_ID" "xcode" - assert_bitrise_invocation_detail "$INVOCATION_ID" "xcode" - assert_build_performance "$INVOCATION_ID" - assert_invocation_in_build_performance "$INVOCATION_ID" "xcode" + - content: | + #!/bin/bash + set -ex + + pandoc --from=markdown --to=gfm --wrap=auto --output cleaned.md docs/dependency-matrix.md + mv cleaned.md docs/dependency-matrix.md - script: - title: Check for cache usage + title: Commit dependency matrix inputs: - - content: |- - set -exo pipefail + - content: | + #!/bin/bash + set -ex - ../scripts/check_pattern.sh "$BITRISE_DEPLOY_DIR/xcodebuild.log" 'CompilationCacheMetrics' - - deploy-to-bitrise-io: {} + git status + ls -l docs/dependency-matrix.md + git stash push -u -m "stash before switching to gh-pages" -step_bundles: + git fetch --all + git checkout gh-pages + + rm -f docs/dependency-matrix.md + git stash apply + + if [ ! -f docs/dependency-matrix.md ]; then + echo "No dependency matrix found, skipping commit." + exit -1 + fi + + if [ -n "$(git status --porcelain)" ]; then + echo "Changes detected, committing and pushing to gh-pages branch." + + git add docs/dependency-matrix.md + git diff --cached docs/dependency-matrix.md + + git commit -m "chore: update dependency matrix" + git push origin gh-pages + else + echo "No changes detected, skipping commit." + exit 0 + fi generate_gradle_verification_reference: steps: - script: @@ -859,177 +3714,3 @@ step_bundles: # Copy metadata to be included in the CLI binary mv -f "$GRADLE_VERIFICATION_REF_PATH" "$GRADLE_VERIFICATION_REF_TARGET_PATH" envman add --key GRADLE_VERIFICATION_REF_TARGET_PATH --value "$GRADLE_VERIFICATION_REF_TARGET_PATH" - - check_gradle_verification_reference: - steps: - - script@1: - title: Check if local updates to verification-metadata.xml are not commited - inputs: - - content: |- - set -x - - git update-index --refresh | grep "cmd/gradle/asset/verification-metadata.xml" - if [[ $? == 0 ]]; then - echo "Please manually commit the changes to the repo:" - echo "$GRADLE_VERIFICATION_REF_TARGET_PATH" - exit 1 - else - echo "The files have no unstaged changes: $GRADLE_VERIFICATION_REF_TARGET_PATH" - exit 0 - fi - generate_and_commit_dependency_matrix: - steps: - - script: - run_if: ".IsCI" - title: Install pandoc - inputs: - - content: | - #!/bin/bash - set -ex - - wget https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-amd64.tar.gz - tar xvzf pandoc-$PANDOC_VERSION-linux-amd64.tar.gz - sudo mv pandoc-$PANDOC_VERSION/bin/pandoc /usr/local/bin/ - - rm -rf pandoc-$PANDOC_VERSION-linux-amd64.tar.gz - rm -rf pandoc-$PANDOC_VERSION - - pandoc --version - - script: - title: Install go versions - inputs: - - content: | - #!/bin/bash - set -ex - - asdf install golang 1.23.8 - asdf install golang 1.21.5 - - script: - title: Generate dependency matrix - inputs: - - content: | - #!/bin/bash - set -ex - - bash ./scripts/generate-dependency-matrix.sh - - script: - title: Reformat dependency matrix - inputs: - - content: | - #!/bin/bash - set -ex - - pandoc --from=markdown --to=gfm --wrap=auto --output cleaned.md docs/dependency-matrix.md - mv cleaned.md docs/dependency-matrix.md - - script: - title: Commit dependency matrix - inputs: - - content: | - #!/bin/bash - set -ex - - git status - ls -l docs/dependency-matrix.md - git stash push -u -m "stash before switching to gh-pages" - - git fetch --all - git checkout gh-pages - - rm -f docs/dependency-matrix.md - git stash apply - - if [ ! -f docs/dependency-matrix.md ]; then - echo "No dependency matrix found, skipping commit." - exit -1 - fi - - if [ -n "$(git status --porcelain)" ]; then - echo "Changes detected, committing and pushing to gh-pages branch." - - git add docs/dependency-matrix.md - git diff --cached docs/dependency-matrix.md - - git commit -m "chore: update dependency matrix" - git push origin gh-pages - else - echo "No changes detected, skipping commit." - exit 0 - fi - - feature-e2e-setup: - steps: - - activate-ssh-key: - run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - - script: - title: Clone e2e testing repo with deploy key - run_if: '{{getenv "SSH_DEPLOY_KEY_E2E_TESTING" | ne ""}}' - inputs: - - content: |- - #!/bin/bash - set -ex - - mkdir -p ~/.ssh - echo "$SSH_DEPLOY_KEY_E2E_TESTING" > ~/.ssh/github_deploy_build_cache_e2e_testing - chmod 600 ~/.ssh/github_deploy_build_cache_e2e_testing - - ssh-add ~/.ssh/github_deploy_build_cache_e2e_testing - - mkdir -p ./_e2e - GIT_SSH_COMMAND='ssh -i ~/.ssh/github_deploy_build_cache_e2e_testing -o IdentitiesOnly=yes' git clone git@github.com:bitrise-io/build-cache-e2e-testing.git ./_e2e - - ls -la ./_e2e - - script: - title: Clone e2e repo with existing SSH key - run_if: '{{getenv "SSH_DEPLOY_KEY_E2E_TESTING" | eq ""}}' - inputs: - - content: |- - #!/bin/bash - set -ex - - rm -rf ./_e2e - mkdir -p ./_e2e - git clone git@github.com:bitrise-io/build-cache-e2e-testing.git ./_e2e - - ls -la ./_e2e - - script: - title: Delete _tmp dirs - inputs: - - content: rm -rf _tmp - - script: - title: Delete DerivedData - inputs: - - content: rm -rf ~/Library/Developer/Xcode/DerivedData - - git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git: - inputs: - - repository_url: "$TEST_APP_URL" - - clone_into_dir: "./_tmp" - - branch: "$BRANCH" - - commit: "$COMMIT" - - git-clone: {} - - script: - title: build CLI - inputs: - - content: |- - set -exo pipefail - go build -o bitrise-build-cache-cli - - change-workdir: - title: Switch working dir to _tmp - inputs: - - path: "./_tmp" - -pipelines: - features-e2e: - workflows: - test: {} - feature-e2e-bazel-bitrisedc-no-rbe: {} - feature-e2e-bazel-public-no-rbe: {} - feature-e2e-gradle-duckduck: {} - feature-e2e-gradle-bitwarden: {} - gradle-configuration-e2e-osx: {} - gradle-configuration-e2e-linux: {} - e2e-xcode-comp-cache: {} - triggers: - pull_request: - - source_branch: "*" - push: - - branch: main