Skip to content

Commit

Permalink
Merge pull request #349 from winebarrel/use_ruby-setup_ruby
Browse files Browse the repository at this point in the history
Use ruby/setup-ruby
  • Loading branch information
winebarrel committed Feb 9, 2021
2 parents e1b1d29 + 940d1f5 commit 8abbafd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/test.yml
Expand Up @@ -29,49 +29,36 @@ jobs:
gemfile: gemfiles/activerecord_6.0.gemfile
- ruby: 2.4
gemfile: gemfiles/activerecord_6.1.gemfile

env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v2
with:
path: gemfiles/vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('ridgepole.gemspec', '**/Gemfile', '${{ matrix.gemfile }}') }}
restore-keys: |
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-
bundler-cache: true
- name: Setup dependencies
run: |
for i in {1..60}; do docker-compose up -d && break; sleep 1; done
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
# Wait until database servers start
function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P 13316 -ppassword ping; }
function mysql57_ping { mysqladmin -u root -h 127.0.0.1 -P 13317 -ppassword ping; }
function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P 13316 ping --ssl-mode=DISABLED; }
function mysql57_ping { mysqladmin -u root -h 127.0.0.1 -P 13317 ping --ssl-mode=DISABLED; }
function pg_ping { PGPASSWORD=password pg_isready -U postgres -h 127.0.0.1 -p 15442; }
for i in {1..60}; do mysql_ping && break; sleep 1; done
for i in {1..60}; do mysql57_ping && break; sleep 1; done
for i in {1..60}; do pg_ping && break; sleep 1; done
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

MYSQL_PWD: password
- name: Run tests
run: ${{ matrix.env }} bundle exec rake
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

- name: Coveralls Parallel
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.ruby }}-${{ matrix.env }}-${{ matrix.gemfile }}
parallel: true

finish:
needs: build
runs-on: ubuntu-latest
Expand Down
9 changes: 5 additions & 4 deletions .rubocop.yml
@@ -1,12 +1,13 @@
AllCops:
Exclude:
- 'gemfiles/**/*'
- 'omnibus-ridgepole/**/*'
- "gemfiles/**/*"
- "omnibus-ridgepole/**/*"
- "vendor/bundle/**/*"
TargetRubyVersion: 2.4
NewCops: enable
Bundler/OrderedGems:
Include:
- 'Appraisals'
- "Appraisals"
Layout/HeredocIndentation:
Enabled: false
Metrics/AbcSize:
Expand All @@ -33,7 +34,7 @@ Style/GuardClause:
Enabled: false
Style/MixinUsage:
Exclude:
- 'spec/**/*'
- "spec/**/*"
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Layout/ClosingHeredocIndentation:
Expand Down
2 changes: 1 addition & 1 deletion ridgepole.gemspec
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rspec', '>= 3.0.0'
spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.1.3'
spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
spec.add_development_dependency 'rubocop', '1.8.1'
spec.add_development_dependency 'rubocop', '1.9.1'
spec.add_development_dependency 'rubocop-rake', '>= 0.5.1'
spec.add_development_dependency 'rubocop-rspec', '>= 2.1.0'
spec.add_development_dependency 'simplecov'
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_const.rb
Expand Up @@ -5,7 +5,7 @@
TEST_MYSQL_USER = 'root'
TEST_MYSQL_PASS = 'password'

MYSQL_CLI = "mysql -h #{TEST_MYSQL_HOST} -P #{TEST_MYSQL_PORT} -u #{TEST_MYSQL_USER} -p#{TEST_MYSQL_PASS} 2>/dev/null"
MYSQL_CLI = "mysql -h #{TEST_MYSQL_HOST} -P #{TEST_MYSQL_PORT} -u #{TEST_MYSQL_USER} -p#{TEST_MYSQL_PASS} --ssl-mode=DISABLED 2>/dev/null"

TEST_PG_HOST = ENV['DOCKER_HOST'] ? ENV['DOCKER_HOST'].gsub(%r{\Atcp://|:\d+\z}, '') : '127.0.0.1'
TEST_PG_PORT = 15_442
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Expand Up @@ -132,6 +132,7 @@ def conn_spec(config = {})
port: TEST_MYSQL_PORT,
username: TEST_MYSQL_USER,
password: TEST_MYSQL_PASS,
ssl_mode: 'DISABLED',
}.merge(config)
end
end
Expand Down

0 comments on commit 8abbafd

Please sign in to comment.