# To update the build configuration, edit the "builds" array below and run: # erb .circleci/config.yml.erb > .circleci/config.yml # The default Ruby containers modify the behaviour of Bundler in a way that breaks # the CI since it makes it harder to run multiple apps in a single container # See https://github.com/docker-library/docs/pull/1221/files for a summary # Unsettting these variables restores the default behaviour:- # * BUNDLE_APP_CONFIG # * GEM_HOME # * BUNDLE_PATH # * BUNDLE_BIN common_ruby_environment: &common_ruby_environment environment: RAILS_ENV: test PGHOST: 127.0.0.1 PGUSER: postgres POSTGRES_HOST_AUTH_METHOD: "trust" common_pg_environment_vars: &common_pg_environment_vars POSTGRES_USER: postgres POSTGRES_DB: ror_testapp_test POSTGRES_HOST_AUTH_METHOD: "trust" <% builds = [ ['2.4.6', 'rails_4'], ['2.4.6', 'rails_5'], ['2.4.6', 'rails_5_1'], ['2.4.6', 'rails_5_2'], ['2.5.5', 'rails_4'], ['2.5.5', 'rails_5'], ['2.5.5', 'rails_5_1'], ['2.5.5', 'rails_5_2'], ['2.6.5', 'rails_6'] ] %> version: 2 jobs: <% builds.each do |ruby,variant| %> build_<%= ruby %>_<%= variant %>: docker: - image: ruby:<%= ruby %>-alpine <<: *common_ruby_environment - image: postgres:9.6-alpine environment: PGDATA: /dev/shm/pgdata <<: *common_pg_environment_vars - image: redis:4-alpine steps: - checkout - run: name: Setup RAM disk command: | rm -rf ~/project/tmp ; mkdir /dev/shm/tmp ; ln -s /dev/shm/tmp ~/project/tmp - run: name: Setup requirements command: | apk add --update git bash build-base postgresql-dev sqlite-dev tzdata nodejs - run: name: Configure bundler command: | unset \ BUNDLE_APP_CONFIG \ GEM_HOME \ BUNDLE_PATH \ BUNDLE_BIN bundle config --local gemfile $PWD/gemfiles/<%= variant %>.gemfile - restore_cache: keys: - v2-bundle-<%= ruby %>-<%= variant %>-{{ .Branch }} - v2-bundle-<%= ruby %>-<%= variant %> - v2-bundle-<%= ruby %> - run: name: Install bundle command: | unset \ BUNDLE_APP_CONFIG \ GEM_HOME \ BUNDLE_PATH \ BUNDLE_BIN bundle install --jobs=3 --retry=3 --path=$PWD/vendor/bundle # The default Ruby containers modify the behaviour of Bundler in a way that breaks # the CI since it makes it harder to run multiple apps in a single container # See https://github.com/docker-library/docs/pull/1221/files for a summary # Unsettting the variables restores the default behaviour - run: name: Run test suite command: | unset \ RACK_ENV \ RAILS_ENV \ BUNDLE_APP_CONFIG \ GEM_HOME \ BUNDLE_PATH \ BUNDLE_BIN bundle exec rspec - save_cache: key: v2-bundle-<%= ruby %>-<%= variant %>-{{ .Branch }} paths: - ~/project/vendor/bundle - ~/project/vendor/bundle-scaffold - save_cache: key: v2-bundle-<%= ruby %>-<%= variant %> paths: - ~/project/vendor/bundle - ~/project/vendor/bundle-scaffold - save_cache: key: v2-bundle-<%= ruby %> paths: - ~/project/vendor/bundle - ~/project/vendor/bundle-scaffold <% end %> workflows: version: 2 test: jobs: <% builds.each do |ruby,variant| %> - build_<%= ruby %>_<%= variant %> <% end %>