From 5d2552a0ac6829636c89b45a43e303ff291d491f Mon Sep 17 00:00:00 2001 From: Santiago Bartesaghi Date: Mon, 6 Jun 2022 12:57:02 -0300 Subject: [PATCH] Improve CI --- .github/workflows/ci.yml | 26 ++++++++++++++++++-------- .gitignore | 2 ++ .rubocop.yml | 6 ++---- ar2dto.gemspec | 1 + spec/gemfiles/rails_5_2.gemfile | 7 +++++++ spec/gemfiles/rails_6_0.gemfile | 7 +++++++ spec/gemfiles/rails_6_1.gemfile | 7 +++++++ spec/gemfiles/rails_7_0.gemfile | 7 +++++++ spec/gemfiles/rails_main.gemfile | 7 +++++++ 9 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 spec/gemfiles/rails_5_2.gemfile create mode 100644 spec/gemfiles/rails_6_0.gemfile create mode 100644 spec/gemfiles/rails_6_1.gemfile create mode 100644 spec/gemfiles/rails_7_0.gemfile create mode 100644 spec/gemfiles/rails_main.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3feff54..5bf5563 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,24 +4,34 @@ on: push: branches: - main - pull_request: jobs: build: runs-on: ubuntu-latest - name: Ruby ${{ matrix.ruby }} strategy: matrix: - ruby: - - '3.1.2' - + gemfile: [rails_5_2.gemfile, rails_6_0.gemfile, rails_6_1.gemfile, rails_7_0.gemfile, rails_main.gemfile] + ruby_version: [2.5, 2.6, 2.7, 3.0] + exclude: + - gemfile: rails_main.gemfile + ruby_version: 2.5 + - gemfile: rails_main.gemfile + ruby_version: 2.6 + - gemfile: rails_7_0.gemfile + ruby_version: 2.5 + - gemfile: rails_7_0.gemfile + ruby_version: 2.6 + env: + BUNDLE_GEMFILE: spec/gemfiles/${{ matrix.gemfile }} steps: - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby }} + ruby-version: ${{ matrix.ruby_version }} bundler-cache: true - - name: Run the default task - run: bundle exec rake + - name: Run test + run: | + bundle exec rubocop + bundle exec rspec diff --git a/.gitignore b/.gitignore index b04a8c8..5c249f1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ # rspec failure tracking .rspec_status + +Gemfile.lock diff --git a/.rubocop.yml b/.rubocop.yml index 552535c..a43163e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,7 @@ AllCops: TargetRubyVersion: 2.5.0 + NewCops: enable + SuggestExtensions: false Metrics/MethodLength: Enabled: true @@ -17,10 +19,6 @@ Style/StringLiteralsInInterpolation: Enabled: true EnforcedStyle: double_quotes -Style/StringLiteralsInInterpolation: - Enabled: true - EnforcedStyle: double_quotes - Lint/ConstantDefinitionInBlock: Enabled: false diff --git a/ar2dto.gemspec b/ar2dto.gemspec index 0a23a36..ef4f1d7 100644 --- a/ar2dto.gemspec +++ b/ar2dto.gemspec @@ -17,6 +17,7 @@ Gem::Specification.new do |spec| spec.metadata["source_code_uri"] = "https://github.com/santib/ar2dto" spec.metadata["bug_tracker_uri"] = "https://github.com/santib/ar2dto/issues" spec.metadata["changelog_uri"] = "https://github.com/santib/ar2dto/releases" + spec.metadata["rubygems_mfa_required"] = "true" spec.files = Dir["LICENSE.txt", "README.md", "lib/**/*"] spec.require_paths = ["lib"] diff --git a/spec/gemfiles/rails_5_2.gemfile b/spec/gemfiles/rails_5_2.gemfile new file mode 100644 index 0000000..a316d11 --- /dev/null +++ b/spec/gemfiles/rails_5_2.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec path: "../.." + +gem "rails", "~> 5.2.0" diff --git a/spec/gemfiles/rails_6_0.gemfile b/spec/gemfiles/rails_6_0.gemfile new file mode 100644 index 0000000..409de5a --- /dev/null +++ b/spec/gemfiles/rails_6_0.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec path: "../.." + +gem "rails", "~> 6.0.0" diff --git a/spec/gemfiles/rails_6_1.gemfile b/spec/gemfiles/rails_6_1.gemfile new file mode 100644 index 0000000..d611b97 --- /dev/null +++ b/spec/gemfiles/rails_6_1.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec path: "../.." + +gem "rails", "~> 6.1.0" diff --git a/spec/gemfiles/rails_7_0.gemfile b/spec/gemfiles/rails_7_0.gemfile new file mode 100644 index 0000000..727a950 --- /dev/null +++ b/spec/gemfiles/rails_7_0.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec path: "../.." + +gem "rails", "~> 7.0.0" diff --git a/spec/gemfiles/rails_main.gemfile b/spec/gemfiles/rails_main.gemfile new file mode 100644 index 0000000..fe7b555 --- /dev/null +++ b/spec/gemfiles/rails_main.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec path: "../.." + +gem "rails", git: "https://github.com/rails/rails", branch: "main"