From 108f2de7e5544531c8e4e7e377cd0153dd8dc48d Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 2 Nov 2022 22:47:22 -0700 Subject: [PATCH 1/5] Test other rubies on CI --- .github/workflows/test.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff1f955..9d00ced 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: steps: - id: versions run: | - versions=$(curl -s 'https://cache.ruby-lang.org/pub/misc/ci_versions/cruby.json') + versions=$(curl -s 'https://cache.ruby-lang.org/pub/misc/ci_versions/cruby.json' | jq -c '. + ["jruby", "truffleruby-head"]') echo "::set-output name=value::${versions}" test: needs: ruby-versions @@ -26,9 +26,6 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - - name: Install dependencies - run: | - gem install bundler --no-document - bundle install + bundler-cache: true - name: Run test - run: rake test + run: bundle exec rake test From c09f7117680dfa007728fb8ebe86cde7fab9f68c Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 2 Nov 2022 22:49:09 -0700 Subject: [PATCH 2/5] Fix CI for JRuby --- erb.gemspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erb.gemspec b/erb.gemspec index e89a358..2e7e981 100644 --- a/erb.gemspec +++ b/erb.gemspec @@ -27,7 +27,9 @@ Gem::Specification.new do |spec| spec.executables = ['erb'] spec.require_paths = ['lib'] - spec.required_ruby_version = ">= 2.7.0" + if RUBY_ENGINE != 'jruby' + spec.required_ruby_version = '>= 2.7.0' + end spec.add_dependency 'cgi', '>= 0.3.3' end From b13aa3b1c5c0afda168e878fe918d05fe5d04aca Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 2 Nov 2022 22:51:05 -0700 Subject: [PATCH 3/5] Disable faill-fast --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d00ced..a4b4e9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,7 @@ jobs: matrix: ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} os: [ubuntu-latest] + fail-fast: false runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 From e5adba50d85918a251a30a7da3f72d59cc02ddfc Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 2 Nov 2022 22:53:39 -0700 Subject: [PATCH 4/5] Skip tests for truffleruby --- test/erb/test_erb.rb | 2 ++ test/erb/test_erb_command.rb | 3 +++ 2 files changed, 5 insertions(+) diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb index fb5e9b6..5be5ed7 100644 --- a/test/erb/test_erb.rb +++ b/test/erb/test_erb.rb @@ -236,6 +236,8 @@ def test_explicit_trim_line_with_carriage_return end def test_invalid_trim_mode + pend if RUBY_ENGINE == 'truffleruby' + assert_warning(/#{__FILE__}:#{__LINE__ + 1}/) do @erb.new("", trim_mode: 'abc-def') end diff --git a/test/erb/test_erb_command.rb b/test/erb/test_erb_command.rb index 0baa59d..446efde 100644 --- a/test/erb/test_erb_command.rb +++ b/test/erb/test_erb_command.rb @@ -4,6 +4,7 @@ class TestErbCommand < Test::Unit::TestCase def test_var + pend if RUBY_ENGINE == 'truffleruby' assert_in_out_err(["-I#{File.expand_path('../../lib', __dir__)}", "-w", File.expand_path("../../libexec/erb", __dir__), "var=hoge"], @@ -11,6 +12,7 @@ def test_var end def test_template_file_encoding + pend if RUBY_ENGINE == 'truffleruby' assert_in_out_err(["-I#{File.expand_path('../../lib', __dir__)}", "-w", File.expand_path("../../libexec/erb", __dir__)], "<%=''.encoding.to_s%>", ["UTF-8"]) @@ -18,6 +20,7 @@ def test_template_file_encoding # These interfaces will be removed at Ruby 2.7. def test_deprecated_option + pend if RUBY_ENGINE == 'truffleruby' warnings = [ "warning: -S option of erb command is deprecated. Please do not use this.", /\n.+\/libexec\/erb:\d+: warning: Passing safe_level with the 2nd argument of ERB\.new is deprecated\. Do not use it, and specify other arguments as keyword arguments\.\n/, From fd865911388db2e796c04df022182c198b0f18a5 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 2 Nov 2022 22:56:24 -0700 Subject: [PATCH 5/5] Skip a test for JRuby --- test/erb/test_erb.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb index 5be5ed7..424ddae 100644 --- a/test/erb/test_erb.rb +++ b/test/erb/test_erb.rb @@ -79,6 +79,9 @@ def test_html_escape end def test_concurrent_default_binding + # This test randomly fails with JRuby -- NameError: undefined local variable or method `template2' + pend if RUBY_ENGINE == 'jruby' + template1 = 'one <%= ERB.new(template2).result %>' eval 'template2 = "two"', TOPLEVEL_BINDING