Skip to content

Commit af7e0f8

Browse files
Merge pull request actions#34 from alanvardy/patch-1
Add Ruby on Rails test example
2 parents b4ef174 + 0662c7a commit af7e0f8

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,47 @@ jobs:
4242
- run: ruby hello.rb
4343
```
4444
45+
Ruby on Rails Testing:
46+
```yaml
47+
name: Rails Unit Tests
48+
49+
on: [push, pull_request]
50+
51+
jobs:
52+
build:
53+
54+
runs-on: ubuntu-latest
55+
56+
services:
57+
db:
58+
image: postgres:11
59+
ports: ['5432:5432']
60+
options: >-
61+
--health-cmd pg_isready
62+
--health-interval 10s
63+
--health-timeout 5s
64+
--health-retries 5
65+
66+
steps:
67+
- uses: actions/checkout@v1
68+
- name: Set up Ruby 2.6
69+
uses: actions/setup-ruby@v1
70+
with:
71+
ruby-version: 2.6.x
72+
- name: Build and test with Rake
73+
env:
74+
PGHOST: 127.0.0.1
75+
PGUSER: postgres
76+
RAILS_ENV: test
77+
run: |
78+
sudo apt-get -yqq install libpq-dev
79+
gem install bundler
80+
bundle install --jobs 4 --retry 3
81+
bundle exec rails db:create
82+
bundle exec rails db:migrate
83+
bundle exec rails test
84+
```
85+
4586
# License
4687
4788
The scripts and documentation in this project are released under the [MIT License](LICENSE)

0 commit comments

Comments
 (0)