From fbbba5818364b0a969d8829d00dcf9328120eace Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Sun, 14 May 2017 23:08:13 -0700 Subject: [PATCH] Migrate to CircleCI v2 (#1517) Use the new Docker-based, beta version of CircleCI. This adds a docker image that has the correct deps to run flow, and then migrates from the old circle.yml format to the new. This gets test runs wayyyyy down. Earlier today, on the old stack, before optimizations, we were at > 9 min for PR builds (aka, CI runs without a website deploy). The build for this PR ran in 1 min 33 seconds. Woo! --- packages/react-navigation/circle.yml | 64 +++++++++---------- .../scripts/build-push-docker.sh | 6 ++ .../react-navigation/scripts/ci.Dockerfile | 6 ++ .../react-navigation/scripts/compile-docs.js | 0 packages/react-navigation/scripts/test.sh | 2 +- 5 files changed, 44 insertions(+), 34 deletions(-) create mode 100755 packages/react-navigation/scripts/build-push-docker.sh create mode 100644 packages/react-navigation/scripts/ci.Dockerfile mode change 100644 => 100755 packages/react-navigation/scripts/compile-docs.js diff --git a/packages/react-navigation/circle.yml b/packages/react-navigation/circle.yml index ee031822..1e122c92 100644 --- a/packages/react-navigation/circle.yml +++ b/packages/react-navigation/circle.yml @@ -1,33 +1,31 @@ -machine: - node: - version: 6 - environment: - PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin" - -dependencies: - pre: - - curl -o- -L https://yarnpkg.com/install.sh | bash - cache_directories: - - ~/.cache/yarn - - ./website/node_modules - - ./examples/NavigationPlayground/node_modules - - ./examples/ReduxExample/node_modules - override: - - yarn - - cd website && yarn - - cd examples/NavigationPlayground && yarn - - cd examples/ReduxExample && yarn - -test: - override: - - ./scripts/test.sh: - parallel: true - post: - - yarn codecov - -deployment: - website-prod: - branch: master - commands: - - yarn run build-docs - - ./scripts/deploy-website.sh +version: 2 +jobs: + build: + docker: + - image: reactcommunity/node-ci:7.10.0 # custom image -- includes ocaml, libelf1, Yarn + parallelism: 3 + working_directory: ~/react-navigation + steps: + - checkout + - restore_cache: + key: v1-react-navigation-{{ .Branch }} # generate cache per branch + - run: + command: | + yarn + cd website && yarn && cd ../ + cd examples/NavigationPlayground && yarn && cd ../../ + cd examples/ReduxExample && yarn && cd ../../ + - save_cache: + key: v1-react-navigation-{{ .Branch }} # generate cache per branch + paths: + - ~/.cache/yarn + - ~/react-navigation/website/node_modules + - ~/react-navigation/examples/NavigationPlayground/node_modules + - ~/react-navigation/examples/ReduxExample/node_modules + - run: ./scripts/test.sh + - deploy: + command: | + if [ "${CIRCLE_BRANCH}" == "master" ]; then + yarn run build-docs + ./scripts/deploy-website.sh + fi diff --git a/packages/react-navigation/scripts/build-push-docker.sh b/packages/react-navigation/scripts/build-push-docker.sh new file mode 100755 index 00000000..4b6ba333 --- /dev/null +++ b/packages/react-navigation/scripts/build-push-docker.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -eo pipefail + +docker build -t reactcommunity/node-ci:7.10.0 -f ./ci.Dockerfile . +docker push reactcommunity/node-ci:7.10.0 diff --git a/packages/react-navigation/scripts/ci.Dockerfile b/packages/react-navigation/scripts/ci.Dockerfile new file mode 100644 index 00000000..f9ad7a5d --- /dev/null +++ b/packages/react-navigation/scripts/ci.Dockerfile @@ -0,0 +1,6 @@ +FROM node:7.10.0 + +RUN apt-get update -y && \ + apt-get install -y ocaml libelf1 && \ + rm -rf /var/lib/apt/lists/* && \ + curl -o- -L https://yarnpkg.com/install.sh | bash diff --git a/packages/react-navigation/scripts/compile-docs.js b/packages/react-navigation/scripts/compile-docs.js old mode 100644 new mode 100755 diff --git a/packages/react-navigation/scripts/test.sh b/packages/react-navigation/scripts/test.sh index 2914d4f1..dce53d7e 100755 --- a/packages/react-navigation/scripts/test.sh +++ b/packages/react-navigation/scripts/test.sh @@ -3,7 +3,7 @@ set -eo pipefail case $CIRCLE_NODE_INDEX in - 0) yarn test ;; + 0) yarn test && yarn codecov ;; 1) cd examples/NavigationPlayground && yarn test ;; 2) cd examples/ReduxExample && yarn test ;; esac