.circleci/config.yml
version: 2.1
jobs:
build:
docker:
- image: cimg/ruby:2.7.6-browsers
environment:
RAILS_ENV: test
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- gem-cache-{{ checksum "Gemfile.lock" }}
- run:
name: Install Dependencies
command: |
bundle config set --local path 'vendor/bundle'
bundle install
- save_cache:
key: gem-cache-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Run Specs
command: bundle exec rspec --format progress --profile 10 spec
deploy:
docker:
- image: cimg/ruby:2.7.6-browsers
environment:
RAILS_ENV: test
working_directory: ~/repo
steps:
- checkout
- run:
name: Deploy to fly.io
command: |
curl -L https://fly.io/install.sh | sh
export FLYCTL_INSTALL="/home/circleci/.fly"
export PATH="$FLYCTL_INSTALL/bin:$PATH"
sh -c "flyctl deploy --auto-confirm --app $FLY_APP_NAME --access-token $FLY_API_TOKEN"
workflows:
version: 2
build_and_deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only:
- master