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 [without GRADLE_RO_DEP_CACHE] #21550

Draft
wants to merge 8 commits into
base: trunk
Choose a base branch
from
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
36 changes: 36 additions & 0 deletions .buildkite/commands/save-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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

echo "--- 🛠 Download Mobile App Dependencies [Assemble Jetpack App]"
./gradlew assembleJetpackJalapenoDebug
echo ""

echo "--- 🧹 Download Lint Dependencies [Lint Jetpack App]"
./gradlew lintJetpackJalapenoDebug
echo ""

echo "--- 🧹 Download Detekt Dependencies [Run Detekt]"
./gradlew detekt
echo ""

echo "--- 🧹 Download Checkstyle Dependencies [Run Checkstyle]"
./gradlew checkstyle
echo ""

echo "--- 🧪 Download Unit Test Dependencies [Assemble Unit Tests]"
./gradlew assembleJetpackJalapenoDebugUnitTest libs:processors:testClasses libs:image-editor:assembleDebugUnitTest libs:fluxc:assembleDebugUnitTest libs:login:assembleDebugUnitTest
echo ""

echo "--- 🧪 Download Android Test Dependencies [Assemble Android Tests]"
./gradlew assembleJetpackJalapenoDebugAndroidTest
echo ""

echo "--- 💾 Save Cache"
save_gradle_dependency_cache
48 changes: 36 additions & 12 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ common_params:
format: "junit"

agents:
queue: "android"
queue: "android-staging"

steps:
#################
Expand Down Expand Up @@ -39,26 +39,32 @@ steps:

- label: "🕵️ checkstyle"
command: |
.buildkite/commands/restore-cache.sh
./gradlew checkstyle
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/checkstyle/checkstyle.*"

- label: "🕵️ detekt"
command: |
.buildkite/commands/restore-cache.sh
./gradlew detekt
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/detekt/detekt.html"

- label: "🕵️ Lint WordPress"
command: ".buildkite/commands/lint.sh wordpress"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/lint.sh" "wordpress"
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/lint-results*.*"

- label: "🕵️ Lint Jetpack"
command: ".buildkite/commands/lint.sh jetpack"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/lint.sh" "jetpack"
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/lint-results*.*"
Expand All @@ -75,7 +81,9 @@ steps:
- group: "🔬 Unit Tests"
steps:
- label: "🔬 Unit Test WordPress"
command: ".buildkite/commands/run-unit-tests.sh wordpress"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/run-unit-tests.sh" "wordpress"
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR :
Expand All @@ -85,7 +93,9 @@ steps:
- "**/build/test-results/merged-test-results.xml"

- label: "🔬 Unit Test Processors"
command: ".buildkite/commands/run-unit-tests.sh processors"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/run-unit-tests.sh" "processors"
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR :
Expand All @@ -95,7 +105,9 @@ steps:
- "**/build/test-results/merged-test-results.xml"

- label: "🔬 Unit Test Image Editor"
command: ".buildkite/commands/run-unit-tests.sh image-editor"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/run-unit-tests.sh" "image-editor"
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR :
Expand All @@ -105,7 +117,9 @@ steps:
- "**/build/test-results/merged-test-results.xml"

- label: "🔬 Unit Test FluxC"
command: ".buildkite/commands/run-unit-tests.sh fluxc"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/run-unit-tests.sh" "fluxc"
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR:
Expand All @@ -115,7 +129,9 @@ steps:
- "**/build/test-results/merged-test-results.xml"

- label: "🔬 Unit Test Login"
command: ".buildkite/commands/run-unit-tests.sh login"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/run-unit-tests.sh" "login"
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR:
Expand All @@ -130,7 +146,9 @@ steps:
# - group: "🔬 Instrumented tests"
# steps:
# - label: ":wordpress: 🔬 Instrumented tests"
# command: ".buildkite/commands/run-instrumented-tests.sh wordpress"
# command: |
# .buildkite/commands/restore-cache.sh
# ".buildkite/commands/run-instrumented-tests.sh" "wordpress"
# plugins:
# - $CI_TOOLKIT
# - $TEST_COLLECTOR :
Expand All @@ -140,7 +158,9 @@ steps:
# - "**/build/instrumented-tests/**/*"

# - label: ":jetpack: 🔬 Instrumented tests"
# command: ".buildkite/commands/run-instrumented-tests.sh jetpack"
# command: |
# .buildkite/commands/restore-cache.sh
# ".buildkite/commands/run-instrumented-tests.sh" "jetpack"
# plugins:
# - $CI_TOOLKIT
# - $TEST_COLLECTOR :
Expand All @@ -155,11 +175,15 @@ steps:
- group: "📲 Prototype Builds"
steps:
- label: ":wordpress: :android: Prototype Build"
command: ".buildkite/commands/prototype-build.sh wordpress"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/prototype-build.sh" "wordpress"
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]

- label: ":jetpack: :android: Prototype Build"
command: ".buildkite/commands/prototype-build.sh jetpack"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/prototype-build.sh" "jetpack"
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]
12 changes: 12 additions & 0 deletions .buildkite/schedules/dependency-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
---

agents:
queue: "android-staging"

steps:
- label: "dependency cache"
command: |
echo "--- 💾 Download and Cache Dependencies"
.buildkite/commands/save-cache.sh
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.7.1"
export CI_TOOLKIT="automattic/a8c-ci-toolkit#1d7a5b2b01d925e0c38d15b924c132763f715a48"
export TEST_COLLECTOR="test-collector#v1.10.1"
Loading