Skip to content

Commit

Permalink
Migrate CI to GitHub Actions
Browse files Browse the repository at this point in the history
Now that Travis CI.org is no more, this PR migrates the CI to GitHub actions.

In addition to setting up the pipeline, this PR:

1. Removes several gems that are either inapplicable or unsupported (wwtd, minitest-rg)
2. Updates the gemspec and Gemfile to use the gemspec for specifying dependencies
3. Eliminates use of an unused loop variable in favor of an explicit power.
4. Adds testing on modern Rubies
5. Removes the Gemfile.lock so that different Rubies can use different minitest/rake versions
  • Loading branch information
petergoldstein committed Oct 5, 2022
1 parent 5312e36 commit 1196a23
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: build

on: [pull_request, push]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
- '2.4'
- '2.3'
- '2.2'
- '2.1'
- '2.0'
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

6 changes: 1 addition & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
source "https://rubygems.org"

gem "rake"
gem "wwtd"
gem "bump"
gem "minitest"
gem "minitest-rg"
gemspec
22 changes: 0 additions & 22 deletions Gemfile.lock

This file was deleted.

2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'wwtd/tasks'
require 'bump/tasks'

Rake::TestTask.new(:default) do |t|
t.test_files = FileList['test/*_test.rb']
Expand Down
4 changes: 1 addition & 3 deletions lib/rchardet/utf8prober.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def feed(aBuf)
def get_confidence
unlike = 0.99
if @numOfMBChar < 6
for i in (0...@numOfMBChar)
unlike = unlike * ONE_CHAR_PROB
end
unlike = unlike * (ONE_CHAR_PROB ** @numOfMBChar)
return 1.0 - unlike
else
return unlike
Expand Down
3 changes: 3 additions & 0 deletions rchardet.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ Gem::Specification.new "rchardet", CharDet::VERSION do |s|
s.files = Dir["lib/**/*"]
s.license = "LGPL"
s.required_ruby_version = ">= 1.9.3"

s.add_development_dependency "minitest"
s.add_development_dependency "rake"
end
1 change: 0 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'bundler/setup'
require 'minitest/autorun'
require 'minitest/rg'

$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require_relative '../lib/rchardet'

0 comments on commit 1196a23

Please sign in to comment.