Skip to content

Commit

Permalink
Update Rakefile, Actions, fix warning (#432)
Browse files Browse the repository at this point in the history
* Rakefile - add code from bin/test, fixup rake test

* ci.yml - add more jobs, run tests with rake

* test/frames/frame_request_controller_test.rb - fix regex warning
  • Loading branch information
MSP-Greg committed Feb 20, 2023
1 parent c500735 commit 9281d62
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 26 deletions.
42 changes: 20 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
name: CI
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
jobs:
tests:
strategy:
fail-fast: false
matrix:
ruby-version:
- "2.7"
- "3.0"
rails-version:
- "6.1"
- "7.0"
- "main"
rails: [ "6.1", "7.0" ]
ruby: [ "2.7", "3.0", "3.1", "3.2" ]
allow-fail: [ false ]
include:
- { ruby-version: "3.2", rails-version: "7.0" }

# Disabled until minitest relaxes its upper bound: https://github.com/seattlerb/minitest/pull/862
# > minitest-5.14.2 requires ruby version < 3.1, >= 2.2, which is incompatible with the current version, ruby 3.1.0p-1
#
# include:
# - ruby-version: head
# continue-on-error: true
- { ruby: "2.7", rails: "main", allow-fail: true }
- { ruby: "3.2", rails: "main", allow-fail: true }
- { ruby: "head", rails: "main", allow-fail: true }

env:
RAILS_VERSION: "${{ matrix.rails-version }}"
RAILS_VERSION: "${{ matrix.rails }}"

name: ${{ format('Tests (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
name: ${{ format('Tests (Ruby {0}, Rails {1})', matrix.ruby, matrix.rails) }}
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v1

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
ruby-version: ${{ matrix.ruby }}
rubygems: latest
bundler-cache: true

- name: Run tests
run: |
bin/test test/**/*_test.rb
id: test
run: bundle exec rake TESTOPT=-vdc
continue-on-error: ${{ matrix.allow-fail || false }}

- name: >-
Test outcome: ${{ steps.test.outcome }}
# every step must define a `uses` or `run` key
run: echo NOOP
- name: Fail when generated changes are not checked-in
run: |
git update-index --refresh
Expand Down
17 changes: 15 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@ load "rails/tasks/statistics.rake"
Rake::TestTask.new do |test|
test.libs << "test"
test.test_files = FileList["test/**/*_test.rb"]
test.warning = false
end

task default: :test
task :test_prereq do
puts "Installing Ruby dependencies"
`bundle install`

puts "Installing JavaScript dependencies"
`yarn install`

puts "Building JavaScript"
`yarn build`

puts "Preparing test database"
`cd test/dummy; ./bin/rails db:test:prepare; cd ../..`
end

task default: [:test_prereq, :test]
4 changes: 2 additions & 2 deletions test/frames/frame_request_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class Turbo::FrameRequestControllerTest < ActionDispatch::IntegrationTest
turbo_frame_request_id = "test_frame_id"

get tray_path(id: 1)
assert_no_match /#{turbo_frame_request_id}/, @response.body
assert_no_match(/#{turbo_frame_request_id}/, @response.body)

get tray_path(id: 1), headers: { "Turbo-Frame" => turbo_frame_request_id }
assert_match /#{turbo_frame_request_id}/, @response.body
assert_match(/#{turbo_frame_request_id}/, @response.body)
end

private
Expand Down

0 comments on commit 9281d62

Please sign in to comment.