nypublicradio/ember-hifi

View on GitHub
circle.yml

Summary

Maintainability
Test Coverage
version: 2

defaults: &defaults
  docker:
    - image: circleci/node:10-browsers
      environment:
        COVERAGE: true
        JOBS: 2

jobs:
  install:
    <<: *defaults

    steps:
      - checkout

      - restore_cache:
          key: node-deps-{{ checksum "yarn.lock" }}
      - run:
          name: Install node dependencies
          command: |
            if [ ! -d node_modules ]; then
              yarn --pure-lockfile
            fi
      - run:
          name: Install CodeClimate
          command: |
            mkdir -p ../codeclimate
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ../codeclimate/cc-test-reporter
            chmod +x ../codeclimate/cc-test-reporter
      - save_cache:
          key: node-deps-{{ checksum "yarn.lock" }}
          paths:
            - node_modules
            - ../codeclimate
  test:
    <<: *defaults

    steps:
      - checkout
      - restore_cache:
          key: node-deps-{{ checksum "yarn.lock" }}
      - run:
          name: Set up CodeClimate
          command: ../codeclimate/cc-test-reporter before-build
      - run:
          name: Test
          environment:
            CIRCLE_TEST_REPORTS: test-results
          command: npx ember test
      - run:
          name: Upload CodeClimate test results
          command: ../codeclimate/cc-test-reporter after-build --exit-code $?
      - store_test_results:
          path: test-results/

  deploy:
    <<: *defaults

    steps:
      - checkout
      - restore_cache:
          key: node-deps-{{ checksum "yarn.lock" }}
      - add_ssh_keys:
          fingerprints:
            - "11:a2:20:e3:5b:2e:16:b1:d4:3e:05:e5:1c:5f:4c:26"
      - run:
          name: Deploy to GitHub Pages
          command: |
            git config --global user.email "deploy@circleci"
            git config --global user.name "deploy"
            npx ember deploy production

workflows:
  version: 2
  install-test-deploy:
    jobs:
      - install:
          filters:
            tags:
              only: /.*/
      - test:
          filters:
            tags:
              only: /.*/
          requires:
            - install
      - deploy:
          requires:
            - test
          filters:
            branches:
              only: master