-
-
Notifications
You must be signed in to change notification settings - Fork 23
63 lines (53 loc) · 1.36 KB
/
test.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
name: Ruby
on:
push:
branches:
- main
- 'releases/*'
pull_request:
branches:
- main
- 'releases/*'
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
HOST: localhost
REDIS_HOST: localhost:6379
DATABASE_URL: postgres://postgres:postgres@localhost:5432/rails_bump_test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PostgreSQL client
run: |
sudo apt-get -yqq install libpq-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: bundle install
- name: Wait for PostgreSQL
run: |
echo "Waiting for PostgreSQL to be ready..."
while ! pg_isready -h localhost -p 5432 -U postgres; do
sleep 1
done
- name: Set up the database
run: |
bin/rails db:create
bin/rails db:schema:load
bin/rails db:test:prepare
- name: Run tests
run: bundle exec rspec spec