Skip to content

Commit

Permalink
Migrate to GitHub actions
Browse files Browse the repository at this point in the history
- Add test and publish workflows
- Format codebase using StandardRB
  • Loading branch information
krmbzds committed Mar 15, 2022
1 parent 98055fe commit 1621c2c
Show file tree
Hide file tree
Showing 17 changed files with 225 additions and 168 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish

on:
release:
types: [published]

jobs:
build:
name: Publish Packages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Publish to RubyGems
uses: dawidd6/action-publish-gem@v1
with:
api_key: ${{secrets.RUBYGEMS_AUTH_TOKEN}}

53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test

on:
pull_request:

push:
branches: [ develop, master ]

env:
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_BRANCH: ${{ github.ref }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

jobs:

lint:
runs-on: ubuntu-latest
name: lint ${{ matrix.ruby }}
strategy:
fail-fast: false
matrix:
ruby: [ '2.6.9', '2.7.5', '3.0.3', '3.1.1' ]

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: StandardRB
continue-on-error: ${{ matrix.experimental }}
run: bundle exec standardrb --parallel --format progress

test:
needs: [ lint ]
runs-on: ubuntu-latest
name: test ${{ matrix.ruby }}
strategy:
fail-fast: false
matrix:
ruby: [ '2.6.9', '2.7.5', '3.0.3', '3.1.1' ]

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Test
continue-on-error: ${{ matrix.experimental }}
run: bundle exec rake
1 change: 0 additions & 1 deletion .ruby-gemset

This file was deleted.

1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.1.1
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

# Specify your gem's dependencies in tate.gemspec
gemspec
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Kerem Bozdas
Copyright (c) 2022 Kerem Bozdas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Tate ✍️

[![Build Status](https://img.shields.io/travis/krmbzds/tate.svg)](https://travis-ci.org/krmbzds/tate)
[![Code Coverage](https://img.shields.io/codeclimate/coverage/krmbzds/tate.svg)](https://codeclimate.com/github/krmbzds/tate/test_coverage)
[![Build Status](https://img.shields.io/github/workflow/status/krmbzds/tate/Test/master)](https://github.com/krmbzds/tate/actions/workflows/test.yml)
[![Coveralls](https://img.shields.io/coveralls/github/krmbzds/tate)](https://coveralls.io/github/krmbzds/tate)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/krmbzds/tate.svg)](https://codeclimate.com/github/krmbzds/tate/maintainability)
[![Downloaded](https://img.shields.io/gem/dt/tate.svg)](https://rubygems.org/gems/tate)
[![Downloads](https://img.shields.io/gem/dt/tate.svg)](https://rubygems.org/gems/tate)
[![Gem Version](https://img.shields.io/gem/v/tate.svg)](https://rubygems.org/gems/tate)

**Tate** converts accented characters and transliterates non-latin scripts to their closest ASCII equivalent.
Expand Down Expand Up @@ -127,9 +127,10 @@ Yes.

This gem is tested against the following Ruby versions:

-`2.7.1` (stable)
-`2.6.6` (stable)
-`2.5.8` (security maintenance)
-`3.1.1` (stable)
-`3.0.3` (stable)
-`2.7.5` (stable)
-`2.6.9` (security maintenance)

## Development

Expand Down Expand Up @@ -161,7 +162,7 @@ Nobody has time to type transliterate in the terminal.

## License

Copyright © 2016-2020 [Kerem Bozdas][Personal Webpage]
Copyright © 2016-2022 [Kerem Bozdas][Personal Webpage]

This project is available under the terms of the [MIT License][License].

Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

Expand Down
6 changes: 3 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'tate'
require "bundler/setup"
require "tate"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -11,5 +11,5 @@ require 'tate'
# require "pry"
# Pry.start

require 'irb'
require "irb"
IRB.start
14 changes: 7 additions & 7 deletions bin/tate
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
lib = File.expand_path(File.dirname(__FILE__) + "/../lib")
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)

require 'tate'
require 'optionparser'
require "tate"
require "optionparser"

options = {}

option_parser = OptionParser.new do |opts|
opts.banner = 'Usage: tate [-l LANGUAGE]'
opts.on('-l LANGUAGE', '--language LANGUAGE', String, 'Set language for custom filters') do |language|
opts.banner = "Usage: tate [-l LANGUAGE]"
opts.on("-l LANGUAGE", "--language LANGUAGE", String, "Set language for custom filters") do |language|
options[:language] = language
end
opts.on('-h', '--help', 'Show this message') do
opts.on("-h", "--help", "Show this message") do
options[:help] = opts.help
end
opts.on('-v', '--version', 'Show version') do
opts.on("-v", "--version", "Show version") do
options[:version] = Tate::VERSION
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/tate.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# frozen_string_literal: true

lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
lib = File.expand_path(File.dirname(__FILE__) + "/../lib")
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)

require 'tate/version'
require 'i18n'
require 'yaml'
require "tate/version"
require "i18n"
require "yaml"

I18n.load_path << Dir[File.expand_path("#{lib}/config/locales/*.yml")]
I18n.enforce_available_locales = false
I18n.default_locale = :en

module Tate
def self.transliterate(string, language = nil, _replacement = '?')
def self.transliterate(string, language = nil, _replacement = "?")
I18n.transliterate(string, locale: language)
end
end
2 changes: 1 addition & 1 deletion lib/tate/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Tate
VERSION = '1.6.0'
VERSION = "1.6.0"
end
8 changes: 4 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require 'simplecov'
SimpleCov.start
require "coveralls"
Coveralls.wear!

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'tate'
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "tate"
Loading

0 comments on commit 1621c2c

Please sign in to comment.