Skip to content

Commit a604002

Browse files
committed
Prepare CI with GitHub actions for publishing
1 parent b23eee4 commit a604002

File tree

11 files changed

+121
-45
lines changed

11 files changed

+121
-45
lines changed

.github/workflows/ci.yml

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