diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index bb59b1f..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - ruby: ['2.6', '3.1'] - - steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Install dependencies - run: bundle install - - name: Run linters - run: bundle exec rake standard - - name: Run specs - run: bundle exec rake spec \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..35dd9fa --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: + pull_request: + push: + branches: + - '**' + tags-ignore: + - 'v*' + +jobs: + rubocop: + # Skip running tests for local pull requests (use push event instead), run only for foreign ones + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login + name: Standard.rb + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.1" + bundler-cache: true + - name: Lint Ruby code with Standard.rb + run: | + bundle exec rake standard diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a533ef2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Tests + +on: + pull_request: + push: + branches: + - '**' + tags-ignore: + - 'v*' + +jobs: + test: + name: 'Rails ${{ matrix.rails }} × Ruby ${{ matrix.ruby }}' + # Skip running tests for local pull requests (use push event instead), run only for foreign ones + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - ruby: "3.1" + rails: "HEAD" + - ruby: "3.0" + rails: "7.0" + - ruby: "2.5" + rails: "6.1" + env: + RAILS_VERSION: ${{ matrix.rails }} + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run specs + run: bundle exec rake spec \ No newline at end of file diff --git a/Gemfile b/Gemfile index 6adbb64..44d7cb8 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,20 @@ source "https://rubygems.org" gemspec +# standard: disable Bundler/DuplicatedGem +if (rails_version = ENV["RAILS_VERSION"]) + case rails_version + when "HEAD" + git "https://github.com/rails/rails.git" do + gem "rails" + end + else + rails_version = "~> #{rails_version}.0" if rails_version.match?(/^\d+\.\d+$/) # "7.0" => "~> 7.0.0" + gem "rails", rails_version + end +end +# standard: enable Bundler/DuplicatedGem + gem "rake", "~> 13.0" gem "rspec", "~> 3.0" gem "rspec-rails", "~> 5.0" diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index f6b060e..c1c0ff1 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -15,7 +15,7 @@ class Application < Rails::Application config.root = File.join(__dir__, "..") config.logger = Logger.new("/dev/null") config.api_only = true - config.active_record.legacy_connection_handling = false + config.active_record.legacy_connection_handling = false if ActiveRecord::Base.respond_to?(:legacy_connection_handling=) if Rails::VERSION::MAJOR >= 7 config.active_record.async_query_executor = :global_thread_pool