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

[CI] Cache C++ downloads #18595

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
71 changes: 39 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
aliases:
# Cache Management
- &restore-yarn-cache
- &restore-cache-yarn
keys:
- v1-yarn-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
# Fallback in case checksum fails
- v1-yarn-{{ arch }}-{{ .Branch }}-
# Fallback in case this is a first-time run on a fork
- v1-yarn-{{ arch }}-master-
- &save-yarn-cache
- v1-yarn-{{ arch }}-{{ checksum "package.json" }}
- v1-yarn-{{ arch }}-
- &save-cache-yarn
paths:
- node_modules
- ~/.cache/yarn
key: v1-yarn-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}
key: v1-yarn-{{ arch }}-{{ checksum "package.json" }}

- &restore-cache-analysis
keys:
- v1-analysis-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
# Fallback in case checksum fails
- v1-analysis-dependencies-{{ arch }}-{{ .Branch }}-
# Fallback in case this is a first-time run on a fork
- v1-analysis-dependencies-{{ arch }}-master-
- v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
- v1-analysis-dependencies-{{ arch }}-
- &save-cache-analysis
paths:
- bots/node_modules
- node_modules
key: v1-analysis-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
key: v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}

- &restore-cache-android-packages
keys:
- v1-android-sdkmanager-packages-{{ arch }}-{{ .Branch }}-api-26-alpha-{{ checksum "scripts/circle-ci-android-setup.sh" }}
# Fallback in case checksum fails
- v1-android-sdkmanager-packages-{{ arch }}-{{ .Branch }}-api-26-alpha-
# Fallback in case this is a first-time run on a fork
- v1-android-sdkmanager-packages-{{ arch }}-master-api-26-alpha-
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-{{ checksum "scripts/circle-ci-android-setup.sh" }}
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-
- &save-cache-android-packages
paths:
- /opt/android/sdk
key: v1-android-sdkmanager-packages-{{ arch }}-{{ .Branch }}-api-26-alpha-{{ checksum "scripts/circle-ci-android-setup.sh" }}
key: v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-{{ checksum "scripts/circle-ci-android-setup.sh" }}

- &restore-cache-gradle
keys:
Expand Down Expand Up @@ -66,7 +57,6 @@ aliases:
- &restore-cache-ndk
keys:
- v2-android-ndk-{{ arch }}-r10e-32-64-{{ checksum "scripts/circle-ci-android-setup.sh" }}
# Fallback in case checksum fails
- v2-android-ndk-{{ arch }}-r10e-32-64-
- &save-cache-ndk
paths:
Expand All @@ -89,6 +79,17 @@ aliases:
- ~/watchman
key: v1-watchman-{{ arch }}-v4.9.0

- &restore-cache-gradle-downloads
keys:
- v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
- v1-gradle-{{ arch }}-
- &save-cache-gradle-downloads
paths:
- ~/.gradle
- ReactAndroid/build/downloads
- ReactAndroid/build/third-party-ndk
key: v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}

# Branch Filtering
- &filter-only-master-stable
branches:
Expand Down Expand Up @@ -201,6 +202,10 @@ aliases:
./scripts/circleci/check_license.sh
./scripts/circleci/check_cache.sh
when: always

- &gradle-download-deps
name: Download C++ Dependencies
command: ./scripts/circleci/gradle_download_deps.sh

- &build-android-app
name: Build Android App
Expand Down Expand Up @@ -309,9 +314,9 @@ jobs:
- checkout
- run: *setup-artifacts

- restore-cache: *restore-yarn-cache
- restore-cache: *restore-cache-yarn
- run: *yarn
- save-cache: *save-yarn-cache
- save-cache: *save-cache-yarn

# Basic checks against the checkout, cache...
- run: *run-sanity-checks
Expand Down Expand Up @@ -357,9 +362,9 @@ jobs:
- checkout
- run: *setup-artifacts

- restore-cache: *restore-yarn-cache
- restore-cache: *restore-cache-yarn
- run: *yarn
- save-cache: *save-yarn-cache
- save-cache: *save-cache-yarn

- run: *run-js-tests

Expand Down Expand Up @@ -447,13 +452,16 @@ jobs:
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
- run: buck fetch ReactAndroid/src/test/...
- run: buck fetch ReactAndroid/src/androidTest/...
- run: ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders

- restore-cache: *restore-cache-gradle-downloads
- run: *gradle-download-deps
- save-cache: *save-cache-gradle-downloads

- run: *install-node
- run: *install-yarn
- restore-cache: *restore-yarn-cache
- restore-cache: *restore-cache-yarn
- run: *yarn
- save-cache: *save-yarn-cache
- save-cache: *save-cache-yarn

- run:
name: Publish React Native Package
Expand Down Expand Up @@ -512,10 +520,9 @@ jobs:
- run: buck fetch ReactAndroid/src/test/...
- run: buck fetch ReactAndroid/src/androidTest/...

# Gradle
- restore-cache: *restore-cache-gradle
- run: ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
- save-cache: *save-cache-gradle
- restore-cache: *restore-cache-gradle-downloads
- run: *gradle-download-deps
- save-cache: *save-cache-gradle-downloads

# Build and compile
- run: *build-android-app
Expand Down
5 changes: 5 additions & 0 deletions scripts/circleci/gradle_download_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders