-
-
Notifications
You must be signed in to change notification settings - Fork 51
105 lines (104 loc) · 3.17 KB
/
rubyonrails.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "Ruby on Rails CI"
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
# We're using postgres 15.2 in production currently
postgres:
image: postgis/postgis:15-3.3
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: "postgis://postgres:postgres@localhost:5432/rails_test"
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install --save-dev @percy/cli
# Add or replace dependency steps here
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
# Add or replace database setup steps here
- name: Create database
run: bin/rails db:create
- name: Set up database schema
run: bin/rails db:schema:load
# Add or replace test runners here
- name: Run tests
run: npx percy exec -- bin/rake
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
type_check:
runs-on: ubuntu-latest
services:
# We're using postgres 15.2 in production currently
postgres:
image: postgis/postgis:15-3.3
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
# TODO: Don't run in test environment so we don't need --environment=test below
RAILS_ENV: test
DATABASE_URL: "postgis://postgres:postgres@localhost:5432/rails_test"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Create database
run: bin/rails db:create
- name: Set up database schema
run: bin/rails db:schema:load
- name: Type check rake task
run: bin/rake ci:type
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Lint rake task
run: bin/rake ci:lint