From 0e984d3029e47612726bf199553f7abdf24843e5 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 15 May 2020 17:23:50 -0300 Subject: [PATCH] config.yml refactor --- .circleci/config.yml | 128 +++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 79 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 827b9e29b..1a1ad4861 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,41 @@ defaults: &defaults working_directory: ~/repo +install-node: &install-node + name: Install Node 10 + command: | + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash + source ~/.nvm/nvm.sh + # https://github.com/creationix/nvm/issues/1394 + set +e + nvm install 10 + echo 'export PATH="/home/circleci/.nvm/versions/node/v10.20.1/bin:$PATH"' >> ~/.bash_profile + source ~/.bash_profile + +install-npm-modules: &install-npm-modules + name: Install NPM modules + command: | + yarn + +install-apple-sim-utils: &install-apple-sim-utils + name: Install appleSimUtils + command: | + brew update + brew tap wix/brew + brew install wix/brew/applesimutils + +restore-npm-cache-linux: &restore-npm-cache-linux + - restore_cache: + name: Restore NPM cache + key: node-modules-{{ checksum "yarn.lock" }} + +save-npm-cache-linux: &save-npm-cache-linux + - save_cache: + key: node-modules-{{ checksum "yarn.lock" }} + name: Save NPM cache + paths: + - ./node_modules + version: 2 jobs: lint-testunit: @@ -14,14 +49,9 @@ jobs: steps: - checkout - - restore_cache: - name: Restore NPM cache - key: node-modules-{{ checksum "yarn.lock" }} + - run: *restore-npm-cache-linux - - run: - name: Install NPM modules - command: | - yarn + - run: *install-npm-modules - run: name: Lint @@ -38,11 +68,7 @@ jobs: command: | yarn codecov - - save_cache: - key: node-modules-{{ checksum "yarn.lock" }} - name: Save NPM cache - paths: - - ./node_modules + - run: *save-npm-cache-linux e2e-build: macos: @@ -58,27 +84,11 @@ jobs: name: Restore NPM cache key: node-v1-mac-{{ checksum "yarn.lock" }} - - run: - name: Install Node 10 - command: | - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash - source ~/.nvm/nvm.sh - # https://github.com/creationix/nvm/issues/1394 - set +e - nvm install 10 + - run: *install-node - - run: - name: Install appleSimUtils - command: | - brew update - brew tap wix/brew - brew install wix/brew/applesimutils + - run: *install-apple-sim-utils - - run: - name: Install NPM modules - command: | - yarn global add detox-cli - yarn + - run: *install-npm-modules - run: name: Rebuild Detox framework cache @@ -119,27 +129,11 @@ jobs: name: Restore NPM cache key: node-v1-mac-{{ checksum "yarn.lock" }} - - run: - name: Install Node 10 - command: | - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash - source ~/.nvm/nvm.sh - # https://github.com/creationix/nvm/issues/1394 - set +e - nvm install 10 + - run: *install-node - - run: - name: Install appleSimUtils - command: | - brew update - brew tap wix/brew - brew install wix/brew/applesimutils + - run: *install-apple-sim-utils - - run: - name: Install NPM modules - command: | - yarn global add detox-cli - yarn + - run: *install-npm-modules - run: name: Rebuild Detox framework cache @@ -175,25 +169,11 @@ jobs: steps: - checkout - - run: - name: Install Node 10 - command: | - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash - source ~/.nvm/nvm.sh - # https://github.com/creationix/nvm/issues/1394 - set +e - nvm install 10 - echo 'export PATH="/home/circleci/.nvm/versions/node/v10.20.1/bin:$PATH"' >> ~/.bash_profile - source ~/.bash_profile + - run: *install-node - - restore_cache: - name: Restore NPM cache - key: node-modules-{{ checksum "yarn.lock" }} + - run: *restore-npm-cache-linux - - run: - name: Install NPM modules - command: | - yarn + - run: *install-npm-modules - restore_cache: name: Restore gradle cache @@ -291,19 +271,9 @@ jobs: name: Restore NPM cache key: node-v1-mac-{{ checksum "yarn.lock" }} - - run: - name: Install Node 10 - command: | - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash - source ~/.nvm/nvm.sh - # https://github.com/creationix/nvm/issues/1394 - set +e - nvm install 10 + - run: *install-node - - run: - name: Install NPM modules - command: | - yarn + - run: *install-npm-modules - run: name: Update Fastlane