Skip to content

Commit

Permalink
Prepare CI with GitHub actions for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhoward committed Jan 23, 2024
1 parent b23eee4 commit 846aa8d
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 43 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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}}"
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

12 changes: 11 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in yt.gemspec
gemspec
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'
4 changes: 2 additions & 2 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 changes: 0 additions & 11 deletions Rakefile

This file was deleted.

4 changes: 0 additions & 4 deletions gemfiles/Gemfile.activesupport-3.x

This file was deleted.

4 changes: 0 additions & 4 deletions gemfiles/Gemfile.activesupport-4.x

This file was deleted.

14 changes: 12 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
17 changes: 5 additions & 12 deletions yt.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ["[email protected]"]
spec.authors = ["Nullscreen"]
spec.email = ["[email protected]"]
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

0 comments on commit 846aa8d

Please sign in to comment.