Last active
July 19, 2021 12:45
-
-
Save cmdr-rohit-bang/664e762c3e9553fbb0a660a87062a1ee to your computer and use it in GitHub Desktop.
GitHub Actions Ruby On Rails CI config file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/ci.yml | |
name: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
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 | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7.2 | |
- name: Install dependent libraries | |
run: sudo apt-get install libpq-dev | |
- name: Bundle install | |
run: | | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
- name: Yarn Install | |
run: yarn check || yarn install --check-files | |
- name: Setup Database | |
run: | | |
cp config/database.yml.sample config/database.yml | |
bundle exec rake db:create | |
bundle exec rake db:schema:load | |
env: | |
RAILS_ENV: test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
- name: Run RSpec | |
run: COVERAGE=true bundle exec rspec --require rails_helper | |
env: | |
RAILS_ENV: test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment