Skip to content

Commit 5ec7e1b

Browse files
committed
Use services to run postgres and redis
1 parent b962c9b commit 5ec7e1b

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

.github/workflows/test.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,35 @@ jobs:
1212
DB_PASSWORD: password
1313
SECRET_BASE_KEY: test_key
1414
RAILS_ENV: test
15-
REDIS_TEST_URL: redis://localhost:6456/0
15+
REDIS_TEST_URL: redis://localhost:6379/0
16+
services:
17+
postgres:
18+
image: postgres:14
19+
env:
20+
POSTGRES_DB: ${DB_NAME}
21+
POSTGRES_USER: ${DB_USER}
22+
POSTGRES_PASSWORD: ${DB_PASSWORD}
23+
ports:
24+
- 5432:5432
25+
options: >-
26+
--health-cmd "pg_isready"
27+
--health-interval 10s
28+
--health-timeout 5s
29+
--health-retries 5
30+
redis:
31+
image: redis
32+
options: >-
33+
--health-cmd "redis-cli ping"
34+
--health-interval 10s
35+
--health-timeout 5s
36+
--health-retries 5
37+
ports:
38+
- 6379:6379
1639
steps:
1740
- name: Install system dependencies
1841
run: |
1942
sudo apt-get update
2043
sudo apt-get install imagemagick
21-
- name: Set up database
22-
uses: harmon758/postgresql-action@v1
23-
with:
24-
postgresql db: ${DB_NAME}
25-
postgresql user: ${DB_USER}
26-
postgresql password: ${DB_PASSWORD}
27-
- name: Set up Redis
28-
uses: supercharge/redis-github-action@1.5.0
29-
with:
30-
redis-version: 6
31-
redis-port: 6456
3244
- name: Check out code
3345
uses: actions/checkout@v4
3446
- name: Install Ruby & gems

0 commit comments

Comments
 (0)