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

[Dependency Cache] Enable Dependency Cache on CI #21584

Merged
merged 9 commits into from
Jan 17, 2025
2 changes: 2 additions & 0 deletions .buildkite/commands/lint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

.buildkite/commands/restore-cache.sh

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

Expand Down
2 changes: 2 additions & 0 deletions .buildkite/commands/prototype-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

.buildkite/commands/restore-cache.sh

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

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

set -e

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

.buildkite/commands/restore-cache.sh

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

Expand Down
2 changes: 2 additions & 0 deletions .buildkite/commands/run-unit-tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

.buildkite/commands/restore-cache.sh

echo "--- 🧪 Testing"
set +e
if [ "$1" == "wordpress" ]; then
Expand Down
40 changes: 40 additions & 0 deletions .buildkite/commands/save-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

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_$1_prototype_build
# -> PROTOTYPE_BUILD_FLAVOR = 'Jalapeno'
# -> PROTOTYPE_BUILD_TYPE = 'Debug'
echo "--- 🛠 Download Mobile App Dependencies [Assemble Jetpack App]"
./gradlew assembleJetpackJalapenoDebug
echo ""

# .buildkite/commands/lint.sh -> ./gradlew lintJetpackVanillaRelease
echo "--- 🧹 Download Lint Dependencies [Lint Jetpack App]"
./gradlew lintJetpackJalapenoDebug
echo ""

# .buildkite/commands/run-unit-tests.sh -> ./gradlew $test_suite
# -> test_suite="testWordpressVanillaRelease koverXmlReportWordpressVanillaRelease"
# -> test_suite=":libs:processors:test :libs:processors:koverXmlReport"
# -> test_suite=":libs:image-editor:testReleaseUnitTest :libs:image-editor:koverXmlReportRelease"
# -> test_suite=":libs:fluxc:testReleaseUnitTest :libs:fluxc:koverXmlReportRelease"
# -> test_suite=":libs:login:testReleaseUnitTest :libs:login:koverXmlReportRelease"
echo "--- 🧪 Download Unit Test Dependencies [Assemble Unit Tests]"
./gradlew assembleJetpackJalapenoDebugUnitTest assembleDebugUnitTest testClasses
echo ""

# .buildkite/commands/run-instrumented-tests.sh -> build_and_run_instrumented_test
# -> gradle(tasks: ["WordPress:assemble#{app.to_s.capitalize}VanillaDebug", "WordPress:assemble#{app.to_s.capitalize}VanillaDebugAndroidTest"])
echo "--- 🧪 Download Android Test Dependencies [Assemble Android Tests]"
./gradlew assembleJetpackJalapenoDebugAndroidTest
echo ""

echo "--- 💾 Save Cache"
save_gradle_dependency_cache
24 changes: 24 additions & 0 deletions .buildkite/schedules/dependency-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
---

agents:
queue: "android"

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

notify:
- slack:
channels:
- "#android-core-notifs"
message: "The dependency cache has been updated."
if: build.state == "passed"
- slack:
channels:
- "#android-core-notifs"
message: "Failure to update the dependency cache."
if: build.state == "failed"
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.7.1"
export CI_TOOLKIT="automattic/a8c-ci-toolkit#3.9.1"
export TEST_COLLECTOR="test-collector#v1.10.1"
Loading