Skip to content

Instantly share code, notes, and snippets.

@nejdetkadir
Last active November 7, 2023 18:55
Show Gist options
  • Save nejdetkadir/c9e869da796799e1b91b9213ba4b5cee to your computer and use it in GitHub Desktop.
Save nejdetkadir/c9e869da796799e1b91b9213ba4b5cee to your computer and use it in GitHub Desktop.
Imagemagick support for circleci tests with rspec gem when using Ruby on Rails API application
version: 2.1
orbs:
ruby: circleci/[email protected]
node: circleci/node@2
jobs:
build:
docker:
- image: cimg/ruby:3.0.0-node # use a tailored CircleCI docker image.
steps:
test:
parallelism: 3
docker:
- image: cimg/ruby:3.0.0-node
- image: postgres:14.1
environment:
POSTGRES_USER: rails_circle
POSTGRES_DB: rails_circle_test
POSTGRES_PASSWORD: rails_circle
POSTGRES_HOST: 127.0.0.1
environment:
BUNDLE_JOBS: "3"
BUNDLE_RETRY: "3"
PGHOST: 127.0.0.1
PGUSER: rails_circle
PGPASSWORD: rails_circle
RAILS_ENV: test
steps:
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Database setup
command: bundle exec rails db:schema:load --trace
- run: sudo apt-get update && sudo apt-get install python3-pip groff-base
- run: sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
- run: sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libwebp-dev
- run: sudo apt-get install ffmpeg
# Run rspec in parallel
- run:
name: Run tests
command: bundle exec rspec
workflows:
version: 2
build_and_test:
jobs:
- build
- test:
requires:
- build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment