Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AndroidManifest] Reveal Manifest Changes in PR #13582

Draft
wants to merge 15 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .buildkite/commands/diff-merged-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

BUILD_VARIANT=$1
Comment on lines +1 to +3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Position Strict Error Handling Early
The script currently sets the strict error handling (set -euo pipefail) on line 11. To ensure that all commands (including the initial restore commands) are executed with strict error handling, consider moving this setting immediately after the shebang, at the top of the script.


"$(dirname "${BASH_SOURCE[0]}")/restore-merged-manifest.sh" "WooCommerce" ${BUILD_VARIANT}

"$(dirname "${BASH_SOURCE[0]}")/restore-merged-manifest.sh" "WooCommerce-Wear" ${BUILD_VARIANT}

"$(dirname "${BASH_SOURCE[0]}")/restore-cache.sh"

set -euo pipefail
Comment on lines +9 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ordering and Error Handling of Cache Restoration
The call to restore-cache.sh (line 9) is executed before setting strict error handling on line 11. Relocating the set -euo pipefail to the very top (as suggested above) will ensure that any error during cache restoration is caught.


echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply

echo "--- 📦 Create Merged Manifest (Build Variant: ${BUILD_VARIANT})"
./gradlew process"${BUILD_VARIANT^}"Manifest
echo ""

echo "--- 💾 Diff Merged Manifest (Module: WooCommerce, Build Variant: ${BUILD_VARIANT})"
comment_with_manifest_diff "WooCommerce" ${BUILD_VARIANT}

echo "--- 💾 Diff Merged Manifest (Module: WooCommerce-Wear, Build Variant: ${BUILD_VARIANT})"
comment_with_manifest_diff "WooCommerce-Wear" ${BUILD_VARIANT}
7 changes: 7 additions & 0 deletions .buildkite/commands/restore-merged-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -e

MODULE=$1
BUILD_VARIANT=$2

echo "--- 💾 Restore Merged Manifest (Module: ${MODULE}, Build Variant: ${BUILD_VARIANT})"
restore_android_merged_manifest ${MODULE} ${BUILD_VARIANT} || true
23 changes: 23 additions & 0 deletions .buildkite/commands/save-merged-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

BUILD_VARIANT=$1

"$(dirname "${BASH_SOURCE[0]}")/restore-cache.sh"

set -euo pipefail

echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply

echo "--- 📦 Create Merged Manifest (Build Variant: ${BUILD_VARIANT})"
./gradlew assemble"${BUILD_VARIANT^}"
echo ""

echo "--- 💾 Save Merged Manifest (Module: WooCommerce, Build Variant: ${BUILD_VARIANT})"
save_android_merged_manifest "WooCommerce" ${BUILD_VARIANT}

echo "--- 💾 Save Merged Manifest (Module: WooCommerce-Wear, Build Variant: ${BUILD_VARIANT})"
save_android_merged_manifest "WooCommerce-Wear" ${BUILD_VARIANT}
90 changes: 5 additions & 85 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,12 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
---

# Nodes with values to reuse in the pipeline.
common_params:
# Common plugin settings to use with the `plugins` key.
- &test_collector_common_params
files: "WooCommerce/build/buildkite-test-analytics/*.xml"
format: "junit"

agents:
queue: "android"

steps:
- label: Gradle Wrapper Validation
command: validate_gradle_wrapper
agents:
queue: linter

# Wait for Gradle Wrapper to be validated before running any other jobs
- wait

########################################
- group: "🕵️ Linters"
steps:

- label: "☢️ Danger - PR Check"
command: danger
key: danger
if: "build.pull_request.id != null"
retry:
manual:
permit_on_passed: true
agents:
queue: "linter"

- label: "detekt"
command: ./gradlew detektAll
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/detekt/detekt.html"

- label: "lint"
command: .buildkite/commands/lint.sh
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/lint-results*.*"

- label: "Dependency Tree Diff"
command: comment_with_dependency_diff 'woocommerce' 'vanillaReleaseRuntimeClasspath'
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/diff/*"

########################################
- group: "🛠 Prototype Builds"
steps:

- label: "🛠 Prototype Build: Mobile App"
command: ".buildkite/commands/prototype-build.sh WooCommerce"
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]

- label: "🛠 Prototype Build: Wear App"
command: ".buildkite/commands/prototype-build.sh WooCommerce-Wear"
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]

########################################
- group: "🔬 Tests"
steps:

- label: "Unit tests"
command: .buildkite/commands/run-unit-tests.sh
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR :
<<: *test_collector_common_params
api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_UNIT_TESTS"
artifact_paths:
- "**/build/test-results/merged-test-results.xml"

- label: "Instrumented tests"
command: .buildkite/commands/run-instrumented-tests.sh
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR :
<<: *test_collector_common_params
api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_INSTRUMENTED_TESTS"
artifact_paths:
- "**/build/instrumented-tests/**/*"
- label: "💾 Restore and Diff Merged Manifest"
command: ".buildkite/commands/diff-merged-manifest.sh jalapenoDebug"
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/diff_manifest/**/**/*"
10 changes: 10 additions & 0 deletions .buildkite/schedules/merged-manifest-storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
---

agents:
queue: "android"

steps:
- label: "💾 Create and Store Merged Manifest"
command: ".buildkite/commands/save-merged-manifest.sh jalapenoDebug"
plugins: [$CI_TOOLKIT]
2 changes: 1 addition & 1 deletion .buildkite/shared-pipeline-vars
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it.

export CI_TOOLKIT="automattic/a8c-ci-toolkit#3.10.1"
export CI_TOOLKIT="automattic/a8c-ci-toolkit#4d25f6ab2cfa9ccacee72d1c44a1ed1189a589f0"
export TEST_COLLECTOR="test-collector#v1.10.1"
1 change: 1 addition & 0 deletions WooCommerce-Wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ dependencies {
exclude group: 'com.squareup.okhttp3'
}
lintChecks(libs.android.security.lint)
implementation(libs.singular)
}

android.buildTypes.all { buildType ->
Expand Down
1 change: 1 addition & 0 deletions WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ dependencies {
implementation(libs.google.protobuf.javalite)

lintChecks(libs.android.security.lint)
implementation(libs.singular)
}

protobuf {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ mpandroidchart = 'v3.1.0'
photoview = '2.3.0'
robolectric = "4.11"
sentry = '4.10.0'
singular = "12.6.1"
squareup-javapoet = "1.7.0"
squareup-leakcanary = '2.14'
squareup-okhttp3 = "4.9.0"
Expand Down Expand Up @@ -251,6 +252,7 @@ mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", versio
mpandroidchart = { group = "com.github.PhilJay", name = "MPAndroidChart", version.ref = "mpandroidchart" }
photoview = { group = "com.github.chrisbanes", name = "PhotoView", version.ref = "photoview" }
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
singular = { module = "com.singular.sdk:singular_sdk", version.ref = "singular" }
squareup-javapoet = { module = "com.squareup:javapoet", version.ref = "squareup-javapoet" }
squareup-leakcanary-android = { group = "com.squareup.leakcanary", name = "leakcanary-android", version.ref = "squareup-leakcanary" }
squareup-okhttp3 = { module = "com.squareup.okhttp3:okhttp", version.ref = "squareup-okhttp3" }
Expand Down
3 changes: 3 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ dependencyResolutionManagement {
includeModule("com.github.PhilJay", "MPAndroidChart")
}
}
maven {
url "https://maven.singular.net"
}
}
}

Expand Down