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

Commit f256e68

Browse files
authored
Circleci test (#90)
* Add minitest-ci * Add circleci fconfig * force * Install bundler * Add workflow * meow * meow meow * Make thigns a run * bundle install * Store test results * Add things to the helper * Update tests * Specify better path * better? * at dot * meow * Fix CircleCI * Use webmock * Add badge
1 parent 04297ef commit f256e68

5 files changed

Lines changed: 47 additions & 1 deletion

File tree

.circleci/config.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2.1
2+
3+
jobs:
4+
build: # our first job, named "build"
5+
docker:
6+
- image: circleci/ruby:2.7
7+
steps:
8+
- checkout # pull down our git code.
9+
- run:
10+
name: Install bundler
11+
command: gem install bundler
12+
- run:
13+
name: Bundle install
14+
command: bundle install
15+
- run:
16+
name: Run rakefile
17+
command: bundle exec rake
18+
- store_test_results:
19+
path: '.'
20+
21+
workflow:
22+
version: 2.1
23+
build-test:
24+
jobs:
25+
- build
26+

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Please upgrade to the latest versions to continue using this uploader.
77
[![Codecov](https://codecov.io/github/codecov/codecov-ruby/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-ruby?branch=master)
88
[![Gem Version](https://badge.fury.io/rb/codecov.svg)](https://badge.fury.io/rb/codecov.svg)
99
[![Build Status](https://secure.travis-ci.org/codecov/codecov-ruby.svg?branch=master)](http://travis-ci.org/codecov/codecov-ruby)
10+
[![Codecov](https://circleci.com/gh/codecov/codecov-ruby.svg?style=svg)](https://circleci.com/gh/codecov/codecov-ruby)
11+
1012

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

codecov.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
2020
s.add_dependency 'simplecov'
2121

2222
s.add_development_dependency 'minitest'
23+
s.add_development_dependency 'minitest-ci'
2324
s.add_development_dependency 'mocha'
2425
s.add_development_dependency 'rake'
2526
s.add_development_dependency 'rubocop'

test/helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
require 'minitest/autorun'
1414
require 'mocha/minitest'
1515
require 'webmock/minitest'
16+
17+
require 'minitest/ci'
18+
Minitest::Ci.report_dir = '.' if ENV['CIRCLECI']

test/test_codecov.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ class TestCodecov < Minitest::Test
66
CI = SimpleCov::Formatter::Codecov.new.detect_ci
77

88
REALENV =
9-
if CI == SimpleCov::Formatter::Codecov::GITHUB
9+
if CI == SimpleCov::Formatter::Codecov::CIRCLE
10+
{
11+
'CIRCLECI' => ENV['CIRCLECI'],
12+
'CIRCLE_BUILD_NUM' => ENV['CIRCLE_BUILD_NUM'],
13+
'CIRCLE_NODE_INDEX' => ENV['CIRCLE_NODE_INDEX'],
14+
'CIRCLE_PROJECT_REPONAME' => ENV['CIRCLE_PROJECT_REPONAME'],
15+
'CIRCLE_PROJECT_USERNAME' => ENV['CIRCLE_PROJECT_USERNAME'],
16+
'CIRCLE_REPOSITORY_URL' => ENV['CIRCLE_REPOSITORY_URL'],
17+
'CIRCLE_PR_NUMBER' => ENV['CIRCLE_PR_NUMBER'],
18+
'CIRCLE_BRANCH' => ENV['CIRCLE_BRANCH'],
19+
'CIRCLE_SHA1' => ENV['CIRCLE_SHA1']
20+
}
21+
elsif CI == SimpleCov::Formatter::Codecov::GITHUB
1022
{
1123
'GITHUB_ACTIONS' => ENV['GITHUB_ACTIONS'],
1224
'GITHUB_HEAD_REF' => ENV['GITHUB_HEAD_REF'],
@@ -51,6 +63,7 @@ def stub_file(filename, coverage)
5163
end
5264

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

93106
def setup
94107
ENV['CI'] = nil
108+
ENV['CIRCLECI'] = nil
95109
ENV['GITHUB_ACTIONS'] = nil
96110
ENV['TRAVIS'] = nil
97111
end

0 commit comments

Comments
 (0)