Skip to content

Commit

Permalink
Merge pull request #13391 from woocommerce/ci/use-custom-init-gradle-…
Browse files Browse the repository at this point in the history
…task-to-download-dependencies

[Dependency Cache] Use Custom Init Gradle Task to Download Dependencies
  • Loading branch information
ParaskP7 authored Jan 30, 2025
2 parents ca38ed6 + 20c13f9 commit b45f1e6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .buildkite/commands/lint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -u

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

echo "--- 🧹 Linting"
./gradlew :WooCommerce:lintJalapenoDebug
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/commands/prototype-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu

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

APP_TO_BUILD="${1?You need to specify the app to build, WooCommerce or WooCommerce-Wear}"

Expand Down
4 changes: 1 addition & 3 deletions .buildkite/commands/restore-cache.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash

set -e
#!/bin/bash -e

echo "--- 💾 Restore Cache"
restore_gradle_dependency_cache || true
2 changes: 1 addition & 1 deletion .buildkite/commands/run-instrumented-tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu

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

echo "--- :rubygems: Setting up Gems"
install_gems
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/commands/run-unit-tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu

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

echo "--- 🧪 Testing"
set +e
Expand Down
36 changes: 2 additions & 34 deletions .buildkite/commands/save-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,8 @@

set -euo pipefail

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

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

# .buildkite/commands/prototype-build.sh -> build_and_upload_prototype_build
# -> prototype_flavor = 'Jalapeno'
# -> prototype_build_type = 'Debug'
echo "--- 🛠 Download Mobile App Dependencies [Assemble Mobile App]"
./gradlew :WooCommerce:assembleJalapenoDebug
echo ""

# .buildkite/commands/prototype-build.sh -> build_and_upload_prototype_build
# -> prototype_flavor = 'Jalapeno'
# -> prototype_build_type = 'Debug'
echo "--- 🛠 Download Wear App Dependencies [Assemble Wear App]"
./gradlew :WooCommerce-Wear:assembleJalapenoDebug
echo ""

# .buildkite/commands/lint.sh -> ./gradlew :WooCommerce:lintJalapenoDebug
echo "--- 🧹 Download Lint Dependencies [Lint Mobile App]"
./gradlew :WooCommerce:lintJalapenoDebug
echo ""

# .buildkite/commands/run-unit-tests.sh -> ./gradlew testJalapenoDebugUnitTest testDebugUnitTest
echo "--- 🧪 Download Unit Test Dependencies [Assemble Unit Tests]"
./gradlew assembleJalapenoDebugUnitTest assembleDebugUnitTest
echo ""

# .buildkite/commands/run-instrumented-tests.sh -> build_and_instrumented_test
# -> gradle(tasks: %w[assembleVanillaDebug assembleVanillaDebugAndroidTest])
echo "--- 🧪 Download Android Test Dependencies [Assemble Android Tests]"
./gradlew assembleJalapenoDebugAndroidTest
echo "--- 📦 Download Dependencies"
./gradlew downloadDependencies
echo ""

echo "--- 💾 Save Cache"
Expand Down
6 changes: 2 additions & 4 deletions .buildkite/schedules/dependency-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ agents:
queue: "android"

steps:
- label: "dependency cache"
command: |
echo "--- 💾 Download and Cache Dependencies"
.buildkite/commands/save-cache.sh
- label: "💾 Download and Cache Dependencies"
command: .buildkite/commands/save-cache.sh
plugins: [$CI_TOOLKIT]

notify:
Expand Down

0 comments on commit b45f1e6

Please sign in to comment.