Skip to content

Commit

Permalink
CI: Add restore cache and run on targeted pipeline related jobs only
Browse files Browse the repository at this point in the history
FYI: The targeted 'pipeline' related jobs are:
- Mobile App
- Lint
- Unit Tests
- Android Tests (Commented Out)

PS.1: The 'detekt' and 'checkstyle' jobs aren't targeted because they
only take about 30+ seconds of network request to download all the
dependencies needed for those specific jobs, which is about the same
time it takes for the dependency cache to actually be restored (20+
seconds). Thus, this optimization is not really worth it for these
specific jobs. For all those other jobs targeted, it take more than a
minute of network requests to download all the dependencies needed, and
as such worth the diff is worth it.
PS.2: Although the 'Android Tests' are commented-out, I chose to include
cache restoration into those as well, just in case they will be
reactivated at some point in the future.
  • Loading branch information
ParaskP7 committed Jan 15, 2025
1 parent 0f8561f commit 73c4cf2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
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
44 changes: 33 additions & 11 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ steps:
- "**/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 +79,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 +91,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 +103,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 +115,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 +127,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 +144,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 +156,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 +173,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]

0 comments on commit 73c4cf2

Please sign in to comment.