Compare commits

...

16 Commits

Author SHA1 Message Date
Dan Caseley e19665e3e6 Merge branch 'develop' into chore.circleci_caching 2020-07-26 13:44:11 +01:00
Dan Caseley 8c072c3b82 Merge branch 'develop' into chore.circleci_caching 2020-07-22 22:10:14 +01:00
Dan Caseley f44ad00f85 Prevent brew auto-cleanup 2020-07-22 21:03:41 +01:00
Dan Caseley 905a3364cf Prevent brew auto-update 2020-07-22 21:01:51 +01:00
Dan Caseley 082a36ad85 Invalidate previous app caches 2020-07-22 16:47:46 +01:00
Dan Caseley 5de294bfd3 Only cache downloaded Brew things 2020-07-22 13:45:45 +01:00
Dan Caseley cd3ede8903 Don't key brew caching on unrelated things - any hit is better than none 2020-07-22 13:45:45 +01:00
Dan Caseley 93771b67ad Remove unused "brew update"
Brew version is maintained by Circle, and we don't care about formulae
2020-07-22 13:45:45 +01:00
Dan Caseley b76fed827d
Remove debugging steps 2020-07-22 11:08:28 +01:00
Dan Caseley 8911a3b0d1
Don't install simulator utils for building 2020-07-22 11:03:18 +01:00
Dan Caseley d78cfd59c3
Fix fancy quotes for useful ones
Note to self: Don't copy-n-paste
2020-07-22 09:13:51 +01:00
Dan Caseley 0e5389539c
Debug output for app cache restore check 2020-07-21 17:42:31 +01:00
Dan Caseley ebcdc3eb5d
Fix app cache check - apps are directories not files 2020-07-21 17:00:15 +01:00
Dan Caseley 19c129d4d7
Merge branch 'develop' into chore.circleci_caching 2020-07-21 16:58:04 +01:00
Dan Caseley b679c6894f Try caching built iOS app 2020-07-21 12:01:17 +01:00
Dan Caseley e509a7a6e8 Move YAML anchors to CircleCI commands 2020-07-20 16:37:51 +01:00
1 changed files with 198 additions and 140 deletions

View File

