Skip to content

Commit 83ce3b8

Browse files
authored
Prepare CI with GitHub actions for publishing (#428)
1 parent 746a1b3 commit 83ce3b8

File tree

11 files changed

+127
-45
lines changed

11 files changed

+127
-45
lines changed

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: CI
3+
on:
4+
push:
5+
tags: ['v*']
6+
branches: [master]
7+
pull_request:
8+
branches: ['**']
9+
jobs:
10+
# Tests are currently failing because they rely on a live YouTube account
11+
# Until that issue is resolved, the tests are not very useful. Disabling them
12+
# in CI for now.
13+
# test:
14+
# runs-on: ubuntu-latest
15+
# strategy:
16+
# fail-fast: false
17+
# matrix:
18+
# ruby:
19+
# - '2.1'
20+
# - '2.3'
21+
# - '2.4'
22+
# - '2.5'
23+
# - '2.6'
24+
# - '2.7'
25+
# - '3.0'
26+
# - '3.1'
27+
# - '3.2'
28+
# - '3.3'
29+
# - jruby-head
30+
# - truffleruby-head
31+
#
32+
# steps:
33+
# - uses: actions/checkout@v4
34+
# - uses: ruby/setup-ruby@v1
35+
# with:
36+
# ruby-version: ${{ matrix.ruby }}
37+
# bundler-cache: true
38+
# - run: bundle exec rspec --format doc
39+
# - uses: codecov/codecov-action@v3
40+
# if: matrix.ruby == '3.2'
41+
# with:
42+
# files: coverage/coverage.xml
43+
44+
yard:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v3
48+
- uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: '2.7'
51+
bundler-cache: true
52+
- run: bundle exec yardoc --fail-on-warning
53+
54+
check_version:
55+
runs-on: ubuntu-latest
56+
if: startsWith(github.ref, 'refs/tags/v')
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: ruby/setup-ruby@v1
60+
with:
61+
ruby-version: '2.7'
62+
bundler-cache: true
63+
- run: bin/check-version
64+
65+
release:
66+
# Disabling tests for now
67+
# needs: [test, yard, check_version]
68+
needs: [yard, check_version]
69+
if: startsWith(github.ref, 'refs/tags/v')
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v3
73+
- name: Publish to RubyGems
74+
run: |
75+
mkdir -p $HOME/.gem
76+
touch $HOME/.gem/credentials
77+
chmod 0600 $HOME/.gem/credentials
78+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
79+
gem build *.gemspec
80+
gem push *.gem
81+
env:
82+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"

.rspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
--color
2-
--exclude_pattern spec/requests/as_content_owner/*_spec.rb
3-
--tag=~slow
2+
--exclude-pattern spec/requests/as_content_owner/*_spec.rb

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

Gemfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
source 'https://rubygems.org'
22

33
# Specify your gem's dependencies in yt.gemspec
4-
gemspec
4+
gemspec
5+
6+
not_jruby = %i[ruby mingw x64_mingw].freeze
7+
8+
# We add non-essential gems like debugging tools and CI dependencies
9+
# here. This also allows us to use conditional dependencies that depend on the
10+
# platform
11+
gem 'pry', platforms: not_jruby
12+
gem 'simplecov'
13+
gem 'simplecov-cobertura'
14+
gem 'yard'

MIT-LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014–present Fullscreen, Inc.
1+
Copyright (c) 2014–present Nullscreen
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1717
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1818
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1919
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Rakefile

Lines changed: 0 additions & 11 deletions
This file was deleted.

bin/check-version

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env sh
2+
3+
set -e
4+
5+
tag="$(git describe --abbrev=0 2>/dev/null || echo)"
6+
echo "Tag: ${tag}"
7+
tag="${tag#v}"
8+
echo "Git Version: ${tag}"
9+
[ "$tag" = '' ] && exit 0
10+
gem_version="$(ruby -r ./lib/yt/version -e "puts Yt::VERSION" | tail -n1)"
11+
echo "Gem Version: ${gem_version}"
12+
13+
tag_gt_version="$(ruby -r ./lib/yt/version -e "puts Gem::Version.new(Yt::VERSION) >= Gem::Version.new('${tag}')" | tail -n1)"
14+
test "$tag_gt_version" = true

gemfiles/Gemfile.activesupport-3.x

Lines changed: 0 additions & 4 deletions
This file was deleted.

gemfiles/Gemfile.activesupport-4.x

Lines changed: 0 additions & 4 deletions
This file was deleted.

spec/spec_helper.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
require 'simplecov'
22

3-
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
4-
SimpleCov.start
3+
if ENV['CI']
4+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
5+
else
6+
require 'simplecov-cobertura'
7+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
8+
end
9+
10+
SimpleCov.start do
11+
enable_coverage :branch
12+
add_filter '/spec/'
13+
add_filter '/vendor/'
14+
end
515

616
ENV['YT_TEST_CLIENT_ID'] ||= 'XXX'
717
ENV['YT_TEST_CLIENT_SECRET'] ||= 'YYY'

0 commit comments

Comments
 (0)