Skip to content
Snippets Groups Projects
config.yml 5.71 KiB
version: 2.1

orbs:
  ruby: circleci/ruby@1.4.0
  node: circleci/node@5.0.1

executors:
  default:
    parameters:
      ruby-version:
        type: string
    docker:
      - image: cimg/ruby:<< parameters.ruby-version >>
        environment:
          BUNDLE_JOBS: 3
          BUNDLE_RETRY: 3
          CONTINUOUS_INTEGRATION: true
          DB_HOST: localhost
          DB_USER: root
          DISABLE_SIMPLECOV: true
          RAILS_ENV: test
      - image: cimg/postgres:14.0
        environment:
          POSTGRES_USER: root
          POSTGRES_HOST_AUTH_METHOD: trust
      - image: cimg/redis:6.2

commands:
  install-system-dependencies:
    steps:
      - run:
          name: Install system dependencies
          command: |
            sudo apt-get update
            sudo apt-get install -y libicu-dev libidn11-dev
  install-ruby-dependencies:
    parameters:
      ruby-version:
        type: string
    steps:
      - run:
          command: |
            bundle config clean 'true'
            bundle config frozen 'true'
            bundle config without 'development production'
          name: Set bundler settings
      - ruby/install-deps:
          bundler-version: '2.3.8'
          key: ruby<< parameters.ruby-version >>-gems-v1
  wait-db:
    steps:
      - run:
          command: dockerize -wait tcp://localhost:5432 -wait tcp://localhost:6379 -timeout 1m
          name: Wait for PostgreSQL and Redis

jobs:
  build:
    docker:
      - image: cimg/ruby:3.0-node
        environment:
          RAILS_ENV: test
    steps:
      - checkout
      - install-system-dependencies
      - install-ruby-dependencies:
          ruby-version: '3.0'
      - node/install-packages:
          cache-version: v1
          pkg-manager: yarn
      - run: