Skip to content

Commit 96c72d3

Browse files
committed
migrate to github actions
1 parent 779e4ef commit 96c72d3

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ jobs:
99
services:
1010
postgres:
1111
image: postgres
12+
env:
13+
POSTGRES_PASSWORD: postgres
14+
# Set health checks to wait until postgres has started
15+
options: >-
16+
--health-cmd pg_isready
17+
--health-interval 10s
18+
--health-timeout 5s
19+
--health-retries 5
20+
ports:
21+
# Maps tcp port 5432 on service container to the host
22+
- 5432:5432
1223

1324
strategy:
1425
matrix:
@@ -17,6 +28,10 @@ jobs:
1728

1829
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
1930
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
31+
# The hostname used to communicate with the PostgreSQL service container
32+
POSTGRES_HOST: localhost
33+
# The default PostgreSQL port
34+
POSTGRES_PORT: 5432
2035

2136
steps:
2237
- uses: actions/checkout@v4

spec/spec_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
def prepare_database!
66
db = 'translateable_test_db'.freeze
77

8-
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'template1', username: 'postgres')
8+
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'template1', username: 'postgres', password: ENV['POSTGRES_PASSWORD'])
99

1010
begin
1111
ActiveRecord::Base.connection.drop_database(db)
1212
rescue ActiveRecord::StatementInvalid
1313
end
1414
ActiveRecord::Base.connection.create_database(db)
1515

16-
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: db, username: 'postgres')
16+
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: db, username: 'postgres', password: ENV['POSTGRES_PASSWORD'])
1717

1818
begin
1919
ActiveRecord::Base.connection.drop_table :test_models

0 commit comments

Comments
 (0)