diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 523c7785..4e88c7f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,61 @@ name: CI -on: [push] +on: + pull_request: + push: + branches: + - master + - main + schedule: + - cron: '0 9 1 * *' + jobs: + koans: + strategy: + fail-fast: false + matrix: + ruby: + - '2.0' + - '2.1' + - '2.2' + - '2.3' + - '2.4' + - '2.5' + - '2.6' + - '2.7' + - '3.0' + - '3.1' + - '3.2' + - '3.3' + - '3.4' + - '4.0' + - ruby-head + os: [ubuntu-latest] + include: + - ruby: '1.9' + os: ubuntu-22.04 + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Install Ruby! + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Run solved koans + run: rake run + test: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v7 - name: Install Ruby! uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2.2" + ruby-version: '4.0' - name: run tests - run: rake test \ No newline at end of file + run: rake test diff --git a/rakelib/checks.rake b/rakelib/checks.rake index c1b20d7d..c5cd2e6a 100644 --- a/rakelib/checks.rake +++ b/rakelib/checks.rake @@ -19,10 +19,10 @@ namespace "check" do task :asserts do puts "Checking for asserts missing the replacement text:" begin - sh "egrep -n 'assert( |_)' src/about_*.rb | egrep -v '__|_n_|project|about_assert' | egrep -v ' *#'" + sh "grep -En 'assert( |_)' src/about_*.rb | grep -Ev '__|_n_|project|about_assert' | grep -Ev ' *#'" puts puts "Examine the above lines for missing __ replacements" - rescue RuntimeError => ex + rescue RuntimeError puts "OK" end puts diff --git a/src/Rakefile b/src/Rakefile index 1a2c7f26..69212630 100644 --- a/src/Rakefile +++ b/src/Rakefile @@ -7,6 +7,8 @@ require 'rake/testtask' task :default => :test task :test do - ruby 'path_to_enlightenment.rb' + ruby 'path_to_enlightenment.rb' do |ok, res| + exit res.exitstatus unless ok + end end diff --git a/src/about_keyword_arguments.rb b/src/about_keyword_arguments.rb index 3c9856b9..2ee443da 100644 --- a/src/about_keyword_arguments.rb +++ b/src/about_keyword_arguments.rb @@ -37,7 +37,7 @@ def test_mandatory_keyword_arguments_without_mandatory_argument exception = assert_raise(___(ArgumentError)) do method_with_mandatory_keyword_arguments end - assert_match(/#{__("missing keyword: :one")}/, exception.message) + assert_match(/#{__("missing keyword: :?one")}/, exception.message) end end diff --git a/src/neo.rb b/src/neo.rb index 0985362a..a9a4224f 100644 --- a/src/neo.rb +++ b/src/neo.rb @@ -26,7 +26,7 @@ def in_ruby_version(*versions) end def before_ruby_version(version) - Gem::Version.new(RUBY_VERSION) < Gem::Version.new(version) + Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new(version) end in_ruby_version("1.8") do @@ -519,6 +519,7 @@ def walk sensei.observe(step.meditate) end sensei.instruct + !sensei.failed? end def each_step @@ -536,6 +537,8 @@ def each_step end END { + exception = $! + Neo::Koan.command_line(ARGV) - Neo::ThePath.new.walk + exit exception.nil? && Neo::ThePath.new.walk } diff --git a/src/path_to_enlightenment.rb b/src/path_to_enlightenment.rb index aacf7cfb..210b3550 100644 --- a/src/path_to_enlightenment.rb +++ b/src/path_to_enlightenment.rb @@ -12,7 +12,7 @@ require 'about_nil' require 'about_hashes' require 'about_methods' -in_ruby_version("2", "3", "4") do +in_ruby_version("2.[1-7]", "3", "4") do require 'about_keyword_arguments' end require 'about_constants'