Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add coverage report via Code Climate and simplecov #214

Merged
merged 5 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI

on: [push, pull_request]
on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
checks: write
Expand All @@ -24,7 +28,14 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rspec
- name: Run tests
run: bundle exec rspec
- name: Publish code coverage
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov
linter:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source "http://rubygems.org"

gemspec

gem "coveralls", require: false
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![Gem Version](https://badge.fury.io/rb/video_info.svg)](http://badge.fury.io/rb/video_info)
[![CI](https://github.com/thibaudgg/video_info/actions/workflows/ci.yml/badge.svg)](https://github.com/thibaudgg/video_info/actions/workflows/ci.yml)
[![Code Climate](https://codeclimate.com/github/thibaudgg/video_info.svg)](https://codeclimate.com/github/thibaudgg/video_info)
[![Coverage Status](https://coveralls.io/repos/thibaudgg/video_info/badge.svg?branch=master)](https://coveralls.io/r/thibaudgg/video_info)
[![Maintainability](https://api.codeclimate.com/v1/badges/1f03474bdb81e735002c/maintainability)](https://codeclimate.com/github/thibaudgg/video_info/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/1f03474bdb81e735002c/test_coverage)](https://codeclimate.com/github/thibaudgg/video_info/test_coverage)
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)

Simple Ruby Gem to get video info from Dailymotion, Vimeo, Wistia and YouTube (with playlist).
Expand Down Expand Up @@ -32,11 +32,10 @@ Youtube and Vimeo have recently updated their APIs to require API keys.

Scrapers has been implemented for both Youtube and Vimeo. However, the Youtube scraper can only get the date the video was posted, while the API is able to get the date and the exact time the video was posted. You may also wish to use the API to protect against potential HTML changes that could break the scrapers.

To get a Youtube API key, [follow the instructions here](https://developers.google.com/youtube/registering_an_application)
**How to get these API keys**

After generating a Youtube API key it is necessary to enable the YouTube Data API for the project which your API key was generated [enable Youtube Data API here](https://console.developers.google.com/apis/library/youtube.googleapis.com)

To get a Vimeo API key, [follow the instructions here](https://developer.vimeo.com/api/start)
- To get a Youtube API key, [follow the instructions here](https://developers.google.com/youtube/registering_an_application). After generating a Youtube API key it is necessary to enable the YouTube Data API for the project which your API key was generated [enable Youtube Data API here](https://console.developers.google.com/apis/library/youtube.googleapis.com).
- To get a Vimeo API key, [follow the instructions here](https://developer.vimeo.com/api/start).

To set the API keys, do the following:

Expand Down
15 changes: 10 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
require "simplecov"

SimpleCov.formatter = if ENV["CI"]
require "simplecov_json_formatter"
SimpleCov::Formatter::JSONFormatter
else
SimpleCov::Formatter::HTMLFormatter
end
SimpleCov.start

require "rspec"
require "rspec/its"
require "video_info"
require "vcr"

if ENV["CI"]
require "coveralls"
Coveralls.wear!
end

VCR.configure do |config|
config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
config.default_cassette_options = {
Expand Down
1 change: 1 addition & 0 deletions video_info.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rake", ">= 12.3.3"
s.add_development_dependency "rspec", "~> 3.4"
s.add_development_dependency "rspec-its", "~> 1.2"
s.add_development_dependency "simplecov", "~> 0.22"
s.add_development_dependency "standard", "~> 1.23"
s.add_development_dependency "vcr", "~> 6.1"
s.add_development_dependency "webmock", "~> 3.7"
Expand Down