From f4fffc00acbd571ebfedb6ccad8891c85a4376e7 Mon Sep 17 00:00:00 2001 From: Johannes Opper Date: Tue, 29 Oct 2024 08:54:36 +0100 Subject: [PATCH] Move ci pipeline to github actions --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++ .tool-versions | 1 + .travis.yml | 18 ---------------- reverse_markdown.gemspec | 2 +- spec/lib/reverse_markdown_spec.rb | 3 ++- spec/spec_helper.rb | 2 +- 6 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .tool-versions delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0efd226 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: [ '3.0', '3.1', '3.2', '3.3', 'jruby-9.4' ] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Update Bundler + run: gem install bundler + + - name: Install dependencies + run: bundle install + + - name: Run tests + run: bundle exec rspec diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..1dd1998 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.3.5 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5a069d4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: ruby -cache: bundler - -rvm: - - 2.0 - - 2.1 - - 2.2 - - 2.3 - - 2.4 - - 2.5 - - 2.6 - - 2.7 - - jruby-9.2.8.0 - -notifications: - disabled: false - recipients: - - xijo@pm.me diff --git a/reverse_markdown.gemspec b/reverse_markdown.gemspec index 970e93d..b408ceb 100644 --- a/reverse_markdown.gemspec +++ b/reverse_markdown.gemspec @@ -23,6 +23,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'simplecov' s.add_development_dependency 'rake' s.add_development_dependency 'kramdown' - s.add_development_dependency 'debug' + s.add_development_dependency 'debug' unless RUBY_ENGINE == 'jruby' s.add_development_dependency 'codeclimate-test-reporter' end diff --git a/spec/lib/reverse_markdown_spec.rb b/spec/lib/reverse_markdown_spec.rb index ef5b416..04faeb2 100644 --- a/spec/lib/reverse_markdown_spec.rb +++ b/spec/lib/reverse_markdown_spec.rb @@ -36,7 +36,8 @@ describe 'force_encoding option', jruby: :exclude do it 'raises invalid byte sequence in UTF-8 exception' do - expect { ReverseMarkdown.convert("hi \255") }.to raise_error(Encoding::CompatibilityError) + # Older versions of ruby used to raise ArgumentError here. Remove when we drop support for 3.1. + expect { ReverseMarkdown.convert("hi \255") }.to raise_error { [Encoding::CompatibilityError, ArgumentError].include?(_1.class) } end it 'handles invalid byte sequence if option is set' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9cf5a54..5da4c9f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ require 'simplecov' -require 'debug' +require 'debug' unless RUBY_ENGINE == 'jruby' SimpleCov.profiles.define 'gem' do add_filter '/spec/'