From 711fe51fe8011f3fe85f02ea6d96ee3c123511fa Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 24 Mar 2024 03:35:46 +0200 Subject: [PATCH 1/2] Declare integration tests with less repetition --- .github/workflows/test.yml | 45 +++++-------------- .rubocop_todo.yml | 8 ++-- .../{rack/v2 => rack_2_0}/headers_spec.rb | 0 .../{rack/v3 => rack_3_0}/headers_spec.rb | 0 4 files changed, 16 insertions(+), 37 deletions(-) rename spec/integration/{rack/v2 => rack_2_0}/headers_spec.rb (100%) rename spec/integration/{rack/v3 => rack_3_0}/headers_spec.rb (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81352673e6..295681ea81 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,20 +25,23 @@ jobs: matrix: ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] gemfile: [rack_2_0, rack_3_0, rails_6_0, rails_6_1, rails_7_0, rails_7_1] - integration_only: [false] + integration: [false] include: - ruby: '2.7' gemfile: rack_1_0 - ruby: '2.7' - gemfile: multi_json + integration: multi_json - ruby: '2.7' - gemfile: multi_xml + integration: multi_xml + - ruby: '2.7' + integration: rack_2_0 + - ruby: '2.7' + integration: rack_3_0 - ruby: '3.3' - gemfile: no_dry_validation - integration_only: true + integration: no_dry_validation runs-on: ubuntu-latest env: - BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.integration || matrix.gemfile }}.gemfile steps: - uses: actions/checkout@v4 @@ -49,35 +52,11 @@ jobs: bundler-cache: true - name: Run tests - if: ${{ matrix.integration_only == false }} run: bundle exec rake spec - - name: Run tests (spec/integration/eager_load) - # rack_2_0.gemfile is equals to Gemfile - if: ${{ matrix.gemfile == 'rack_2_0' }} - run: bundle exec rspec spec/integration/eager_load - - - name: Run tests (spec/integration/multi_json) - if: ${{ matrix.gemfile == 'multi_json' }} - run: bundle exec rspec spec/integration/multi_json - - - name: Run tests (spec/integration/multi_xml) - if: ${{ matrix.gemfile == 'multi_xml' }} - run: bundle exec rspec spec/integration/multi_xml - - - name: Run tests (spec/integration/rack/v2) - # rack_2_0.gemfile is equals to Gemfile - if: ${{ matrix.gemfile == 'rack_2_0' }} - run: bundle exec rspec spec/integration/rack/v2 - - - name: Run tests (spec/integration/rack/v3) - # rack_2_0.gemfile is equals to Gemfile - if: ${{ matrix.gemfile == 'rack_3_0' }} - run: bundle exec rspec spec/integration/rack/v3 - - - name: Run tests (spec/integration/no_dry_validation) - if: ${{ matrix.gemfile == 'no_dry_validation' }} - run: bundle exec rspec spec/integration/no_dry_validation + - name: Run integration tests (spec/integration/${{ matrix.integration }}) + if: ${{ matrix.integration }} + run: bundle exec rspec spec/integration/${{ matrix.integration }} - name: Coveralls uses: coverallsapp/github-action@master diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index be369f103b..6f5f76b8e6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -279,8 +279,8 @@ RSpec/FilePath: - 'spec/integration/multi_json/json_spec.rb' - 'spec/integration/multi_xml/xml_spec.rb' - 'spec/integration/no_dry_validation/no_dry_validation_spec.rb' - - 'spec/integration/rack/v2/headers_spec.rb' - - 'spec/integration/rack/v3/headers_spec.rb' + - 'spec/integration/rack_2_0/headers_spec.rb' + - 'spec/integration/rack_3_0/headers_spec.rb' # Offense count: 6 # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns. @@ -612,8 +612,8 @@ RSpec/SpecFilePathFormat: - 'spec/integration/multi_json/json_spec.rb' - 'spec/integration/multi_xml/xml_spec.rb' - 'spec/integration/no_dry_validation/no_dry_validation_spec.rb' - - 'spec/integration/rack/v2/headers_spec.rb' - - 'spec/integration/rack/v3/headers_spec.rb' + - 'spec/integration/rack_2_0/headers_spec.rb' + - 'spec/integration/rack_3_0/headers_spec.rb' # Offense count: 9 RSpec/StubbedMock: diff --git a/spec/integration/rack/v2/headers_spec.rb b/spec/integration/rack_2_0/headers_spec.rb similarity index 100% rename from spec/integration/rack/v2/headers_spec.rb rename to spec/integration/rack_2_0/headers_spec.rb diff --git a/spec/integration/rack/v3/headers_spec.rb b/spec/integration/rack_3_0/headers_spec.rb similarity index 100% rename from spec/integration/rack/v3/headers_spec.rb rename to spec/integration/rack_3_0/headers_spec.rb From 583be0a175aeb916ec52b3a857128e55be8c1fa9 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 24 Mar 2024 03:49:12 +0200 Subject: [PATCH 2/2] Use 'not' --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 295681ea81..24fee48873 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,6 +52,7 @@ jobs: bundler-cache: true - name: Run tests + if: ${{ !matrix.integration }} run: bundle exec rake spec - name: Run integration tests (spec/integration/${{ matrix.integration }})