diff --git a/.buildkite/commands/restore-cache.sh b/.buildkite/commands/restore-cache.sh new file mode 100755 index 00000000000..480ae698790 --- /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 00000000000..7be11f2a128 --- /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 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 Detekt Dependencies [Run Detekt]" +./gradlew detektAll +echo "" + +echo "--- ๐Ÿงช Download Unit Test Dependencies [Assemble Unit Tests]" +./gradlew assembleJalapenoDebugUnitTest lib:cardreader:assembleDebugUnitTest +echo "" + +echo "--- ๐Ÿงช Download Android Test Dependencies [Assemble Android Tests]" +./gradlew assembleJalapenoDebugAndroidTest +echo "" + +echo "--- ๐Ÿ’พ Save Cache" +save_gradle_dependency_cache diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 360aad54c4b..0be255bc9a7 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -5,8 +5,8 @@ common_params: # Common plugin settings to use with the `plugins` key. - &test_collector_common_params - files: "WooCommerce/build/buildkite-test-analytics/*.xml" - format: "junit" + files: "WooCommerce/build/buildkite-test-analytics/*.xml" + format: "junit" agents: queue: "android" @@ -36,14 +36,16 @@ steps: - label: "detekt" command: | - echo "--- ๐Ÿงน Linting" + .buildkite/commands/restore-cache.sh ./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 plugins: [$CI_TOOLKIT] artifact_paths: - "**/build/reports/lint-results*.*" @@ -61,12 +63,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] @@ -76,7 +80,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 : @@ -86,7 +92,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 : diff --git a/.buildkite/schedules/dependency-cache.yml b/.buildkite/schedules/dependency-cache.yml new file mode 100644 index 00000000000..7455533db01 --- /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" + +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 307dd62e628..96a409dc9e3 100644 --- a/.buildkite/shared-pipeline-vars +++ b/.buildkite/shared-pipeline-vars @@ -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#94d9f7a3829cd21d9f31b5ee962178c26606c71e" export TEST_COLLECTOR="test-collector#v1.10.1" -