Skip to content

Commit fe5ce50

Browse files
committed
migrate to github actions
1 parent 1759f33 commit fe5ce50

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@ jobs:
2727
ruby-version: ['3.2', '3.3', '3.4']
2828
gemfile: ['7.0', '7.1', '7.2', '8.0']
2929

30-
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
31-
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
32-
# The hostname used to communicate with the PostgreSQL service container
33-
POSTGRES_HOST: localhost
34-
# The default PostgreSQL port
35-
POSTGRES_PORT: 5432
36-
3730
steps:
3831
- uses: actions/checkout@v4
3932
- uses: ruby/setup-ruby@v1
4033
with:
4134
ruby-version: ${{ matrix.ruby-version }}
4235
- run: bundle install
4336
- run: bundle exec rspec
37+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
38+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
39+
# The hostname used to communicate with the PostgreSQL service container
40+
POSTGRES_HOST: localhost
41+
# The default PostgreSQL port
42+
POSTGRES_PORT: 5432

spec/spec_helper.rb

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

8-
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'template1', username: 'postgres', password: ENV['POSTGRES_PASSWORD'], port: ENV['POSTGRES_PORT'], host: 'localhost')
8+
ActiveRecord::Base.establish_connection(
9+
adapter: 'postgresql',
10+
database: 'template1',
11+
username: 'postgres',
12+
password: ENV['POSTGRES_PASSWORD'],
13+
port: ENV['POSTGRES_PORT'],
14+
host: ENV['POSTGRES_HOST'] || 'localhost'
15+
)
916

1017
begin
1118
ActiveRecord::Base.connection.drop_database(db)
1219
rescue ActiveRecord::StatementInvalid
1320
end
1421
ActiveRecord::Base.connection.create_database(db)
1522

16-
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: db, username: 'postgres', password: ENV['POSTGRES_PASSWORD'], port: ENV['POSTGRES_PORT'], host: 'localhost')
23+
ActiveRecord::Base.establish_connection(
24+
adapter: 'postgresql',
25+
database: db,
26+
username: 'postgres',
27+
password: ENV['POSTGRES_PASSWORD'],
28+
port: ENV['POSTGRES_PORT'],
29+
host: ENV['POSTGRES_HOST'] || 'localhost'
30+
)
1731

1832
begin
1933
ActiveRecord::Base.connection.drop_table :test_models

0 commit comments

Comments
 (0)