next-l/enju_ndl

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2.1
orbs:
  ruby: circleci/ruby@0.1.2 

jobs:
  build:
    docker:
      # specify the version you desire here
       - image: circleci/ruby:2.6-stretch-node-browsers
         environment:
           PGHOST: 127.0.0.1
           PGUSER: postgres

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
       - image: circleci/postgres:12-alpine
         environment:
           POSTGRES_USER: postgres
           POSTGRES_DB: enju_ndl_dummy_test

    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: install dependencies
          command: |
            bundle install --jobs=4 --retry=3 --path vendor/bundle

      # Database setup
      - run:
          command: dockerize -wait tcp://localhost:5432 -timeout 1m
      - run:
          command: |
            sudo apt update
            sudo apt install -y openjdk-8-jre-headless
      - run:
          command: sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
      - run: bundle exec rake db:create
      - run: bundle exec rake db:schema:load
      - run: bundle exec rake app:sunspot:solr:start RAILS_ENV=test

      # run tests!
      - run:
          name: run tests
          command: |
            mkdir /tmp/test-results
            TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"

            bundle exec rspec --format progress \
                            --format RspecJunitFormatter \
                            --out /tmp/test-results/rspec.xml \
                            $TEST_FILES

      # collect reports
      - store_test_results:
          path: /tmp/test-results
      - store_artifacts:
          path: /tmp/test-results
          destination: test-results