Skip to content

Instantly share code, notes, and snippets.

@sandeshbodake
Created September 13, 2020 09:50
Show Gist options
  • Save sandeshbodake/9aa2a0340de93cebd153ac9c2b7a81cb to your computer and use it in GitHub Desktop.
Save sandeshbodake/9aa2a0340de93cebd153ac9c2b7a81cb to your computer and use it in GitHub Desktop.
CI Github action for rails app
name: CI/CD
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
services:
db:
image: postgres:11
ports: ["5432:5432"]
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports: ["6379:6379"]
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- uses: borales/[email protected]
with:
cmd: install
- name: Build and run test
env:
DATABASE_URL: postgres://postgres:@localhost:5432/test
REDIS_URL: redis://localhost:6379/0
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rspec .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment