diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..60a9af4 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,47 @@ +version: 2 +jobs: + build: + environment: + PATH: /root/.yarn/bin:/usr/local/bin:/usr/bin:/bin + YARN_VERSION: 0.20.3 + docker: + - image: node:6.10.0 + working_directory: ~/baberutv + steps: + - checkout + - restore_cache: + key: baberutv-yarn-v{{ .Environment.CIRCLE_BUILD_NUM }} + - run: + name: Install Yarn + command: | + if [[ ! -n $(which yarn) || $(yarn --version) != "${YARN_VERSION}" ]]; then + echo "Download and install Yarn." + curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} + else + echo "The correct version of Yarn is already installed." + fi + - save_cache: + key: baberutv-yarn-v{{ .Environment.CIRCLE_BUILD_NUM }} + paths: + - ~/.yarn + - restore_cache: + key: baberutv-dependencies-{{ checksum "yarn.lock" }} + - run: + name: Install Dependencies + command: yarn + - save_cache: + key: baberutv-dependencies-{{ checksum "yarn.lock" }} + paths: + - ~/.cache/yarn + - ./node_modules + - run: + name: Run Tests + command: yarn test + - run: + name: Post-Test + command: cat ./coverage/lcov.info | $(yarn bin)/coveralls || echo "1" + - deploy: + command: | + if echo ${CIRCLE_TAG} | grep -Eq "^v\\d(\\.\\d+)*$"; then + ./scripts/deploy.sh + fi diff --git a/circle.yml b/circle.yml deleted file mode 100644 index be6b095..0000000 --- a/circle.yml +++ /dev/null @@ -1,40 +0,0 @@ -general: - branches: - ignore: - - gh-pages - -machine: - environment: - YARN_VERSION: 0.20.3 - PATH: ${HOME}/.yarn/bin:${PATH} - node: - version: 6.10.0 - -dependencies: - pre: - - | - if [[ ! -n $(which yarn) || $(yarn --version) != ${YARN_VERSION} ]]; then - echo "Download and install Yarn." - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION - else - echo "The correct version of Yarn is already installed." - fi - override: - - yarn - post: - - yarn build -- --env test - cache_directories: - - ~/.cache/yarn - - ~/.yarn - -test: - override: - - yarn test - post: - - cat ./coverage/lcov.info | $(yarn bin)/coveralls || echo "1" - -deployment: - publish: - tag: /v\d+(\.\d+)*/ - commands: - - ./scripts/deploy.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 38a7d9f..b1a3bab 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -8,7 +8,12 @@ cd $(dirname $0)/.. rm -rf build yarn build -- --env production cd build/public -cp ../../circle.yml . +cat <