@ -8,96 +8,6 @@ macos: &macos
bash-env: &bash-env bash-env: &bash-env
BASH_ENV: "~/.nvm/nvm.sh" BASH_ENV: "~/.nvm/nvm.sh"
install-npm-modules: &install-npm-modules
name: Install NPM modules
command: yarn
restore-npm-cache-linux: &restore-npm-cache-linux
name: Restore NPM cache
key: node-modules-{{ checksum "yarn.lock" }}
save-npm-cache-linux: &save-npm-cache-linux
key: node-modules-{{ checksum "yarn.lock" }}
name: Save NPM cache
paths:
- ./node_modules
restore-npm-cache-mac: &restore-npm-cache-mac
name: Restore NPM cache
key: node-v1-mac-{{ checksum "yarn.lock" }}
save-npm-cache-mac: &save-npm-cache-mac
key: node-v1-mac-{{ checksum "yarn.lock" }}
name: Save NPM cache
paths:
- ./node_modules
install-node: &install-node
name: Install Node
command: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.nvm/nvm.sh
INSTALLED_NODE=`nvm which current`
echo "export PATH=\"${INSTALLED_NODE%%/node}:\$PATH\"" >> ~/.bash_profile
source ~/.bash_profile
restore-gems-cache: &restore-gems-cache
name: Restore gems cache
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
save-gems-cache: &save-gems-cache
name: Save gems cache
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
paths:
- vendor/bundle
update-fastlane-ios: &update-fastlane-ios
name: Update Fastlane
command: |
echo "ruby-2.6.4" > ~/.ruby-version
bundle install
working_directory: ios
update-fastlane-android: &update-fastlane-android
name: Update Fastlane
command: |
echo "ruby-2.6.4" > ~/.ruby-version
bundle install
working_directory: android
save-gradle-cache: &save-gradle-cache
name: Save gradle cache
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
paths:
- ~/.gradle
restore_cache: &restore-gradle-cache
name: Restore gradle cache
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
restore-brew-cache: &restore-brew-cache
name: Restore Brew cache
key: brew-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }}
save-brew-cache: &save-brew-cache
name: Save brew cache
key: brew-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }}
paths:
- /usr/local/Homebrew
install-apple-sim-utils: &install-apple-sim-utils
name: Install appleSimUtils
command: |
brew update
brew tap wix/brew
brew install wix/brew/applesimutils
rebuild-detox: &rebuild-detox
name: Rebuild Detox framework cache
command: |
npx detox clean-framework-cache
npx detox build-framework-cache
version: 2.1 version: 2.1
# EXECUTORS # EXECUTORS
@ -115,31 +25,180 @@ commands:
type: string type: string
steps: steps:
- checkout - checkout
- restore-npm-cache-mac
- attach_workspace: - restore-brew-cache
at: . - restore-app-cache
- install-node
- restore_cache: *restore-npm-cache-mac - install-apple-sim-utils
- install-npm-modules
- restore_cache: *restore-brew-cache - rebuild-detox
- run: *install-node
- run: *install-apple-sim-utils
- run: *install-npm-modules
- run: *rebuild-detox
- run: - run:
name: Test name: Test
command: | command: |
npx detox test << parameters.folder >> --configuration ios.sim.release --cleanup npx detox test << parameters.folder >> --configuration ios.sim.release --cleanup
when: always when: always
- store_artifacts: - store_artifacts:
path: ./artifacts path: ./artifacts
install-npm-modules:
description: Install NPM modules
steps:
- run: yarn
restore-npm-cache-linux:
description: Restore NPM cache
steps:
- restore_cache:
key: node-modules-{{ checksum "yarn.lock" }}
save-npm-cache-linux:
description: Save NPM cache
steps:
- save_cache:
key: node-modules-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
restore-npm-cache-mac:
description: Restore NPM cache
steps:
- restore_cache:
key: node-v1-mac-{{ checksum "yarn.lock" }}
save-npm-cache-mac:
description: Save NPM cache
steps:
- save_cache:
key: node-v1-mac-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
install-node:
description: Install Node
steps:
- run:
command: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.nvm/nvm.sh
INSTALLED_NODE=`nvm which current`
echo "export PATH=\"${INSTALLED_NODE%%/node}:\$PATH\"" >> ~/.bash_profile
source ~/.bash_profile
restore-gems-cache:
description: Restore gems cache
steps:
- restore_cache:
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
save-gems-cache:
description: Save gems cache
steps:
- save_cache:
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
paths:
- vendor/bundle
update-fastlane-ios:
description: Update Fastlane
steps:
- run:
command: |
echo "ruby-2.6.4" > ~/.ruby-version
bundle install
working_directory: ios
update-fastlane-android:
description: Update Fastlane
steps:
- run:
command: |
echo "ruby-2.6.4" > ~/.ruby-version
bundle install
working_directory: android
restore-gradle-cache:
description: Restore gradle cache
steps:
- restore_cache:
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
save-gradle-cache:
description: Save gradle cache
steps:
- save_cache:
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
paths:
- ~/.gradle
restore-brew-cache:
description: Restore Brew cache
steps:
- restore_cache:
key: brew-mac
save-brew-cache:
description: Save brew cache
steps:
- save_cache:
key: brew-mac
paths:
- ~/Library/Caches/Homebrew
- /usr/local/Homebrew/Library/Taps/
install-apple-sim-utils:
description: Install appleSimUtils
steps:
- run:
command: |
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew tap wix/brew
brew install wix/brew/applesimutils
rebuild-detox:
description: Rebuild Detox framework cache
steps:
- run:
command: |
npx detox clean-framework-cache
npx detox build-framework-cache
save-app-cache:
description: Restore previously built app
steps:
- run:
name: Generate cache key for app source
command: |
echo $(git rev-parse HEAD:app) > "./app-git-revision.txt"
- save_cache:
key: iOSDetoxRelease-v3-{{ checksum "yarn.lock" }}-{{ checksum "ios/Podfile.lock" }}-{{ checksum "./app-git-revision.txt" }}
paths:
- ios/build/Build/Products/Release-iphonesimulator/RocketChatRN.app
restore-app-cache:
description: Save built app to cache
steps:
- run:
name: Generate cache key for app source
command: |
echo $(git rev-parse HEAD:app) > "./app-git-revision.txt"
- restore_cache:
key: iOSDetoxRelease-v3-{{ checksum "yarn.lock" }}-{{ checksum "ios/Podfile.lock" }}-{{ checksum "./app-git-revision.txt" }}
did-restore-app-cache:
description: Tests to see if an app was restored from the restore-app-cache job
steps:
- run:
name: if cache exists exit
command: |
FILE=/Users/distiller/project/ios/build/Build/Products/Release-iphonesimulator/RocketChatRN.app
if [ -e "$FILE" ]; then
echo "App restored from cache. Halting build."
circleci step halt
else
echo "Suitable app not cached. Continuing build."
fi
# JOBS # JOBS
jobs: jobs:
lint-testunit: lint-testunit:
@ -153,9 +212,9 @@ jobs:
steps: steps:
- checkout - checkout
- restore_cache: *restore-npm-cache-linux - restore-npm-cache-linux
- run: *install-npm-modules - install-npm-modules
- run: - run:
name: Lint name: Lint
@ -172,7 +231,7 @@ jobs:
command: | command: |
yarn codecov yarn codecov
- save_cache: *save-npm-cache-linux - save-npm-cache-linux
# E2E # E2E
e2e-build: e2e-build:
@ -181,31 +240,30 @@ jobs:
steps: steps:
- checkout - checkout
- restore_cache: *restore-npm-cache-mac - restore-app-cache
- restore_cache: *restore-brew-cache - did-restore-app-cache
- run: *install-node - restore-npm-cache-mac
- run: *install-apple-sim-utils - restore-brew-cache
- run: *install-npm-modules - install-node
- run: *rebuild-detox - install-npm-modules
- rebuild-detox
- run: - run:
name: Build name: Build
command: | command: |
npx detox build --configuration ios.sim.release npx detox build --configuration ios.sim.release
- persist_to_workspace: - save-npm-cache-mac
root: .
paths:
- ios/build/Build/Products/Release-iphonesimulator/RocketChatRN.app
- save_cache: *save-npm-cache-mac - save-brew-cache
- save_cache: *save-brew-cache - save-app-cache
e2e-test-onboarding: e2e-test-onboarding:
executor: mac-env executor: mac-env
@ -240,15 +298,15 @@ jobs:
steps: steps:
- checkout - checkout
- run: *install-node - install-node
- restore_cache: *restore-npm-cache-linux - restore-npm-cache-linux
- run: *install-npm-modules - install-npm-modules
- run: *update-fastlane-android - update-fastlane-android
- restore_cache: *restore-gradle-cache - restore-gradle-cache
- run: - run:
name: Configure Gradle name: Configure Gradle
@ -308,9 +366,9 @@ jobs:
- store_artifacts: - store_artifacts:
path: android/app/build/outputs path: android/app/build/outputs
- save_cache: *save-npm-cache-linux - save-npm-cache-linux
- save_cache: *save-gradle-cache - save-gradle-cache
- persist_to_workspace: - persist_to_workspace:
root: . root: .
@ -334,7 +392,7 @@ jobs:
command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json
working_directory: android working_directory: android
- run: *update-fastlane-android - update-fastlane-android
- run: - run:
name: Fastlane Play Store Upload name: Fastlane Play Store Upload
@ -348,15 +406,15 @@ jobs:
steps: steps:
- checkout - checkout
- restore_cache: *restore-gems-cache - restore-gems-cache
- restore_cache: *restore-npm-cache-mac - restore-npm-cache-mac
- run: *install-node - install-node
- run: *install-npm-modules - install-npm-modules
- run: *update-fastlane-ios - update-fastlane-ios
- run: - run:
name: Set Google Services name: Set Google Services
@ -394,9 +452,9 @@ jobs:
fi fi
working_directory: ios working_directory: ios
- save_cache: *save-npm-cache-mac - save-npm-cache-mac
- save_cache: *save-gems-cache - save-gems-cache
- store_artifacts: - store_artifacts:
path: ios/RocketChatRN.ipa path: ios/RocketChatRN.ipa
@ -416,9 +474,9 @@ jobs:
- attach_workspace: - attach_workspace:
at: ios at: ios
- restore_cache: *restore-gems-cache - restore-gems-cache
- run: *update-fastlane-ios - update-fastlane-ios
- run: - run:
name: Fastlane Tesflight Upload name: Fastlane Tesflight Upload
@ -426,7 +484,7 @@ jobs:
bundle exec fastlane ios beta bundle exec fastlane ios beta
working_directory: ios working_directory: ios
- save_cache: *save-gems-cache - save-gems-cache
workflows: workflows:
build-and-test: build-and-test: