diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..32de8112 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,76 @@ +--- +name: CI +on: + push: + tags: ['v*'] + branches: [master] + pull_request: + branches: ['**'] +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: + - '2.1' + - '2.3' + - '2.4' + - '2.5' + - '2.6' + - '2.7' + - '3.0' + - '3.1' + - '3.2' + - jruby-head + - truffleruby-head + + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: bundle exec rspec --format doc + - uses: codecov/codecov-action@v3 + if: matrix.ruby == '3.2' + with: + files: coverage/coverage.xml + + yard: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - run: bundle exec yardoc --fail-on-warning + + check_version: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - run: bin/check-version + + release: + needs: [test, yard, check_version] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem build *.gemspec + gem push *.gem + env: + GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}" diff --git a/.rspec b/.rspec index 746ab59c..b52c1176 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,2 @@ --color ---exclude_pattern spec/requests/as_content_owner/*_spec.rb ---tag=~slow +--exclude-pattern spec/requests/as_content_owner/*_spec.rb diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 52b0758e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: ruby -notifications: - email: true -matrix: - include: - - rvm: 2.6.3 - gemfile: gemfiles/Gemfile.activesupport-4.x diff --git a/Gemfile b/Gemfile index 2a58b0f2..9bb1eff7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,14 @@ source 'https://rubygems.org' # Specify your gem's dependencies in yt.gemspec -gemspec \ No newline at end of file +gemspec + +not_jruby = %i[ruby mingw x64_mingw].freeze + +# We add non-essential gems like debugging tools and CI dependencies +# here. This also allows us to use conditional dependencies that depend on the +# platform +gem 'pry', platforms: not_jruby +gem 'simplecov' +gem 'simplecov-cobertura' +gem 'yard' diff --git a/MIT-LICENSE b/MIT-LICENSE index a3a80d94..17a3a691 100644 --- a/MIT-LICENSE +++ b/MIT-LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014–present Fullscreen, Inc. +Copyright (c) 2014–present Nullscreen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 6fbb4c9e..00000000 --- a/Rakefile +++ /dev/null @@ -1,11 +0,0 @@ -require "bundler" -Bundler.setup -Bundler::GemHelper.install_tasks - -require "rspec/core/rake_task" -require "rspec/core/version" - -desc "Run all examples" -RSpec::Core::RakeTask.new :spec - -task default: [:spec] \ No newline at end of file diff --git a/bin/check-version b/bin/check-version new file mode 100755 index 00000000..4dab1f2e --- /dev/null +++ b/bin/check-version @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +set -e + +tag="$(git describe --abbrev=0 2>/dev/null || echo)" +echo "Tag: ${tag}" +tag="${tag#v}" +echo "Git Version: ${tag}" +[ "$tag" = '' ] && exit 0 +gem_version="$(ruby -r ./lib/yt/version -e "puts Yt::VERSION" | tail -n1)" +echo "Gem Version: ${gem_version}" + +tag_gt_version="$(ruby -r ./lib/yt/version -e "puts Gem::Version.new(Yt::VERSION) >= Gem::Version.new('${tag}')" | tail -n1)" +test "$tag_gt_version" = true diff --git a/gemfiles/Gemfile.activesupport-3.x b/gemfiles/Gemfile.activesupport-3.x deleted file mode 100644 index 4da1ddfb..00000000 --- a/gemfiles/Gemfile.activesupport-3.x +++ /dev/null @@ -1,4 +0,0 @@ -source 'http://rubygems.org' - -gem 'activesupport', '~> 3.0' -gemspec path: '../' \ No newline at end of file diff --git a/gemfiles/Gemfile.activesupport-4.x b/gemfiles/Gemfile.activesupport-4.x deleted file mode 100644 index 1a3e0aea..00000000 --- a/gemfiles/Gemfile.activesupport-4.x +++ /dev/null @@ -1,4 +0,0 @@ -source 'http://rubygems.org' - -gem 'activesupport', '~> 4.0' -gemspec path: '../' \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6304ea2a..d7f814ba 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,17 @@ require 'simplecov' -SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter -SimpleCov.start +if ENV['CI'] + SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter +else + require 'simplecov-cobertura' + SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter +end + +SimpleCov.start do + enable_coverage :branch + add_filter '/spec/' + add_filter '/vendor/' +end ENV['YT_TEST_CLIENT_ID'] ||= 'XXX' ENV['YT_TEST_CLIENT_SECRET'] ||= 'YYY' diff --git a/yt.gemspec b/yt.gemspec index 94563f15..af21ddf0 100644 --- a/yt.gemspec +++ b/yt.gemspec @@ -5,32 +5,25 @@ require 'yt/version' Gem::Specification.new do |spec| spec.name = "yt" spec.version = Yt::VERSION - spec.authors = ["Claudio Baccigalupo"] - spec.email = ["claudio@fullscreen.net"] + spec.authors = ["Nullscreen"] + spec.email = ["nullscreen.code@gmail.com"] spec.description = %q{Youtube V3 API client.} spec.summary = %q{Yt makes it easy to interact with Youtube V3 API by providing a modular, intuitive and tested Ruby-style API.} - spec.homepage = "http://github.com/Fullscreen/yt" + spec.homepage = "http://github.com/nullscreen/yt" spec.license = "MIT" spec.required_ruby_version = '>= 2.1' - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - end + + spec.files = Dir['lib/**/*.rb', '*.md', '*.txt', '.yardopts', 'MIT-LICENSE'] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency 'activesupport' - # For development / Code coverage / Documentation - spec.add_development_dependency 'bundler' spec.add_development_dependency 'rspec' - spec.add_development_dependency 'rake' - # spec.add_development_dependency 'yard' - # spec.add_development_dependency 'coveralls' - spec.add_development_dependency 'pry' spec.add_development_dependency 'vcr' spec.add_development_dependency 'webmock' end