Skip to content

Instantly share code, notes, and snippets.

@rohit-lingayat-sd
Last active May 9, 2021 13:00
Show Gist options
  • Save rohit-lingayat-sd/13f6683f1ffdd0d437627afad546c802 to your computer and use it in GitHub Desktop.
Save rohit-lingayat-sd/13f6683f1ffdd0d437627afad546c802 to your computer and use it in GitHub Desktop.
Continuous integration with GitHub action for ruby on rails application
name: Continuous integration
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports: ['5432:5432']
options:
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.7
- name: Build and run test
env:
DATABASE_URL: postgres://postgres:@localhost:5432/test
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler:1.17.3
bundle install --jobs 4 --retry 3
bundle exec rails db:create
bundle exec rails db:migrate
RAILS_ENV=test bundle exec rake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment