diff --git a/README.md b/README.md index b8da96e..d14f9c9 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,47 @@ jobs: - run: ruby hello.rb ``` +Ruby on Rails Testing: +```yaml +name: Rails Unit Tests + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + services: + db: + image: postgres:11 + ports: ['5432:5432'] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v1 + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + - name: Build and test with Rake + env: + PGHOST: 127.0.0.1 + PGUSER: postgres + RAILS_ENV: test + run: | + sudo apt-get -yqq install libpq-dev + gem install bundler + bundle install --jobs 4 --retry 3 + bundle exec rails db:create + bundle exec rails db:migrate + bundle exec rails test +``` + # License The scripts and documentation in this project are released under the [MIT License](LICENSE)