diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b30f70f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +name: CI +on: + push: + branches: + - main + pull_request: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + rubygems: latest + + - name: Run RuboCop + run: bundle exec rubocop --fail-level warning --display-only-fail-level-offenses --format github + + test: + name: Test - ${{ matrix.gemfile }} - Ruby ${{ matrix.ruby }} + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + ruby: ["3.0", 3.1, 3.2, 3.3, 3.4] + gemfile: + [ + activesupport-7.1, + activesupport-7.2, + activesupport-8.0, + activesupport-8.1, + ] + exclude: + # Rails 7.2 is >= 3.1 + - ruby: "3.0" + gemfile: activesupport-7.2 + # Rails 8.0 is >= 3.2 + - ruby: "3.0" + gemfile: activesupport-8.0 + - ruby: 3.1 + gemfile: activesupport-8.0 + # Rails 8.1 is >= 3.2 + - ruby: "3.0" + gemfile: activesupport-8.1 + - ruby: 3.1 + gemfile: activesupport-8.1 + + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile + + steps: + - name: Checkout code + uses: actions/checkout@v5 + - name: Update .ruby-version with matrix value + run: echo "${{ matrix.ruby }}" >| .ruby-version + # Dependencies + - name: Set up Ruby and bundle install + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + rubygems: latest + + # Test + - name: Run Unit tests + run: bundle exec rspec + + - name: Publish Test Results + uses: mikepenz/action-junit-report@v4 + if: always() + with: + check_name: Test Results + report_paths: tmp/rspec.xml + detailed_summary: true diff --git a/.gitignore b/.gitignore index 8eb3b06..a5826e9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ # rspec failure tracking .rspec_status +marsh_grass*.gem diff --git a/.rspec b/.rspec index 8c18f1a..94c8957 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,3 @@ --format documentation +--format RspecJunitFormatter --out tmp/rspec.xml --color diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..2aa5131 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.4.7 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6a40ff0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -sudo: false -language: ruby -rvm: - - 2.3.6 -before_install: gem install bundler -v 1.16.1 diff --git a/Gemfile b/Gemfile index 6a1e17a..f857e45 100644 --- a/Gemfile +++ b/Gemfile @@ -4,3 +4,8 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } # Specify your gem's dependencies in marsh_grass.gemspec gemspec + +group :development, :test do + gem 'rubocop' + gem 'rspec_junit_formatter' +end diff --git a/gemfiles/activesupport-7.1.gemfile b/gemfiles/activesupport-7.1.gemfile new file mode 100644 index 0000000..9ddea9c --- /dev/null +++ b/gemfiles/activesupport-7.1.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gem 'activesupport', '~> 7.1.0' + +eval_gemfile "../Gemfile" diff --git a/gemfiles/activesupport-7.2.gemfile b/gemfiles/activesupport-7.2.gemfile new file mode 100644 index 0000000..e112987 --- /dev/null +++ b/gemfiles/activesupport-7.2.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gem 'activesupport', '~> 7.2.0' + +eval_gemfile "../Gemfile" diff --git a/gemfiles/activesupport-8.0.gemfile b/gemfiles/activesupport-8.0.gemfile new file mode 100644 index 0000000..63a75b7 --- /dev/null +++ b/gemfiles/activesupport-8.0.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gem 'activesupport', '~> 8.0.0' + +eval_gemfile "../Gemfile" diff --git a/gemfiles/activesupport-8.1.gemfile b/gemfiles/activesupport-8.1.gemfile new file mode 100644 index 0000000..b77d4f9 --- /dev/null +++ b/gemfiles/activesupport-8.1.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gem 'activesupport', '~> 8.1.0' + +eval_gemfile "../Gemfile" diff --git a/spec/marsh_grass_spec.rb b/spec/marsh_grass_spec.rb index f1ac3c0..2fb68d8 100644 --- a/spec/marsh_grass_spec.rb +++ b/spec/marsh_grass_spec.rb @@ -124,7 +124,7 @@ def make_time(first, second) # Should run (24 * 60 * 60) = 86400x and have all hours, minutes, and seconds of the day # This test is too slow to run by default, so it is commented out. - xit 'allows testing against an iteration of hours, minutes, and seconds', time_of_day: %i[hours minutes seconds] do + it 'allows testing against an iteration of hours, minutes, and seconds', time_of_day: %i[hours minutes seconds], skip: 'Too slow to run by default' do hours_minutes_and_seconds_to_run << Time.now.strftime('%H:%M:%S') end end