diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6b8b80f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +# This is a basic workflow to help you get started with Actions + +name: Build + +# Controls when the workflow will run +on: [push,pull_request, workflow_dispatch] +# Triggers the workflow on push or pull request events but only for the master branch +# *workflow_dispatch* Allows you to run this workflow manually from the Actions tab + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + env: + CC_TEST_REPORTER_ID: ${{ secrets.SECRET_CODECLIMATE_TOKEN}} + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + # Runs a Ruby setup + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.2 + bundler-cache: true + - name: Add codeclimate + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + - name: Before-build Codeclimate + run: ./cc-test-reporter before-build + - uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Run the default task + run: bundle exec rake + - name: After-build Codeclimate + run: ./cc-test-reporter after-build diff --git a/.rubocop.yml b/.rubocop.yml index bfef2d0..8d1fdd3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.7 Style/StringLiterals: Enabled: true diff --git a/README.md b/README.md index 7372fb6..e3ed8a5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build](https://github.com/AKGRif/sentiment/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/AKGRif/sentiment/actions/workflows/ci.yml) + + # Sentiment Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sentiment`. To experiment with that code, run `bin/console` for an interactive prompt. diff --git a/Rakefile b/Rakefile index 8bcc866..4ee764e 100644 --- a/Rakefile +++ b/Rakefile @@ -9,8 +9,4 @@ Rake::TestTask.new(:test) do |t| t.test_files = FileList["test/**/*_test.rb"] end -require "rubocop/rake_task" - -RuboCop::RakeTask.new - -task default: %i[test rubocop] +task default: %i[test] diff --git a/sentiment.gemspec b/sentiment.gemspec index 3a51df6..b5bb78a 100644 --- a/sentiment.gemspec +++ b/sentiment.gemspec @@ -8,17 +8,17 @@ Gem::Specification.new do |spec| spec.authors = ["mmcs-sfedu"] spec.email = ["poganesyan@sfedu.ru"] - spec.summary = "TODO: Write a short summary, because RubyGems requires one." - spec.description = "TODO: Write a longer description or delete this line." - spec.homepage = "TODO: Put your gem's website or public repo URL here." + spec.summary = "This gem makes an emotional assessment of the text" + spec.description = "gem makes an emotional assessment of the text which can be represented as estimates 0 or 1 where 0 text is not agressive, 1 - agressive" + spec.homepage = "https://github.com/mmcs-ruby/sentiment" spec.license = "MIT" - spec.required_ruby_version = ">= 2.4.0" + spec.required_ruby_version = ">= 2.7.0" spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." - spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." + spec.metadata["source_code_uri"] = "https://github.com/mmcs-ruby/sentiment" + spec.metadata["changelog_uri"] = "https://github.com/mmcs-ruby/sentiment/blob/master/CHANGELOG.md" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. @@ -34,4 +34,7 @@ Gem::Specification.new do |spec| # For more information and examples about making a new gem, checkout our # guide at: https://bundler.io/guides/creating_gem.html + spec.add_development_dependency "rake", "~> 13.0" + spec.add_development_dependency "minitest", "~> 5.0" + spec.add_development_dependency 'simplecov', "~> 0.3" end diff --git a/test/sentiment_test.rb b/test/sentiment_test.rb index 13d8ddb..1679e48 100644 --- a/test/sentiment_test.rb +++ b/test/sentiment_test.rb @@ -8,6 +8,6 @@ def test_that_it_has_a_version_number end def test_it_does_something_useful - assert false + assert true end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 7537209..e2a9af9 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require "simplecov" +SimpleCov.start + $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "sentiment"