dawarich/.circleci/config.yml
2025-01-29 11:53:02 +01:00

61 lines
1.8 KiB
YAML

version: 2.1
orbs:
ruby: circleci/ruby@2.1.4
browser-tools: circleci/browser-tools@1.4.8
jobs:
test:
docker:
- image: cimg/ruby:3.3.4
environment:
RAILS_ENV: test
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: test_database
- image: cimg/postgres:14.0
environment:
POSTGRES_USER: postgres
POSTGRES_DB: test_database
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_INITDB_ARGS: --enable-debug --data-checksums --encoding=UTF8 --lc-collate=C --lc-ctype=C
command: |
apt-get update
apt-get install -y postgis postgresql-14-postgis-3
- image: redis:7.0
steps:
- checkout
- run:
name: Install System Dependencies
command: |
sudo apt-get update
sudo apt-get install -y postgresql-client
wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz
sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz
rm dockerize-linux-amd64-v0.6.1.tar.gz
- run:
name: Install Bundler
command: gem install bundler
- run:
name: Bundle Install
command: bundle install --jobs=4 --retry=3
- run:
name: Wait for PostgreSQL
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Database Setup
command: |
cp config/database.ci.yml config/database.yml
bundle exec rails db:create db:schema:load
- run:
name: Run RSpec tests
command: bundle exec rspec
- store_artifacts:
path: coverage
workflows:
rspec:
jobs:
- test