Skip to content

Commit

Permalink
Migrate to GitHub Actions for tests workflow (#79)
Browse files Browse the repository at this point in the history
* Add Tests GHA workflow to replace Travis

* Delete .travis.yml

* Fix warning on regex ambiguity, wrap in parens

Simple fix for this ambiguity warning to wrap the arguments with parens. This warning was reported on all versions of Ruby tested in this update.

```
clockwork/test/clockwork_test.rb:43: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator
clockwork/test/clockwork_test.rb:57: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator
```

* Remove gemfiles folder

These are no longer needed since we dynamically change the ActiveSupport version installed through an environment variable in the root Gemfile.
  • Loading branch information
javierjulio authored Dec 9, 2022
1 parent 49075c2 commit 2d46957
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 47 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ "2.7", "3.0", "3.1", "3.2", jruby ]
active_support: [ "6.0", "7.0" ]
exclude:
- ruby: "3.0"
active_support: "6.0"
- ruby: "3.1"
active_support: "6.0"
- ruby: "3.2"
active_support: "6.0"
name: Ruby ${{ matrix.ruby }} - ActiveSupport ${{ matrix.active_support }}
env:
ACTIVE_SUPPORT_VERSION: ${{ matrix.active_support }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run Tests
env:
RUBYOPT: "-W:deprecated" # Show Ruby's deprecation warnings
run: |
bundle exec rake
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
source 'https://rubygems.org'

gemspec

rails_version = ENV.fetch("ACTIVE_SUPPORT_VERSION", "7.0")

gem "activesupport", "~> #{rails_version}"
gem "minitest", "~> 5.0"
5 changes: 0 additions & 5 deletions gemfiles/activesupport4.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/activesupport5.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/activesupport6.gemfile

This file was deleted.

4 changes: 2 additions & 2 deletions test/clockwork_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
Clockwork.run
assert run
assert @log_output.string.include?("Triggering 'an event'")
assert_match /Finished 'an event' duration_ms=\d+ error=nil/, @log_output.string
assert_match(/Finished 'an event' duration_ms=\d+ error=nil/, @log_output.string)
end

it 'should log exceptions' do
Expand All @@ -54,7 +54,7 @@
Clockwork.run
assert run
assert @log_output.string.include?("Triggering 'an event'")
assert_match /Finished 'an event' duration_ms=\d+ error=#<RuntimeError: boom>/, @log_output.string
assert_match(/Finished 'an event' duration_ms=\d+ error=#<RuntimeError: boom>/, @log_output.string)
end

it 'should pass event without modification to handler' do
Expand Down

0 comments on commit 2d46957

Please sign in to comment.