ArtOfCode-/qpixel

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2.1
jobs:
  test:
    docker:
      - image: circleci/ruby:2.6.6-node
      - image: circleci/mysql:8.0.20
        command: [--default-authentication-plugin=mysql_native_password]
        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 packages
          command: |
            sudo apt-get -qq update
            sudo apt-get -y install git libmariadb-dev libmagickwand-dev
      - 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 config & database
          environment:
            RAILS_ENV: test
          command: |
            cp config/database.sample.yml config/database.yml
            cp config/storage.sample.yml config/storage.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: Coveralls token
          command: |
            echo "repo_token: $COVERALLS_REPO_TOKEN" > .coveralls.yml
      - run:
          name: Test
          command: |
            bundle exec rails test
      - store_test_results:
          path: "~/qpixel/test/reports"

  rubocop:
    docker:
      - image: circleci/ruby:2.6.6-node

    working_directory: ~/qpixel

    steps:
      - run:
          name: Install packages
          command: |
            sudo apt-get -qq update
            sudo apt-get -y install git libmariadb-dev libmagickwand-dev
      - 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: Rubocop
          command: |
            bundle exec rubocop

workflows:
  test_lint:
    jobs:
      - test
      - rubocop