diff --git a/.circleci/config.yml b/.circleci/config.yml index bcb01f2a8..4ce6f75d0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,96 +8,6 @@ macos: &macos bash-env: &bash-env 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 # EXECUTORS @@ -115,27 +25,140 @@ commands: type: string steps: - checkout - - attach_workspace: at: . - - - restore_cache: *restore-npm-cache-mac - - - restore_cache: *restore-brew-cache - - - run: *install-node - - - run: *install-apple-sim-utils - - - run: *install-npm-modules - - - run: *rebuild-detox - + - restore-npm-cache-mac + - restore-brew-cache + - install-node + - install-apple-sim-utils + - install-npm-modules + - rebuild-detox - run: name: Test command: | npx detox test << parameters.folder >> --configuration ios.sim.release --cleanup + 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-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }} + + save-brew-cache: + description: Save brew cache + steps: + - save_cache: + key: brew-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }} + paths: + - /usr/local/Homebrew + + install-apple-sim-utils: + description: Install appleSimUtils + steps: + - run: + command: | + brew update + 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 + # JOBS jobs: lint-testunit: @@ -149,9 +172,9 @@ jobs: steps: - checkout - - restore_cache: *restore-npm-cache-linux + - restore-npm-cache-linux - - run: *install-npm-modules + - install-npm-modules - run: name: Lint @@ -168,7 +191,7 @@ jobs: command: | yarn codecov - - save_cache: *save-npm-cache-linux + - save-npm-cache-linux # E2E e2e-build: @@ -177,17 +200,17 @@ jobs: steps: - checkout - - restore_cache: *restore-npm-cache-mac + - restore-npm-cache-mac - - restore_cache: *restore-brew-cache + - restore-brew-cache - - run: *install-node + - install-node - - run: *install-apple-sim-utils + - install-apple-sim-utils - - run: *install-npm-modules + - install-npm-modules - - run: *rebuild-detox + - rebuild-detox - run: name: Build @@ -199,9 +222,10 @@ jobs: paths: - ios/build/Build/Products/Release-iphonesimulator/RocketChatRN.app - - save_cache: *save-npm-cache-mac + - save-npm-cache-mac + + - save-brew-cache - - save_cache: *save-brew-cache e2e-test-onboarding: executor: mac-env @@ -236,15 +260,15 @@ jobs: steps: - 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: name: Configure Gradle @@ -304,9 +328,9 @@ jobs: - store_artifacts: 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: root: . @@ -330,7 +354,7 @@ jobs: command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json working_directory: android - - run: *update-fastlane-android + - update-fastlane-android - run: name: Fastlane Play Store Upload @@ -344,15 +368,15 @@ jobs: steps: - 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: name: Set Google Services @@ -390,9 +414,9 @@ jobs: fi working_directory: ios - - save_cache: *save-npm-cache-mac + - save-npm-cache-mac - - save_cache: *save-gems-cache + - save-gems-cache - store_artifacts: path: ios/RocketChatRN.ipa @@ -412,9 +436,9 @@ jobs: - attach_workspace: at: ios - - restore_cache: *restore-gems-cache + - restore-gems-cache - - run: *update-fastlane-ios + - update-fastlane-ios - run: name: Fastlane Tesflight Upload @@ -422,7 +446,7 @@ jobs: bundle exec fastlane ios beta working_directory: ios - - save_cache: *save-gems-cache + - save-gems-cache workflows: build-and-test: