version: 2.1
jobs:
  build:
    docker:
      - image: circleci/ruby:2.5-node
      - image: circleci/mysql:5.7.22
        environment:
          MYSQL_ROOT_HOST: '%'
          MYSQL_USER: 'root'
          MYSQL_ROOT_PASSWORD: 'root'
          MYSQL_DATABASE: 'qpixel_test'

    working_directory: ~/qpixel

    steps:
      - run:
          name: Install Git
          command: |
            sudo apt-get -qq update
            sudo apt-get -y install git
      - checkout
      - restore_cache:
          keys:
            - qpixel-{{ checksum "Gemfile" }}
            - qpixel-
      - run:
          name: Install Bundler & gems
          command: |
            gem install bundler
            bundle install --path=~/gems
      - save_cache:
          key: qpixel-{{ checksum "Gemfile" }}
          paths:
            - ~/gems
      - run:
          name: Prepare database
          environment:
            RAILS_ENV: test
          command: |
            cp config/database.sample.yml config/database.yml
            bundle exec rails db:create
            bundle exec rails db:schema:load
            bundle exec rails db:migrate
            bundle exec rails test:prepare
      - run:
          name: Current revision
          command: |
            git rev-parse $(git rev-parse --abbrev-ref HEAD)
      - run:
          name: Rubocop
          command: |
            bundle exec rubocop
      - run:
          name: Test
          command: |
            bundle exec rails test
      - store_test_results:
          path: "~/qpixel/test/reports"
version: 2.1
jobs:
  build:
    docker:
      - image: circleci/ruby:2.5-node
      - image: circleci/mysql:5.7.22
        environment:
          MYSQL_ROOT_HOST: '%'
          MYSQL_USER: 'root'
          MYSQL_ROOT_PASSWORD: 'root'
          MYSQL_DATABASE: 'qpixel_test'
      - image: circleci/redis:6.0.0

    working_directory: ~/qpixel

    steps:
      - run:
          name: Install Git
          command: |
            sudo apt-get -qq update
            sudo apt-get -y install git
      - checkout
      - restore_cache:
          keys:
            - qpixel-{{ checksum "Gemfile" }}
            - qpixel-
      - run:
          name: Install Bundler & gems
          command: |
            gem install bundler
            bundle install --path=~/gems
      - save_cache:
          key: qpixel-{{ checksum "Gemfile" }}
          paths:
            - ~/gems
      - run:
          name: Prepare database
          environment:
            RAILS_ENV: test
          command: |
            cp config/database.sample.yml config/database.yml
            bundle exec rails db:create
            bundle exec rails db:schema:load
            bundle exec rails db:migrate
            bundle exec rails test:prepare
      - run:
          name: Current revision
          command: |
            git rev-parse $(git rev-parse --abbrev-ref HEAD)
      - run:
          name: Rubocop
          command: |
            bundle exec rubocop
      - run:
          name: Test
          command: |
            bundle exec rails test
      - store_test_results:
          path: "~/qpixel/test/reports"
Add redis to Circle bundle
Add redis to Circle bundle
