-
Notifications
You must be signed in to change notification settings - Fork 19
59 lines (51 loc) · 1.5 KB
/
rails.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
53
54
55
56
57
58
59
name: Rails
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
env:
PGHOST: localhost
POSTGRES_DB: skills_test
POSTGRES_USER: skills
POSTGRES_PASSWORD: skills
services:
postgres:
image: postgres:16
ports: ["5432:5432"]
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: 'Run database migrations'
env:
RAILS_ENV: test
RAILS_DB_HOST: ${{ env.PGHOST }}
RAILS_DB_NAME: ${{ env.POSTGRES_DB }}
RAILS_DB_USERNAME: ${{ env.POSTGRES_USER }}
RAILS_DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
run: |
bundle exec rake db:create db:migrate
- name: 'Run tests'
env:
PGHOST: ${{ env.PGHOST }}
RAILS_DB_NAME: ${{ env.POSTGRES_DB }}
RAILS_DB_USERNAME: ${{ env.POSTGRES_USER }}
RAILS_DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
IS_CI: true
run: bundle exec rake
- name: 'Run RuboCop'
run: bundle exec rubocop --parallel