diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75ce034..e05a950 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.6, 2.7, "3.0", jruby-9.2.8.0, ruby-head, jruby-head] + ruby: [2.6, 2.7, "3.0", jruby-9.3.1.0, ruby-head, jruby-head] name: ${{ matrix.ruby }} @@ -39,12 +39,13 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: coverallsapp/github-action@v1.1.2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - run: psql -c 'CREATE DATABASE batches_test' - run: bundle exec rake bundle:audit - run: bundle exec rake lint - run: bundle exec rspec continue-on-error: ${{ matrix.ruby == 'jruby-head' || matrix.ruby == 'ruby-head' }} + + - uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9e2c8ac..a9c1996 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,6 +7,10 @@ def is_jruby? require "simplecov" require "simplecov-lcov" +SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = "coverage/lcov.info" +end SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::LcovFormatter, @@ -20,16 +24,23 @@ def is_jruby? require "logger" require "yaml" +DB_USER = (ENV["PGUSER"] || "").freeze DB_NAME = (ENV["DB_NAME"] || "batches_test").freeze def connect - schema = is_jruby? ? "jdbc:postgresql" : "postgres" - Sequel.connect("#{schema}:///#{DB_NAME}").tap(&:tables) + if is_jruby? + schema = "jdbc:postgresql" + user_string = "?user=#{DB_USER}" + else + schema = "postgres" + end + + Sequel.connect("#{schema}:///#{DB_NAME}#{user_string}").tap(&:tables) rescue Sequel::DatabaseConnectionError => error raise unless error.message.include? "database \"#{DB_NAME}\" does not exist" `createdb #{DB_NAME}` - Sequel.connect("#{schema}:///#{DB_NAME}") + Sequel.connect("#{schema}:///#{DB_NAME}#{user_string}") end DB = connect