Created
September 13, 2020 09:50
-
-
Save sandeshbodake/9aa2a0340de93cebd153ac9c2b7a81cb to your computer and use it in GitHub Desktop.
CI Github action for rails app
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
| 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