-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (47 loc) · 1.51 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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: 3.0.4
- name: Install dependent libraries
run: sudo apt-get install libpq-dev
- name: Setup application
run: |
gem install bundler
bundle install --jobs 4 --retry 3
yarn install
- name: Setup Database
run: |
cp config/database.yml.github-actions 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
- name: Deploy to Heroku
env:
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
HEROKU_APP_NAME: "os-lusiadas"
if: github.ref == 'refs/heads/master' && job.status == 'success'
run: git push https://heroku:[email protected]/$HEROKU_APP_NAME.git origin/master:master