diff --git a/.buildkite/commands/restore-cache.sh b/.buildkite/commands/restore-cache.sh new file mode 100755 index 000000000000..480ae6987901 --- /dev/null +++ b/.buildkite/commands/restore-cache.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e + +echo "--- ๐Ÿ’พ Restore Cache" +restore_gradle_dependency_cache || true diff --git a/.buildkite/commands/save-cache.sh b/.buildkite/commands/save-cache.sh new file mode 100755 index 000000000000..e7df0961e7be --- /dev/null +++ b/.buildkite/commands/save-cache.sh @@ -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 diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 72a067a8a1d4..d4528c266432 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -8,7 +8,7 @@ common_params: format: "junit" agents: - queue: "android" + queue: "android-staging" steps: ################# @@ -39,6 +39,7 @@ steps: - label: "๐Ÿ•ต๏ธ checkstyle" command: | + .buildkite/commands/restore-cache.sh ./gradlew checkstyle plugins: [$CI_TOOLKIT] artifact_paths: @@ -46,19 +47,24 @@ steps: - 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*.*" @@ -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 : @@ -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 : @@ -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 : @@ -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: @@ -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: @@ -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 : @@ -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 : @@ -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] diff --git a/.buildkite/schedules/dependency-cache.yml b/.buildkite/schedules/dependency-cache.yml new file mode 100644 index 000000000000..960751c865ef --- /dev/null +++ b/.buildkite/schedules/dependency-cache.yml @@ -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] diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars index b2f997500a36..37b8904850b1 100644 --- a/.buildkite/shared-pipeline-vars +++ b/.buildkite/shared-pipeline-vars @@ -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#94d9f7a3829cd21d9f31b5ee962178c26606c71e" export TEST_COLLECTOR="test-collector#v1.10.1"