Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Circleci test #90

Merged
merged 19 commits into from
Aug 21, 2020
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2.1

jobs:
build: # our first job, named "build"
docker:
- image: circleci/ruby:2.7
steps:
- checkout # pull down our git code.
- run:
name: Install bundler
command: gem install bundler
- run:
name: Bundle install
command: bundle install
- run:
name: Run rakefile
command: bundle exec rake
- store_test_results:
path: '.'

workflow:
version: 2.1
build-test:
jobs:
- build

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Please upgrade to the latest versions to continue using this uploader.
[![Codecov](https://codecov.io/github/codecov/codecov-ruby/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-ruby?branch=master)
[![Gem Version](https://badge.fury.io/rb/codecov.svg)](https://badge.fury.io/rb/codecov.svg)
[![Build Status](https://secure.travis-ci.org/codecov/codecov-ruby.svg?branch=master)](http://travis-ci.org/codecov/codecov-ruby)
[![Codecov](https://circleci.com/gh/codecov/codecov-ruby.svg?style=svg)](https://circleci.com/gh/codecov/codecov-ruby)


[Codecov.io](https://codecov.io/) upload support for Ruby.

Expand Down
1 change: 1 addition & 0 deletions codecov.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Gem::Specification.new do |s|
s.add_dependency 'simplecov'

s.add_development_dependency 'minitest'
s.add_development_dependency 'minitest-ci'
s.add_development_dependency 'mocha'
s.add_development_dependency 'rake'
s.add_development_dependency 'rubocop'
Expand Down
3 changes: 3 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
require 'minitest/autorun'
require 'mocha/minitest'
require 'webmock/minitest'

require 'minitest/ci'
Minitest::Ci.report_dir = '.' if ENV['CIRCLECI']
16 changes: 15 additions & 1 deletion test/test_codecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@ class TestCodecov < Minitest::Test
CI = SimpleCov::Formatter::Codecov.new.detect_ci

REALENV =
if CI == SimpleCov::Formatter::Codecov::GITHUB
if CI == SimpleCov::Formatter::Codecov::CIRCLE
{
'CIRCLECI' => ENV['CIRCLECI'],
'CIRCLE_BUILD_NUM' => ENV['CIRCLE_BUILD_NUM'],
'CIRCLE_NODE_INDEX' => ENV['CIRCLE_NODE_INDEX'],
'CIRCLE_PROJECT_REPONAME' => ENV['CIRCLE_PROJECT_REPONAME'],
'CIRCLE_PROJECT_USERNAME' => ENV['CIRCLE_PROJECT_USERNAME'],
'CIRCLE_REPOSITORY_URL' => ENV['CIRCLE_REPOSITORY_URL'],
'CIRCLE_PR_NUMBER' => ENV['CIRCLE_PR_NUMBER'],
'CIRCLE_BRANCH' => ENV['CIRCLE_BRANCH'],
'CIRCLE_SHA1' => ENV['CIRCLE_SHA1']
}
elsif CI == SimpleCov::Formatter::Codecov::GITHUB
{
'GITHUB_ACTIONS' => ENV['GITHUB_ACTIONS'],
'GITHUB_HEAD_REF' => ENV['GITHUB_HEAD_REF'],
Expand Down Expand Up @@ -51,6 +63,7 @@ def stub_file(filename, coverage)
end

def upload(success = true)
WebMock.enable!
formatter = SimpleCov::Formatter::Codecov.new
result = stub('SimpleCov::Result', files: [
stub_file('/path/lib/something.rb', [1, 0, 0, nil, 1, nil]),
Expand Down Expand Up @@ -92,6 +105,7 @@ def assert_successful_upload(data)

def setup
ENV['CI'] = nil
ENV['CIRCLECI'] = nil
ENV['GITHUB_ACTIONS'] = nil
ENV['TRAVIS'] = nil
end
Expand Down