Skip to content

Commit f5f24d8

Browse files
authored
Merge pull request #1207 from ElixirTeSS/actions-services
Use "services" in GitHub actions
2 parents 6157342 + 9d85501 commit f5f24d8

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed

.github/workflows/deployment-checks.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,32 @@ jobs:
1212
DB_PASSWORD: password
1313
SECRET_BASE_KEY: test_key
1414
RAILS_ENV: production
15+
services:
16+
postgres:
17+
image: postgres
18+
env:
19+
POSTGRES_DB: ${{ env.DB_NAME }}
20+
POSTGRES_USER: ${{ env.DB_USER }}
21+
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
22+
ports:
23+
- 5432:5432
24+
options: >-
25+
--health-cmd "pg_isready"
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
redis:
30+
image: redis
31+
options: >-
32+
--health-cmd "redis-cli ping"
33+
--health-interval 10s
34+
--health-timeout 5s
35+
--health-retries 5
36+
ports:
37+
- 6379:6379
1538
steps:
16-
- uses: harmon758/postgresql-action@v1
17-
with:
18-
postgresql db: ${DB_NAME}
19-
postgresql user: ${DB_USER}
20-
postgresql password: ${DB_PASSWORD}
21-
name: Set up database
22-
2339
- uses: actions/checkout@v4
2440
name: Set up Ruby
25-
2641
- uses: ruby/setup-ruby@v1
2742
with:
2843
bundler-cache: true

.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
19+
env:
20+
POSTGRES_DB: ${{ env.DB_NAME }}
21+
POSTGRES_USER: ${{ env.DB_USER }}
22+
POSTGRES_PASSWORD: ${{ env.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)